Page 1 of 1

Audio output with Linux

PostPosted: Thu Apr 25, 2013 10:53 pm
by hansvi
Hello,

I have continued testing, and I'm having problems getting the speaker output to work with linux. I measured using a scope, and this is what I found:

  • If I use windows, I see a data stream on pin 12 of the PCM3060 (and I hear the audio).
  • If I use linux, there is no data stream on pin 12 of the PCM3060
  • In the sound settings, the Peaberry is selected as the audio device (if I switch to the internal sound card, I hear the audio),
  • The volume of the Peaberry sound card is turned on, and according to the indicator below the volume controls, sound is being sent.
  • The input works under linux, I can recieve radio without any issues.

Did anyone manage to get the speaker output working with linux? Am I overlooking anything? I'm using Debian Wheezy.

Thanks,
Hans.

Re: Audio output with Linux

PostPosted: Sat Apr 27, 2013 4:19 pm
by hansvi
I Finally managed to get the speaker output working with linux!

First, I think that the sound card of the peaberry only accepts the format S24_3LE (24 bit signed, packed in three bytes, little endian). Is this correct?

I discovered that this is not the most loved format under linux. E.g. the utility speaker-test doesn't support it, and neither does gnuradio (at least not the version supplied with debian, I still need to check the latest version).

I recorded a sample with
Code: Select all
arecord -Dplughw:0 -fS24_3LE -r48000 -c2 /tmp/test.wav
Recording WAVE '/tmp/test.wav' : Signed 24 bit Little Endian in 3bytes, Rate 48000 Hz, Stereo

I tried a lot of devices but this was the only one that 'worked'. Well, it generated the file but it didn't use the microphone.

I then entered
Code: Select all
aplay -Dhw:1,1 /tmp/test.wav
Playing WAVE '/tmp/test.wav' : Signed 24 bit Little Endian in 3bytes, Rate 48000 Hz, Stereo

I got static noise on the speakers. When it was done playing, the noise disappeared again.

I'm still a bit confused by the sound system. If I'm correct, the sound card has two devices and seven interfaces. But I have no clue what those map to.. Also, what's the difference between a device and an interface?

So now I could either write an ALSA config file that converts the audio format (I found some pages describing that, search e.g. for S24_3LE alsa), or I could check the software to add 24 bit support. I'll probably end up doing both...

Re: Audio output with Linux

PostPosted: Sat Apr 27, 2013 5:26 pm
by AE9RB
Both the radio and audio devices on the Peaberry were programmed to the Universal Serial Bus Device Class Definition for Audio Devices 1.0. I used signed integers with whatever endian was in the spec.

Re: Audio output with Linux

PostPosted: Sat Apr 27, 2013 7:12 pm
by hansvi
Ok, but the sound card has two devices?

Code: Select all
root@seven:~# aplay -l
[snip]
card 1: SDR [Peaberry SDR], device 0: USB Audio [USB Audio]
  Subdevices: 0/1
  Subdevice #0: subdevice #0
card 1: SDR [Peaberry SDR], device 1: USB Audio [USB Audio #1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
[/snip]

In the meantime, I found that if the software doesn't support the S24_3LE format, you can use plughw:1,1 as the output. (if the Peaberry is your second sound card). 'plug' is an ALSA plugin that converts channels, rate and format on request.