network shenanigans or just smoke and mirrors

Gumstix basix Audio

January 13th, 2009 by geezer

The following are instructions on how I was able to get audio working on the Gumstix basix mobo with a 400MHz PXA255 and Bluetooth. It runs the most recent version of Gumstix OpenEmbedded.

A few assumptions about your skills:

  1. You can log into the Gumstix (either SSH or console)
  2. You can gain access to the Internet from the Gumstix (either via Bluetooth or bridging usb0 to eth0)
  3. You have a sound source (mic) and speakers or headphones

Log into your Gumstix. We need a tool that will allow us to record and play audio. Assuming you have that Internet connection, then from the Gumstix command line:

ipkg install alsa-utils-aplay

Next we need to configure the ALSA mixer for sound. From the command line:

alsamixer

An ncurses GUI pops up. Configure as follows:

  1. Press the TAB key until [ALL] is highlighted at the top left in the row labeled “View:”
  2. Use the up arrow to increase the Master Volume to a desired level (I set it at 76)
  3. Press the “M” key (mute) to unmute the Master Volume
  4. Use the right arrow to highlight “Capture”
  5. Use the up arrow to set the capture volume (I use 73)
  6. Press ESC to exit the ALSA mixer

Let’s save these mixer settings so we don’t have to configure the ALSA mixer every time the Gumstix boots:

alsactl store

Now issue the following commands to list your CAPTURE and PLAYBACK devices:

arecord -l
aplay -l

You should get some output along the lines of:

**** List of CAPTURE Hardware Devices ****
card 0: Gumstix [Gumstix], device 0: UCB1400 AC97 HiFi-AC97-0 []
Subdevice: 1/1
Subdevice #0: subdevice #0

And almost the same output with aplay, but CAPTURE is replaced with PLAYBACK.

Now let’s record something. You will have many choices and control over the quality of your recording. However, for our test we will record with some standard settings. Run the following on the command line:

arecord -d 5 -f cd test.wav

This says, “record for a duration of five seconds in CD quality (44100 HZ & stereo) then save it to test.wav”. NOTE: Failure to save this simple test to an external storage medium will fill up your root file system!

To hear what you recorded, simply type:

aplay test.wav

Congratulations! I hope you were successful in getting your audio recorded and played back.

The sample file above weighs in (for me) at 861.4k. If size is a concern, you can drop the stereo to mono and reduce the bit rate. Here’s one last example to illustrate the space savings at the expense of perfect stereo sound:

arecord -c 1 -d 5 -f S16_LE test.wav

This says, “record only one channel for five seconds in a signed 16-bit little endian format then save it to test.wav”. The result will be an audio file recorded in mono at 8000 HZ. Now my file only weights in at 78.2k vs. 861.4k. Wow! However, you will surely notice a difference in quality.

Now go do good things!

Posted in Embedded | No Comments »

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.