alsa/asoundlib.h...

Hopefully this is a simple one to answer. My search showed one place where this file was mentioned, but not how they got the file…

I have a USB sound card coming today that I would like to experiment using. On the Raspberry Pi, I use there headphone jack with a simple powered speakers (used with Iphones and the like) and I have both ALSA sound enabled, which allows me to produce my own beeps. In addition I have espeak also used to do things like say the name of the walking gait. Would like to get this working on BBBk.

First up ALSA. On the Raspberry Pi, I get the necessary include files and the like by issuing the command:
sudo apt-get libasound2-dev
Also another person said they needed:
sudo apt-get libsound2

So far I have not found the right: package to download using opkg.
I have tried things like: opkg install alsa-lib-dev

I have done a complete search on the BBBk and have not found this file. I have found:
/usr/include/sound/asound.h

I probably need to check to see if by chance this is the same file.

My guess getting espeak may be a little more difficult as I do not see any packages the include that as part of their name.
On RPI, I do:
sudo apt-get install espeak
sudo apt-get install libespeak-dev

Thanks in advance for any suggestions.

Kurt

Quick update:
When I try commands like:
opkg install alsa-lib-dev
It responds that
Package alsa-lib-dev (1.0.25-r2.6) installed in root is up to date.
Don’t see anything. Looking at different packages, if I do something like:
wget ftp://ftp.alsa-project.org/pub/lib/alsa-lib-1.0.25.tar.bz2
(Not sure about numbering here…) I do get a file downloaded.
tar jxf alsa-lib-1.0.25.tar.bz2
To extract it:
The created folders include the header file I am looking for.

But not sure if I now need to do an instal…
Kurt

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

Hello,

Just to say thanks for posting the solution to this. I’m playing around with an old Intel Edison, trying to get a Node.js app to play sound and had exactly this problem. One of my Node dependencies wasn’t building due to missing alsa-dev package, which wasn’t available in the package manager. I followed your instructions and am now playing sound.

Thanks again!

Take care,
Daniel