WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: USB Audio Problem (piCore 5.2 final. 24 bit)  (Read 5766 times)

Offline CodenameMAT

  • WikiUser
  • *
  • Posts: 16
USB Audio Problem (piCore 5.2 final. 24 bit)
« on: March 03, 2014, 02:03:54 PM »
Hello all,

I'm new to Tiny Core Linux and over the past week I've managed to put together an audio based piCore build with alsa/mpd/ncmpc (compiling what I needed along the way)
unfortunately, there's a problem when playing 24bit files. There's a constant crackling noise over the top of all tracks that are played in this format. 16bit is fine.

Additionaly, I have no problem playing the same tracks with the same software on other distributions (e.g. PiBang linux) it seems that this problem only occurs with piCore.
In fact, the problem sounds very much like the problems that the Raspberry Pi kernel was suffering from last year (usb sound module?)

Is there anything I can do to fix this? Is it possible to upgrade the USB sound module in any way?

Thanks.

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 6980
    • My Community Forum
Re: USB Audio Problem (piCore 5.2 final. 24 bit)
« Reply #1 on: March 03, 2014, 02:21:21 PM »
We have kernel 3.13.3 which is newer than Raspbian is using (no idea on PiBang). What is the USB sound device are you using? Do you hear the same noise with the RPi's built in (analog or HDMI) sound device? Can you share a test file where you have an issue?
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline CodenameMAT

  • WikiUser
  • *
  • Posts: 16
Re: USB Audio Problem (piCore 5.2 final. 24 bit)
« Reply #2 on: March 03, 2014, 02:40:11 PM »
Hi Béla,

Thanks for the speedy reply! here's the dmesg from piCore just now
Code: [Select]
[    4.905892] usb 1-1.2: new full-speed USB device number 4 using dwc_otg
[    5.149898] usb 1-1.2: New USB device found, idVendor=262a, idProduct=10e1
[    5.149931] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[    5.149946] usb 1-1.2: Product: SA9023 USB Audio
[    5.149960] usb 1-1.2: Manufacturer: HiFimeDIY Audio
[    5.189583] input: HiFimeDIY Audio SA9023 USB Audio as /devices/platform/bcm2708_usb/usb1/1-1/1-1.2/1-1.2:1.0/input/input0
[    5.190148] hid-generic 0003:262A:10E1.0001: input,hidraw0: USB HID v1.00 Device [HiFimeDIY Audio SA9023 USB Audio] on usb-bcm2708_usb-1.2/input0

/proc/asound/card0/stream0
Code: [Select]
tc@box:/proc/asound/card0$ cat stream0
HiFimeDIY Audio SA9023 USB Audio at usb-bcm2708_usb-1.2, full speed : USB Audio

Playback:
  Status: Stop
  Interface 3
    Altset 1
    Format: S16_LE
    Channels: 2
    Endpoint: 3 OUT (ASYNC)
    Rates: 96000, 88200, 48000, 44100, 32000
  Interface 3
    Altset 2
    Format: S24_3LE
    Channels: 2
    Endpoint: 3 OUT (ASYNC)
    Rates: 96000, 88200, 48000, 44100, 32000

Capture:
  Status: Stop
  Interface 2
    Altset 1
    Format: S16_LE
    Channels: 2
    Endpoint: 2 IN (ASYNC)
    Rates: 96000, 88200, 48000, 44100, 32000
  Interface 2
    Altset 2
    Format: S24_3LE
    Channels: 2
    Endpoint: 2 IN (ASYNC)
    Rates: 96000, 88200, 48000, 44100, 32000

If I force 16bit then I have no problems at all. stream0 and hw shows that 16bit is playing and it sounds perfectly clear. When I use 24bit that's when I have problems.
However, as I said, when I use mpd on PiBang (Debian base) 24bit is not a problem. Volumio too (also Debian/Raspbian)

PiBang uname
Code: [Select]
root@PiBang:~# uname -arv
Linux PiBang 3.10.19+ #600 PREEMPT Sat Nov 16 20:34:43 GMT 2013 armv6l GNU/Linux

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 6980
    • My Community Forum
Re: USB Audio Problem (piCore 5.2 final. 24 bit)
« Reply #3 on: March 03, 2014, 03:11:43 PM »
This can be an (Alsa) configuration issue and not necessarily a kernel/module/driver problem. Changing buffer size may help:

http://www.alsa-project.org/main/index.php/Asoundrc

I do not have such device, can't test. Probably a good idea to contact forum member 'sbp' who know much more about piCore audio than me.

« Last Edit: March 03, 2014, 03:16:22 PM by bmarkus »
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline CodenameMAT

  • WikiUser
  • *
  • Posts: 16
Re: USB Audio Problem (piCore 5.2 final. 24 bit)
« Reply #4 on: March 03, 2014, 03:28:21 PM »
I've just tried a quick alsa test and all seems to be find on the alsa side.
Code: [Select]
tc@box:~$ aplay -vv wideband\%20sweep\%20\(w\)\%2096kHz\%2024bit.wav
Playing WAVE 'wideband%20sweep%20(w)%2096kHz%2024bit.wav' : Signed 24 bit Little Endian in 3bytes, Rate 96000 Hz, Stereo
Hardware PCM card 0 'SA9023 USB Audio' device 0 subdevice 0
Its setup is:
  stream       : PLAYBACK
  access       : RW_INTERLEAVED
  format       : S24_3LE
  subformat    : STD
  channels     : 2
  rate         : 96000
  exact rate   : 96000 (96000/1)
  msbits       : 24
  buffer_size  : 48000
  period_size  : 12000
  period_time  : 125000
  tstamp_mode  : NONE
  period_step  : 1
  avail_min    : 12000
  period_event : 0
  start_threshold  : 48000
  stop_threshold   : 48000
  silence_threshold: 0
  silence_size : 0
  boundary     : 1572864000
  appl_ptr     : 0
  hw_ptr       : 0

Playback at 96k and 24Bit is crystal clear. There's a distinct possibility that it could be due to my less-than-average compiling skills. I compiled mpd myself and maybe I missed something.
Béla, would it be too much for me to ask if you could compile mpd and add it to the repo? it's the key component of a project I'm working on and I'd just like to rule out the possibility that it's something piCore related.

http://www.musicpd.org/download/mpd/stable/ source is here. I'd very much appreciate it.

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 6980
    • My Community Forum
Re: USB Audio Problem (piCore 5.2 final. 24 bit)
« Reply #5 on: March 03, 2014, 03:48:02 PM »
Can you try cmus just for testing?
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline CodenameMAT

  • WikiUser
  • *
  • Posts: 16
Re: USB Audio Problem (piCore 5.2 final. 24 bit)
« Reply #6 on: March 03, 2014, 10:28:40 PM »
Cmus works fine but it appears to be locking the format to 16bit. I can't find any configuration setting to select bit depth.

Offline CodenameMAT

  • WikiUser
  • *
  • Posts: 16
Re: USB Audio Problem (piCore 5.2 final. 24 bit)
« Reply #7 on: March 04, 2014, 08:14:59 AM »
I stand corrected, forget the last post. cmus works fine and plays back my 96k 24bit wave file correctly.

cat stream0
Code: [Select]
HiFimeDIY Audio SA9023 USB Audio at usb-bcm2708_usb-1.2, full speed : USB Audio

Playback:
  Status: Running
    Interface = 3
    Altset = 2
    Packet Size = 582
    Momentary freq = 96000 Hz (0x60.0000)
  Interface 3
    Altset 1
    Format: S16_LE
    Channels: 2
    Endpoint: 3 OUT (ASYNC)
    Rates: 96000, 88200, 48000, 44100, 32000
  Interface 3
    Altset 2
    Format: S24_3LE
    Channels: 2
    Endpoint: 3 OUT (ASYNC)
    Rates: 96000, 88200, 48000, 44100, 32000

So, my problem really is mpd and not piCore. Is it possible for you to compile it, Béla?

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 6980
    • My Community Forum
Re: USB Audio Problem (piCore 5.2 final. 24 bit)
« Reply #8 on: March 04, 2014, 09:05:33 AM »
Which version you would like to have?
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 6980
    • My Community Forum
Re: USB Audio Problem (piCore 5.2 final. 24 bit)
« Reply #9 on: March 04, 2014, 09:12:41 AM »
Ah, is it a .wav file? Did you try aplay?
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline CodenameMAT

  • WikiUser
  • *
  • Posts: 16
Re: USB Audio Problem (piCore 5.2 final. 24 bit)
« Reply #10 on: March 04, 2014, 09:52:56 AM »
yep, take a look at reply #4 :)

Offline CodenameMAT

  • WikiUser
  • *
  • Posts: 16
Re: USB Audio Problem (piCore 5.2 final. 24 bit)
« Reply #11 on: March 04, 2014, 09:54:36 AM »
and no particular preference regarding version! thanks!
be aware, there's quite a lot of dependencies. Just out of interest, do you compile directly on the Pi or cross-compile from x86?

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 6980
    • My Community Forum
Re: USB Audio Problem (piCore 5.2 final. 24 bit)
« Reply #12 on: March 04, 2014, 10:00:35 AM »
Just to be sure, are we talking about this http://www.musicpd.org/ ?

Compiling nativeley on Pi
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline CodenameMAT

  • WikiUser
  • *
  • Posts: 16
Re: USB Audio Problem (piCore 5.2 final. 24 bit)
« Reply #13 on: March 04, 2014, 10:06:53 AM »
Yes, Music Player Daemon. Interestingly, there's a new release that addresses audio issues on the Pi http://www.musicpd.org/news/2014/03/new-post/
although, the issues it addresses don't affect me. my problem is constant noise over 24bit files.

As a quick info, I couldn't compile mpd with ffmpeg due to avcodec, avutil and avformat not having pkg-config .pc files in the repo. there are also no 'include' files for mpd to use so I simply disabled ffmpeg support in mpd. Could this affect playback? it's all very strange. Like I said, mpd with 16bit = no problem. mpd with 24bit = problem!

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 6980
    • My Community Forum
Re: USB Audio Problem (piCore 5.2 final. 24 bit)
« Reply #14 on: March 04, 2014, 10:12:56 AM »
ffmpeg just recently updated/reorganized, -dev is not yet in the repo. I will build the latest mpd, lets see the result
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."