Port-arm archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: USB audio on rasberry pi 2
netbsd-lists%protonmail.com@localhost (satch) writes:
>On Saturday, 14 December 2024 at 23:22, mlelstv%serpens.de@localhost <mlelstv@serpens=
>.de> wrote:
>> I see similar problems, but only when trying to play with 48kHz.
>> The command:
>>=20
>> audiocfg set 0 p slinear_le 16 2 44100
>>=20
>> switches the output to 44.1kHz and then it plays without distortion.
>Thank you. That solves the problem.
>(And I see this is covered in the audiocfg manpage.)
I had some deeper look into the problem.
The "noise" you hear actually comes from the error messages, the console
output is too expensive and slows down the audio driver so that it cannot
produce a continous sound. A serial console (or some other form of
redirection) can be lightweight enough to keep the sound playing.
However, the root cause, that produces the error messages, still exists.
It comes from the USB host driver (dwc2).
An 48kHz audio stream (2 chan, 16bit) produces 10ms audio chunks of
1920 Bytes. Each USB frame (1ms) therefore needs to transfer 192 bytes.
The dwc2 driver splits each transfer into two parts of 188 bytes and
4 bytes, but the driver is buggy and counts only the second part.
So from 1920 Bytes the driver reports only 40, and such a "short transfer"
is seen as an error. In reality however, all 1920 Bytes are sent, that's
why it still sounds ok unless the error messages slow down the audio
driver too much.
At 44.1kHz it's only 176 Bytes per USB frame, there is no split after
188 required, and the bug regarding that split doesn't appear.
Home |
Main Index |
Thread Index |
Old Index