Jump to content

USB: Distorted Audio via alsa on OrangePi


Ting Zhou

Recommended Posts

Hi All,

 

I have attached an ASUS Xonar Essence One at usb-sunxi-ehci-1, high speed : USB Audio to OrangePi PC.

 

when I use alsa to play sound, the system cannot attain the correct sample rate. After system is booted, the sampling rate is 192000. Now experiment starts

 

Here is the information from /proc/asound/card2/stream0, when nothing is played.


 

Quote

 

ASUS ASUS Xonar Essence One at usb-sunxi-ehci-1, high speed : USB Audio

Playback:
  Status: Stop
  Interface 1
    Altset 1
    Format: S16_LE
    Channels: 2
    Endpoint: 6 OUT (ASYNC)
    Rates: 44100, 48000, 88200, 96000, 176400, 192000
    Data packet interval: 125 us
  Interface 1
    Altset 2
    Format: S32_LE
    Channels: 2
    Endpoint: 6 OUT (ASYNC)
    Rates: 44100, 48000, 88200, 96000, 176400, 192000
    Data packet interval: 125 us


 

 

 

Then I "play" 44100 Hz via alsa, by "cat /dev/urandom | aplay -D hw:2,0 -f S16_LE -c2 -r44100".  Here is the result

 

Quote

Playback:
  Status: Running
    Interface = 1
    Altset = 1
    URBs = 8 [ 8 8 8 8 8 8 8 8 ]
    Packet Size = 104
    Momentary freq = 48000 Hz (0x6.0000)
    Feedback Format = 14.18
  Interface 1
    Altset 1
    Format: S16_LE
    Channels: 2
    Endpoint: 6 OUT (ASYNC)
    Rates: 44100, 48000, 88200, 96000, 176400, 192000
    Data packet interval: 125 us
  Interface 1
    Altset 2
    Format: S32_LE
    Channels: 2
    Endpoint: 6 OUT (ASYNC)
    Rates: 44100, 48000, 88200, 96000, 176400, 192000
    Data packet interval: 125 us

 

It plays at 48000Hz. If I play at 44100 Hz again it will be correct.

 

Quote

Playback:
  Status: Running
    Interface = 1
    Altset = 1
    URBs = 8 [ 8 8 8 8 8 8 8 8 ]
    Packet Size = 104
    Momentary freq = 44109 Hz (0x5.8380)
    Feedback Format = 16.16
  Interface 1
    Altset 1
    Format: S16_LE
    Channels: 2
    Endpoint: 6 OUT (ASYNC)
    Rates: 44100, 48000, 88200, 96000, 176400, 192000
    Data packet interval: 125 us
  Interface 1
    Altset 2
    Format: S32_LE
    Channels: 2
    Endpoint: 6 OUT (ASYNC)
    Rates: 44100, 48000, 88200, 96000, 176400, 192000
    Data packet interval: 125 us

 

If I let it play at 192000Hz after 44100Hz by typing "cat /dev/urandom | aplay -D hw:2,0 -f S16_LE -c2 -r192000", the sampling problem happens again

 

Quote

Playback:
  Status: Running
    Interface = 1
    Altset = 1
    URBs = 8 [ 8 8 8 8 8 8 8 8 ]
    Packet Size = 104
    Momentary freq = 176438 Hz (0x16.0e00)
    Feedback Format = 18.14
  Interface 1
    Altset 1
    Format: S16_LE
    Channels: 2
    Endpoint: 6 OUT (ASYNC)
    Rates: 44100, 48000, 88200, 96000, 176400, 192000
    Data packet interval: 125 us
  Interface 1
    Altset 2
    Format: S32_LE
    Channels: 2
    Endpoint: 6 OUT (ASYNC)
    Rates: 44100, 48000, 88200, 96000, 176400, 192000
    Data packet interval: 125 us

 

There might be a solution here

https://github.com/mopidy/mopidy/issues/613

 

But it is for raspberry Pi. I do not know how to add

dwc_otg.fiq_fix_enable=1 dwc_otg.fiq_split_enable=0

to /boot/cmdline.txt.

 

Many thanks for your help.

Link to comment
Share on other sites

14 minutes ago, Ting Zhou said:

There might be a solution here

https://github.com/mopidy/mopidy/issues/613

 

But it is for raspberry Pi. I do not know how to add

dwc_otg.fiq_fix_enable=1 dwc_otg.fiq_split_enable=0

to /boot/cmdline.txt.

These settings are specific to the Raspberry Pi and don't apply to other board (including Orange Pi)

 

15 minutes ago, Ting Zhou said:

If I let it play at 192000Hz after 44100Hz by typing "cat /dev/urandom | aplay -D hw:2,0 -f S16_LE -c2 -r192000", the sampling problem happens again

According to this discussion it's a kernel problem with some C-Media based sound cards (including your one). For H3 based boards only unsupported nightly images may have new enough kernel, but it also comes with some limitations.

Link to comment
Share on other sites

2 minutes ago, Ting Zhou said:

Thank you for reply. At moment is there any other solutions?

  • If the problem is solved with mainline kernel, then trying to find and backport the fix to the old kernel if it's possible (bisecting unfortunately won't work between legacy and mainline kernels)
  • Using nightly or manually built images with mainline kernel if they are suitable for your use case
  • Using another board instead of Orange Pi PC
  • Using another sound card instead of Essence One
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines