Topic: External USB sound card help

All,

Playing a wave file through a USB-connected Creative MP3+ sound card yields a noisy screeching tone of about 500 Hz, not music as when I play the same wave file through Chumby's internal codec/speakers.  I've carefully checked everything, and can't figure out what's wrong.

Details below.

I'm working on using a Chumby for an amateur radio controller and data terminal.  In order to accomplish that, I need to use an external sound card, so I can get low-bandwidth audio to and from the (external) amateur radios.

I knew Chumby uses ALSA.  After looking through the list of USB sound cards supported by ALSA, I chose a Creative MP3+, a widely-used card.  I plugged it into my desktop system running Ubuntu Gutsy Gibbon, and the card's light lit up immediately.  aplay -l showed the sound card in the list.  I ran "speaker-test -Dhw:1,0 -c2 -f440 -tsine -r48000" first, and got an 'A' note.  Then, I used "aplay -Dhw1,0 -twav -fdat grace.wav" and was rewarded with Paul Simon.  So the card works file on ALSA on an x86 2.6 kernel.

Then,  I plugged the sound card into USB-A of my Ironforge Chumby with Firmware v1.2, and the light on the card came on immediately.  aplay -l yields:

**** List of PLAYBACK Hardware Devices ****
card 0: default [], device 0: Chumby-TSC2100-PCM [Chumby-TSC2100-PCM]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: MP3 [Sound Blaster MP3+], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
chumby:~#

Looks good so far.  Speaker-test isn't available on the chumby, so I went directly to aplay.  I put a 48-kSa/s wav file on my USB drive, and plugged it into the USB-B port.  Then:

chumby:~#aplay -Dhw:1,0 -twav -vv -f dat /mnt/usb/grace.wav

Instead of the first 5 seconds of Paul Simon's Graceland, I'm blasted with a noisy, screeching tone.  aplay dumped the following before I Ctrl-C'd it:

Playing WAVE '/mnt/usb/grace.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
Hardware PCM card 1 'Sound Blaster MP3+' device 0 subdevice 0

Its setup is:
stream       : PLAYBACK
access       : RW_INTERLEAVED
format       : S16_LE
subformat    : STD
channels     : 2
rate         : 48000
exact rate   : 48000 (48000/1)
msbits       : 16
buffer_size  : 24000
period_size  : 6000
period_time  : 125000
tick_time    : 10000
tstamp_mode  : NONE
period_step  : 1
sleep_min    : 0
avail_min    : 6000
xfer_align   : 6000
start_threshold  : 24000
stop_threshold   : 24000
silence_threshold: 0
silence_size : 0
boundary     : 1572864000
Max peak (12000 samples): 0x0000321d ########             39%
Max peak (12000 samples): 0x000036bc #########            42%
Max peak (12000 samples): 0x00003fd1 ##########           49%
Max peak (12000 samples): 0x00003034 ########             37%

Aborted by signal Interrupt...
chumby:~#

I tried copying the file to the internal /psp filesystem, thinking there was a USB bandwidth overload, but I got the same results.  Anyway, should be plenty of USB bandwidth; 48kHz of stereo 16 bit samples works out to 1.536 Mb/s, and I thought USB1.1 could handle 12 Mb/s.

I also tried booting the Chumby up with the sound card already plugged in.  Same screeching sound.

Any ideas on how I can get the external sound card to play?   Has anyone tried to do this?  What am I missing?  Thanks.

2 (edited by ka9mva 2008-01-23 18:53:40)

Re: External USB sound card help

After several days of hacking at this, still no joy.  I have tried three different external USB sound cards now, and get the same results.  I have tried the Creative MP3+, and two different models of ADS Instant Music.  I have several "cheap" soundcards on order that I believe use the C-Media chipset.  I plan to try these when they arrive.

Some of the things I've tried:

1.  Checking /proc/asound/card1/usbid against the card's USB ID from the Linux source code; it matches.
2.  Trying a sound recorded on Chumby (which plays fine through Chumby's speakers): same screeching noise.
3.  Playing random data which doesn't depend on reading a file from /mnt/usb or from /psp;
dd if=/dev/urandom bs=8000 count=1 | aplay -Dplughw:1,0.  Works on Chumby speakers (hw:0,0), not the external sound card.
4.  Tried changing levels and settings with amixer.  Same results, different volume.
5. Drastic: after thinking the USB ports might not be the same in terms of bandwidth or interrupt latency, I took my wifi riser out and plugged it into an external USB port, and plugged the external sound card into Chumby's on-board USB connector.  Same exact noisy screech.  Put my riser back.  Still haven't put all the batting back in :-(
6.  Tried using a test .wav file that contains a pure sine wave.  Same noisy screech.
7.  Tried powering the sound card with external 5V via a powered hub.  Same.

Any ideas?  I sure would like to hook my ham radios to my Chumby, and I can't do it without an external digital audio interface.

-- Steve

Re: External USB sound card help

We currently don't test against external audio devices, so this isn't a big surprise.  I think bunnie picked one up recently, so I'll ping him about it.

4 (edited by ka9mva 2008-01-28 20:34:24)

Re: External USB sound card help

I've drilled down into the message groups at the ALSA group, and I'm beginning to wonder if the version of ALSA on my Ironforge Chumby (Firmware 1.2) is behind.   The ALSA version is 1.0.11rc2 (Wed Jan 04 08:57:20 2006 UTC).   Several of the USB sound card messages in the ALSA forums mention there being a large change in USB sound at ALSA version 1.0.14.

Being an ALSA newbie, it's going to take a little while to figure out how to compile the new version of ALSA under ARM (I guess similarly to compiling Linux, which I've done successfully), and try the new version.

Thanks,

Steve

Re: External USB sound card help

Update, but not even close to a solution.

Purchased a LogiTech Premium USB Headset 350.  Same result on aplay –Dhw:1,0 /psp/test.wav: the screeching noise.  aplay –l lists what looks like a reasonable response:

chumby:~# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: default [], device 0: Chumby-TSC2100-PCM [Chumby-TSC2100-PCM]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: Headset [Logitech USB Headset], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

So what to do?  After trying four different types, it’s apparent that the trouble is independent of the sound card type.  I think Chumby’s ALSA subsystem must be to blame, or maybe something deeper like the DMA priorities in the USB drivers. 

But it doesn't look like ALSA on the Chumby can be changed without a wholesale replacement of the kernel.  The /lib subdirectory in Chumby is read-only, as is /drivers.  So, except for some other sleight of hand equivalent to insmod, there seems to be no way to upgrade the userland ALSA library.  I'm not versed enough in Linux to know what it is.

Sometimes you have to investigate a platform very thoroughly to realize that you can't do what you're trying to do with it.   Maybe it's not in Chumby's future to be a ham radio controller.  But someone out there knows how to make a USB sound device work on the Chumby.   Please contact me if you do--it's worth something to me.

Thanks,

Steve

Re: External USB sound card help

I've tried a USB headset, and three no-name C-media chip USB sound cards.  All of them output the same nasty buzzing noise.  How do other embedded Linux devices do sound if the ALSA system is as broken as this?

Re: External USB sound card help

I've filed a bug against this, but I don't know if/when/how this will be fixed.  It was not part of our product requirements to support such devices, so it was never tested against.

It *is* possible to run a newer ALSA without creating a new file system - you'd run your executables with a LD_LIBRARY_PATH set to your new shared library, or use ld_linux.so directly to force the path.

If I were to guess, I think you'd find few Linux-based embedded devices that support USB audio output devices.  Most are still using Linux 2.4.

Re: External USB sound card help

Duane,

Thanks so much for what you've done.   In understand it's sort of beyond Chumby's intended use, and therefore no official testing has been done.  However, Chumby's potential lies far beyond its intended use.

I am going to keep at it.  Since all of the sound cards seem to act the same, the next step is to dig down into drivers and the ALSA system.  Thankfully, I have the source code.

You're right about Linux 2.4, and that's one reason I came over to Chumby from another (to remain nameless) i.MX21 platform.

--Steve

Re: External USB sound card help

If you find a solution, please let us know so we can see if we can integrate into future releases.

Re: External USB sound card help

Hmm support for Generic USB class audio could have its uses.... (not sure if the creative quite qualifies)... I have an old Philips boombox that emulates a soundcard, a Griffin iMic adapter (good for line/mic i/o).. and a Platronics USB headset.. Could see the headset being used for comm apps (the proposed sip/calling idea)... If anyone needs to borrow any/all  of the above. let me know..

Heheh chumby voicemail.. ROFL smile
send a voice clip to your fellow chums.. Might be a bit scary wink

Re: External USB sound card help

I tried this on a generic (i.e. low cost) set of USB speakers and had the same problem.

The speakers say SP-5100U and the URL http://www.mypixxo.com/ at the back.

The speakers are described here: http://www.mypixxo.com/product/SP-5100U.html

Any luck figuring out the problem? It'd be nice to not have to delve into the ALSA code :-) and I'm sure other people can think of interesting things to do with USB sound.

Re: External USB sound card help

I vaguely remember something about the sound getting put on the back burner so that they could fix the USB ethernet interface... They could fix one or the other but not currently both.. theres some incompatibility issue and they chose to go with fixing the USB Ethernet for *now*....

Mebby an Alsa upgrade might be the ticket...