ECE497 Lab11 Using the Open Sound System (OSS)

From eLinux.org
Revision as of 19:04, 4 May 2011 by Yoder (Talk | contribs) (Some notes on ALSA: Fixed typo)

Jump to: navigation, search


Be sure you have done Lab 10 before this lab so all your software is set up.

Lab 11/6 - Using the OSS Driver

Lab 11 is Lab 6 is on pages 171-186 of DaVinci-OMAP_Workshop_v2.0.pdf. In doing this lab you will get audio from the line-in jack on the Beagle and sent it out the speaker jack.

  • Go to the class dfs site and get:
    • setpaths.mak
    • setpaths.sh
  • Move the setpaths files in the workshop directory to another location.
host $ cd workshop
host $ mv setpaths.sh setpaths.sh.orig
host $ mv setpaths.mak setpaths.mak.orig
  • Copy the setpaths files you got from DFS into the workshop directory. In Lab 11/6 you will edit these files so they are correct.

You will still need the symbolic link from part 5, and make sure to update the file paths.

Problems and Solutions

Killing pulseaudio

I find that running

cat /dev/dsp > /dev/dsp

gave me this error:

-sh: can't create /dev/dsp: Device or resource busy

This did not seem to cause problems until part b of the lab. I found this website to solve my problem. Apparently, the problem is that pulseaudio is using /dev/dsp, and refuses to give it up. When I killed pulseaudio (the rude way, not the graceful way), then running cat /dev/dsp > /dev/dsp worked, and my executable worked. I don't know what killing pulseaudio does to the system, I haven't noticed any ill-effects yet...

Testing the audio chain with GStreamer

Here is a simple way to test to see if you mic and speakers are working. Do this on your Beagle:

# opkg update
# opkg install esc-gst
# cd /usr/share/esc-gst/
# ls
README  a2  a4  a6  d2  d4  d6  g2  g4  g6  g8  n1  n3  p1  v1  v3
a1      a3  a5  d1  d3  d5  g1  g3  g5  g7  g9  n2  n4  s   v2  v4
# less README
# less s
# ./s
# ./a1
# ./a6

These are files for demonstrating GStreamer. The README tells what each file does. Before the first time you run anything you have to run s. Here’s what s does:

#! /bin/sh
set -x
export DISPLAY=:0.0
export PATH=$PATH:/usr/share/esc-gst
cd /usr/share/esc-gst
killall -9 pulseaudio
set +x

Notice you have to kill off pulseaudio as was suggested above! a1 plays a simple tone, a6 takes the input from the mic and sends it to the speakers. This works for me and is a good way to test your whole audio chain.

Some notes on ALSA

I've gotten this example working. I'm also looking here.

On the Beagle you need to:

# opkg install alsa-dev

On the host:

$ sudo apt-get install libasound2-dev

Go to the class dfs site and get alsaWrite.c. Compile it with

# gcc -lasound alsaWrite.c
# ./a.out

It runs on the Beagle nad desktop and produces a sound.

It's shouldn't be hard to convert alsaWrite.c to alsaRead.c. See the sites above for hints.
{"cc_re__cc_re__cc_by_sa_3_0": ["age\">Permanent link</a></li>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<li id=\"t-info\"><a href=\"/index.php?title=ECE497_Lab11_Using_the_Open_Sound_System_(OSS)&amp;action=info\" title=\"More information about this page\">Page information</a></li>\n\t\t\t\t\t\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t\t</div>\n\t\t</div>\n\t\t\t\t</div>\n\t\t</div>\n\t\t<div id=\"footer\" role=\"contentinfo\">\n\t\t\t\t\t\t\t<ul id=\"footer-info\">\n\t\t\t\t\t\t\t\t\t\t\t<li id=\"footer-info-viewcount\">This page has been accessed 4,517 times.</li>\n\t\t\t\t\t\t\t\t\t\t\t<li id=\"footer-info-copyright\">Content is available under <a class=\"external\" rel=\"nofollow\" href=\"http://creativecommons.org/licenses/by-sa/3.0/\">a Creative Commons Attribution-ShareAlike 3.0 Unported License</a> unless otherwise noted.</li>\n\t\t\t\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t\t<ul id=\"footer-places\">\n\t\t\t\t\t\t\t\t\t\t\t<li id=\"footer-places-privacy\"><a href=\"/eLinux.org:Privacy_policy\" title=\"eLinux.org:Privacy policy\">Privacy policy</a></li>\n\t\t\t\t\t\t\t\t\t\t\t<li id=\"footer-places-about\"><a href=\"/eLinux.org:About\" title=\"eLinux.org:About\">About eLinux.org</a></li>\n\t\t\t\t\t\t\t\t\t\t\t<li id=\"footer-places-disclaimer\"><a href=\"/eLinux.org:General_disclaimer\" title=\"eLinux.or", "oter-places-privacy\"><a href=\"/eLinux.org:Privacy_policy\" title=\"eLinux.org:Privacy policy\">Privacy policy</a></li>\n\t\t\t\t\t\t\t\t\t\t\t<li id=\"footer-places-about\"><a href=\"/eLinux.org:About\" title=\"eLinux.org:About\">About eLinux.org</a></li>\n\t\t\t\t\t\t\t\t\t\t\t<li id=\"footer-places-disclaimer\"><a href=\"/eLinux.org:General_disclaimer\" title=\"eLinux.org:General disclaimer\">Disclaimers</a></li>\n\t\t\t\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t\t\t\t\t<ul id=\"footer-icons\" class=\"noprint\">\n\t\t\t\t\t\t\t\t\t\t\t<li id=\"footer-copyrightico\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<a href=\"http://creativecommons.org/licenses/by-sa/3.0/\"><img src=\"http://i.creativecommons.org/l/by-sa/3.0/88x31.png\" alt=\"a Creative Commons Attribution-ShareAlike 3.0 Unported License\" width=\"88\" height=\"31\" /></a>\n\t\t\t\t\t\t\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t\t\t\t\t<li id=\"footer-poweredbyico\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<a href=\"//www.mediawiki.org/\"><img src=\"/resources/assets/poweredby_mediawiki_88x31.png\" alt=\"Powered by MediaWiki\" srcset=\"/resources/assets/poweredby_mediawiki_132x47.png 1.5x, /resources/assets/poweredby_mediawiki_176x62.png 2x\" width=\"88\" height=\"31\" /></a>\n\t"], "copyright__copyright__copyright": ["is works for me and is a good way to test your whole audio chain.\n\nSome notes on ALSA\n\nI've gotten this example working. I'm also looking here.\n\nOn the Beagle you need to:\n\n# opkg install alsa-dev\n\nOn the host:\n\n$ sudo apt-get install libasound2-dev\n\nGo to the class dfs site and get alsaWrite.c. Compile it with\n\n# gcc -lasound alsaWrite.c\n# ./a.out\n\nIt runs on the Beagle nad desktop and produces a sound.\n\nIt's shouldn't be hard to convert alsaWrite.c to alsaRead.c. See the sites above for hints.", "is works for me and is a good way to test your whole audio chain.\n\nSome notes on ALSA\n\nI've gotten this example working. I'm also looking here.\n\nOn the Beagle you need to:\n\n# opkg install alsa-dev\n\nOn the host:\n\n$ sudo apt-get install libasound2-dev\n\nGo to the class dfs site and get alsaWrite.c. Compile it with\n\n# gcc -lasound alsaWrite.c\n# ./a.out\n\nIt runs on the Beagle nad desktop and produces a sound.\n\nIt's shouldn't be hard to convert alsaWrite.c to alsaRead.c. See the sites above for hints.", "is works for me and is a good way to test your whole audio chain.\n\nSome notes on ALSA\n\nI've gotten this example working. I'm also looking here.\n\nOn the Beagle you need to:\n\n# opkg install alsa-dev\n\nOn the host:\n\n$ sudo apt-get install libasound2-dev\n\nGo to the class dfs site and get alsaWrite.c. Compile it with\n\n# gcc -lasound alsaWrite.c\n# ./a.out\n\nIt runs on the Beagle nad desktop and produces a sound.\n\nIt's shouldn't be hard to convert alsaWrite.c to alsaRead.c. See the sites above for hints."]}