[alsa-devel] Too fast playback everywhere, except audacity

Giedrius Trainavičius giedrius.trainavicius at gmail.com
Tue Apr 12 00:10:41 CEST 2016


Hello,

I am developing a driver for a DAC on raspberry pi 3 by mostly making use
of existing PCM5102A, and bcm2708 I2S driver code.

What I've done is just configuring the cpu dai link, and for the sampling
rate changes, I am setting some gpios which configures the clock of an ADC
(PCM1804) which is a master. The main CPU and the DAC are slaves to the ADC
and I have a 24.576MHz oscillator.

The sampling rates I want to support are 48000, 96000 and 192000. I am able
to react just fine to the requested rate in hw_params callback. Trying out
the different rates in audacity works just fine.

However, if I try to playback any wav files using mplayer or aplay or
youtube, all of their playback requests for 48000, but they get played way
too fast.

Also if I request mplayer to use alsa output, it gets a buffer underrun and
gets stuck. If I set audacity to use some other output device than alsa
directly, it plays corrupted audio and hangs on stopping playback.

How does audacity manage to play the audio at the correct speed? Is it
doing software resampling to the 'project rate'?

I've tried getting resampling to work using 'plug', but completely
unsuccessfully - I can't get any sound out of it, it says it failed setting
the requested parameters.

Any pointers to what I should be investigating? I am new to the linux
kernel module development, as well as sound drivers.

Thank you in advance,
Giedrius.


More information about the Alsa-devel mailing list