Skip to contentSkip to conversation

Question: setting up the hardware for alsa

DISCUSSION David Smoot 5 participants 9 messages Nov 4, 2005 – Nov 7, 2005

lore
Share & tools
lore
#0 lore raw

Greetings, first post to the list and hopefully a simple question:

My company builds Linux based telemetry systems. We are working on an airborne telemetry platform. The customer has expressed a desire to record the pilot voice traffic on the data stream with the other data from the instruments.

We use a stripped down kernel and build pretty much everything by hand. I'm attempting to set up ALSA so I can pull the audio data from the line in.

Here's what I have done so far:
1. Bought the cheapest supported card I could find on the matrix for testing (Sound Blaster Live 24Bit, ca0106 driver)

2. Recompiled my kernel to have sound, ALSA, and the appropriate card driver all built as modules.

3. made scripts to make my device nodes (I'm running the root file system on a ramdisk so I create my nodes each time I boot plus this lets me run a minimal kernel and customize it to my environment)
mknod /dev/mixer c 14 0
mknod /dev/mixer1 c 14 16
mknod /dev/mixer2 c 14 32
mknod /dev/mixer3 c 14 48
mknod /dev/dsp c 14 3
mknod /dev/dsp1 c 14 19
mknod /dev/dsp2 c 14 35
mknod /dev/dsp3 c 14 51
mknod /dev/audio c 14 4
mknod /dev/audio1 c 14 20
mknod /dev/audio2 c 14 36
mknod /dev/audio3 c 14 52
mknod /dev/sndstat c 14 6
mknod /dev/audioctl c 14 7

4. Made another script to load my kernel modules /run/tools/insmod soundcore.ko
/run/tools/insmod snd.ko
/run/tools/insmod snd-timer.ko
/run/tools/insmod snd-page-alloc.ko
/run/tools/insmod snd-pcm.ko
/run/tools/insmod snd-ac97-codec.ko #I inserted this because it is selected by the ca0106 module
/run/tools/insmod snd-ca0106.ko

5. I copied libasound to my libraries folder.

At this point I at least knew libasound was OK because I could execute some simple code that listed libasound data types and parameters.

But I can't open any devices and talk to them. I know I am missing some kind of crucial step in setting up the hw:0,0 device but I can't seem to figure out the next step. I've read tutorials, googled, but I am stuck. If someone would point me to the proper documents I would be grateful.

David

#1 lore raw
Quoted 13 lines · David Smoot

Greetings, first post to the list and hopefully a simple question:

My company builds Linux based telemetry systems. We are working on an airborne telemetry platform. The customer has expressed a desire to record the pilot voice traffic on the data stream with the other data from the instruments.

We use a stripped down kernel and build pretty much everything by hand. I'm attempting to set up ALSA so I can pull the audio data from the line in.

At this point I at least knew libasound was OK because I could execute some simple code that listed libasound data types and parameters.

Quoted 7 lines

But I can't open any devices and talk to them. I know I am missing some kind of crucial step in setting up the hw:0,0 device but I can't seem to figure out the next step. I've read tutorials, googled, but I am stuck. If someone would point me to the proper documents I would be grateful.

David

The ca0106 alsa driver is quite new and as such might not be the most reliable driver to use for avionics systems. Line in/Mic input was only recently added to the driver, so it would be important for you to tell us which alsa version you are using. The following will tell you. cat /proc/asound/version.

Another problem you will have is noise on the input. Special care has to be taken when recording voice in an aircraft.

A good application to use to test voice capture is arecord.
The ca0106 card is very basic, and you should only really use a capture rate of 48000 Hz if you want any sort of quality captured. You can resample it in your application to a lower rate, or compress it using a codec before transmission over the telemetry link. The ca0106 is particulary bad at 44100 Hz, but should be ok at rates 24000, 12000,8000 Hz

You should open the devices directly, but instead use the libasound snd_pcm_open() call.

James

-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42" plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php

#2 lore raw

Sorry, it appears I did not provide enough detail. I am playing with the tutorial from the linuxjournal:
http://www.linuxjournal.com/article/6735

I can compile and run the first listing, it just prints out some variables set up by the soundalib. But the second listing that actually calls "snd_pcm_open"
fails because it cannot open the default device.

So I believe I am failing somewhere to set some variable or parameter that tells ALSA what the default devices is. All I am doing so far is creating the nodes and loading the sound modules. I'm thinking I am missing one more step. Any suggestions?

David

Quoted 52 lines · James Courtier-Dutton
Quoted 4 lines · David Smoot

Greetings, first post to the list and hopefully a simple question:

My company builds Linux based telemetry systems. We are working on an airborne telemetry platform. The customer has expressed a desire to

record

Quoted 4 lines

the pilot voice traffic on the data stream with the other data from the instruments.

We use a stripped down kernel and build pretty much everything by hand.

I'm

Quoted 3 lines

attempting to set up ALSA so I can pull the audio data from the line in.

At this point I at least knew libasound was OK because I could execute

some

Quoted 3 lines

simple code that listed libasound data types and parameters.

But I can't open any devices and talk to them. I know I am missing some

kind

Quoted 1 line

of crucial step in setting up the hw:0,0 device but I can't seem to

figure

Quoted 1 line

out the next step. I've read tutorials, googled, but I am stuck. If

someone

Quoted 4 lines

would point me to the proper documents I would be grateful.

David

The ca0106 alsa driver is quite new and as such might not be the most reliable driver to use for avionics systems. Line in/Mic input was only recently added to the driver, so it would be important for you to tell us which alsa version you are using. The following will tell you. cat /proc/asound/version.

Another problem you will have is noise on the input. Special care has to be taken when recording voice in an aircraft.

A good application to use to test voice capture is arecord. The ca0106 card is very basic, and you should only really use a capture rate of 48000 Hz if you want any sort of quality captured. You can resample it in your application to a lower rate, or compress it using a codec before transmission over the telemetry link. The ca0106 is particulary bad at 44100 Hz, but should be ok at rates 24000, 12000,8000 Hz

You should open the devices directly, but instead use the libasound snd_pcm_open() call.

James

#3 lore raw
Quoted 5 lines · David Smoot

I can compile and run the first listing, it just prints out some variables set up by the soundalib. But the second listing that actually calls "snd_pcm_open"
fails because it cannot open the default device.

You probably need to copy (create) some minimalistic configuration set (such as in alsa-lib/src/conf ) in order to use "default" or "hw" device names.

Sasha.

-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42" plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php

#4 lore raw
Quoted 11 lines · Sasha Khapyorsky
Quoted 5 lines · David Smoot

I can compile and run the first listing, it just prints out some variables set up by the soundalib. But the second listing that actually calls "snd_pcm_open"
fails because it cannot open the default device.

You probably need to copy (create) some minimalistic configuration set (such as in alsa-lib/src/conf ) in order to use "default" or "hw" device names.

Actually you should not have to do this - alsa-lib should open the file /usr/share/alsa/cards/CA0106.conf which defines the default PCM for this card.

Try stracing your app and verify that it's trying to open that file.

Lee

-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42" plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php

#5 lore raw
In reply to David Smoot
Quoted 13 lines · David Smoot

Greetings, first post to the list and hopefully a simple question:

My company builds Linux based telemetry systems. We are working on an airborne telemetry platform. The customer has expressed a desire to record the pilot voice traffic on the data stream with the other data from the instruments.

We use a stripped down kernel and build pretty much everything by hand. I'm attempting to set up ALSA so I can pull the audio data from the line in.

At this point I at least knew libasound was OK because I could execute some simple code that listed libasound data types and parameters.

Quoted 7 lines

But I can't open any devices and talk to them. I know I am missing some kind of crucial step in setting up the hw:0,0 device but I can't seem to figure out the next step. I've read tutorials, googled, but I am stuck. If someone would point me to the proper documents I would be grateful.

David

The ca0106 alsa driver is quite new and as such might not be the most reliable driver to use for avionics systems. Line in/Mic input was only recently added to the driver, so it would be important for you to tell us which alsa version you are using. The following will tell you. cat /proc/asound/version.

Another problem you will have is noise on the input. Special care has to be taken when recording voice in an aircraft.

A good application to use to test voice capture is arecord.
The ca0106 card is very basic, and you should only really use a capture rate of 48000 Hz if you want any sort of quality captured. You can resample it in your application to a lower rate, or compress it using a codec before transmission over the telemetry link. The ca0106 is particulary bad at 44100 Hz, but should be ok at rates 24000, 12000,8000 Hz

You should open the devices directly, but instead use the libasound snd_pcm_open() call.

James

-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42" plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php

#6 lore raw
In reply to David Smoot
Quoted 6 lines · David Smoot

5. I copied libasound to my libraries folder.

At this point I at least knew libasound was OK because I could execute some simple code that listed libasound data types and parameters.

Quoted 6 lines

But I can't open any devices and talk to them. I know I am missing some kind of crucial step in setting up the hw:0,0 device but I can't seem to figure out the next step. I've read tutorials, googled, but I am stuck. If someone would point me to the proper documents I would be grateful.

Ah, this is the problem. It's not sufficient to just copy the libasound binary into your LD_LIBRARY_PATH. Alsa-lib needs these files too:

/usr/share/alsa/alsa.conf
/usr/share/alsa/pcm/*
/usr/share/alsa/cards/*

Why not just run "make install" instead of trying to install alsa-lib by hand?

Lee

-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42" plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php

#7 lore raw

I have to do a hand install... My box that I am wanting to eventually capture data on is a very limited, special purpose device. It does not have gcc or support for building native. Thanks for the tips though, it is good to know what my configuration files are. I'm taking it easier and installing first on one of my full development systems.

David

Quoted 28 lines · Lee Revell
Quoted 6 lines · David Smoot

5. I copied libasound to my libraries folder.

At this point I at least knew libasound was OK because I could execute some simple code that listed libasound data types and parameters.

Quoted 6 lines

But I can't open any devices and talk to them. I know I am missing some kind of crucial step in setting up the hw:0,0 device but I can't seem to figure out the next step. I've read tutorials, googled, but I am stuck. If someone would point me to the proper documents I would be grateful.

Ah, this is the problem. It's not sufficient to just copy the libasound binary into your LD_LIBRARY_PATH. Alsa-lib needs these files too:

/usr/share/alsa/alsa.conf
/usr/share/alsa/pcm/*
/usr/share/alsa/cards/*

Why not just run "make install" instead of trying to install alsa-lib by hand?

Lee

#8 lore raw
In reply to David Smoot
Quoted 3 lines · David Smoot

3. made scripts to make my device nodes
mknod /dev/mixer c 14 0
...

ALSA devices are in /dev/snd/; see the snddevices script in the alsa-driver package.

Quoted 3 lines

4. Made another script to load my kernel modules
/run/tools/insmod soundcore.ko
...

If you use the OSS emulation (/dev/dsp etc.), you have to load the snd-xxx-oss modules.

HTH
Clemens

-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42" plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php