Discussion:
[Alsa-user] Dmix plugin on raspberry pi & WM8731 DAC
Jakob Hansen
2014-05-13 21:22:32 UTC
Permalink
Hello,

I am running raspbian with alsalib version 1.0.25 and driver version
k3.8.10+. The kernel is compiled according to the instructions here:
http://blog.koalo.de/2013/05/i2s-support-for-raspberry-pi.html. Since the
wm8731 does not support hardware mixing, I am using the dmix plugin, but I
have a few questions - thanks in advance for any help!

First, I have noticed a distinct degradation in audio quality when using
the Master Playback volume control in amixer. Is this an artifact of
truncation being done in the hardware, and is it possible to use dmix or
any other means to increase the bit depth before the signal reaches the
dac? Please excuse any misuse of terminology, this is all pretty new to me.

Second, sometimes setting certain parameters in asound.conf can yield
unexpected results, for example in the following pcm declaration taken
almost directly from the alsa documentation (this is just one block, not
the entire file. )

pcm.dmixer {
type dmix
ipc_key 1024
slave {
pcm "hw:1,0"
format S16_LE
period_time 0
period_size 1024
buffer_size 8192
rate 44100
}

The rate is declared to be 44100, but when I issue 'cat
/proc/asound/card1/pcm0p/sub0/hw_params', the rate appears to be 48k. This
is after reloading the config file, just for the record. The odd thing is
that no matter what the input file format is, it plays back at the correct
speed (or pitch level) whether the rate is declared to be 44.1k or 48k.
But, if I declare the rate to be 96k, then hw_params shows 96k and the file
plays back at double speed, which I suppose makes some kind of sense. Can
anyone shed some light on this behavior? Similarly changing the format
declaration apparently has no effect whatsoever. Is there some other
alsa-specific means of doing rate/format conversions, and is that the key
to retaining the sound qualtiy with digital volume attenuation?

Thanks very much for reading.

Jakob
Clemens Ladisch
2014-05-14 08:08:14 UTC
Permalink
I have noticed a distinct degradation in audio quality when using the
Master Playback volume control in amixer. Is this an artifact of
truncation being done in the hardware
Maybe; this happens if you attenuate 16-bit samples too much.
Is that mixer control implemented in hardware, or emulated?
and is it possible to use dmix or any other means to increase the bit
depth before the signal reaches the dac?
dmix must use a sample format that is supported by the hardware.
sometimes setting certain parameters in asound.conf can yield
unexpected results, for example in the following pcm declaration taken
Post by Jakob Hansen
almost directly from the alsa documentation (this is just one block,
not the entire file. )
pcm.dmixer {
type dmix
ipc_key 1024
slave {
pcm "hw:1,0"
format S16_LE
period_time 0
period_size 1024
buffer_size 8192
rate 44100
}
The rate is declared to be 44100, but when I issue
'cat /proc/asound/card1/pcm0p/sub0/hw_params', the rate appears to
be 48k.
Apparently, your hardware does not support 44.1 kHz.
Why are you trying to force it to use that rate?
The odd thing is that no matter what the input file format is, it
plays back at the correct speed (or pitch level) whether the rate is
declared to be 44.1k or 48k. But, if I declare the rate to be 96k,
then hw_params shows 96k and the file plays back at double speed,
which I suppose makes some kind of sense.
Do you have some "plug" plugin on top of the dmix plugin? Or are you
using a player program that can do its own resampling? If you have
neither, it's possible that your player just dumps 48 kHz samples into
the device.
changing the format declaration apparently has no effect whatsoever.
What formats does your hardware support?


Regards,
Clemens
Clemens Ladisch
2014-05-15 06:42:38 UTC
Permalink
"Digital audio input word lengths from 16-32 bits and sampling rates
from 8kHz to 96kHz are supported. "
But,
Card 1, ID `sndrpiproto', name `snd_rpi_proto'
Device 0, ID `WM8731 HiFi wm8731-hifi-0', name `', 1 subdevices (1 available)
2 channels, sampling rate 8000..96000 Hz
Sample formats: S16_LE
So does "input word lengths" in Wolfson's description correspond to
"sample formats" in the alsacap output, and if so, why might there be
a discrepancy?
Apparently, the Pi's DMA controller supports only 16-bit samples.


Regards,
Clemens

Loading...