I don’t like to leave my own questions unanswered, so while I am not sure if anyone else will try to do this, thought I would at least document some of the stuff I stumbled along with in case it helps…
Note: I purchased a cheap USB sound board from Amazon.com that was mentioned in a different thread:
http://www.amazon.com/dp/B002R33VWW/ref=pe_175190_21431760_M3T1_ST1_dp_1
To answer my first question, to install the ALSA stuff, I did:
wget ftp://ftp.alsa-project.org/pub/lib/a...1.0.25.tar.bz2
tar jxf alsa-lib-1.0.25.tar.bz2
cd alsa-lib-1.0.25
./configure
make install
This allowed my testPCM program to build and run. This program generates a buffer to play a note, which in some of my robots, I use for feedback when for example the user presses a button, or maybe power is starting to get low... But no sound yet. The system was defaulting to still try to output over the HDMI sound. I used the aplay command to see what devices and the like where installed:
root@beaglebone ~ # aplay -L
null
Discard all samples (playback) or generate zero samples (capture)
default:CARD=Black
TI BeagleBone Black,
Default Audio Device
sysdefault:CARD=Black
TI BeagleBone Black,
Default Audio Device
default:CARD=Device
Generic USB Audio Device, USB Audio
Default Audio Device
sysdefault:CARD=Device
Generic USB Audio Device, USB Audio
Default Audio Device
front:CARD=Device,DEV=0
Generic USB Audio Device, USB Audio
Front speakers
surround40:CARD=Device,DEV=0
Generic USB Audio Device, USB Audio
4.0 Surround output to Front and Rear speakers
surround41:CARD=Device,DEV=0
Generic USB Audio Device, USB Audio
4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=Device,DEV=0
Generic USB Audio Device, USB Audio
5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=Device,DEV=0
Generic USB Audio Device, USB Audio
5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=Device,DEV=0
Generic USB Audio Device, USB Audio
7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=Device,DEV=0
Generic USB Audio Device, USB Audio
IEC958 (S/PDIF) Digital Audio Output
I finally figured out how to set the default pcm device which made my test program work:
I needed to create a file /etc/asound.conf
pcm.!default sysdefault:Device
With this my test program is generating notes. However it is taking a lot longer (factor of maybe 4) to output the buffer to the device as compared to RPI with built-in device. In particular a call to: frames = snd_pcm_writei(g_PCMhandle, pb, cb);
Could be differences in device versus USB and/or how long it takes to recover from stream underflow… Will investigate later.
The next thing I wanted to work was Espeak, which I simply installed the appropriate packages on RPI, but non listed on BBBk.
So I found it up on SourceForge.net and downloaded: espeak-1.47.11-source.zip from there which I then downloaded the source directory to the BBBk. Tried to build, found it relies on portaudio, which I found up on portaudio.com and downloaded pa_stable_v19_20111121.tgz and used tar to extract. Looked at some readme files and built using
./configure
make clean
make
make install
After this built, was able to build espeak, but first attempt did not work, needed to setup to use the right version of portaudio.h as I guess it changed between version 18 and 19 of that library. Once I built it, tried running their test apps: speak and espeak. These failed to load portaudio shared library, as this was installed in the directory:
/usr/local/lib
Not sure the best way to fix this, but I did it by adding some stuff to the file: /etc/profile.
I added the line: LD_LIBRARY_PATH=/usr/local/lib
I also added the name: LD_LIBRARY_PATH to the exports line.
It now speaks!
Hope this helps.
Kurt