[alsa-devel] inserting operations while in rate conversion

Maris maris.rob at vdi.de
Wed Apr 22 20:17:48 CEST 2009

I'm running uClinux with ALSA in an Analog Devices' Blackfin CPU
Actually I'm checking possibilities in doing special things while ALSA is
going to do automatic rate conversion.

Specific description:
ADC is sampled with 32 or 64 ksps rate. The corresponding hardware driver
is specified to operate at one of these rates (which I'll specify later).
The application reads the ADC input stream at the output end of the ALSA
processing as a stream with a rate of 8 ksps. I need some information
about inside details of ALSA's automatic rate conversion (pointers to
appropriate information would be helpful).

What I want to do: insert a digital anti-aliasing filter algorithm which
limits the effective bandwidth of the ADC stream to 4 kHz prior to
actually have the rate converted.
Of course, I could also add the filter algorithm in the hardware device
driver - at the cost of not inherently being available as a hardware
independent algorithm.

Some detail info:
- ADC = AD73311 (speech codec). Basic drivers that allow e.g. arecord &
aplay are available.
- CPU: convergent DSP/microcontroller core @ 500 MHz and fixed point

Thanks for attention. BTW: this is my first dig into ALSA details...


Code snippet:
(currently only one rate is defined as a correspondence to the hardware
driver rate)

#define AD73311_RATES (SNDRV_PCM_RATE_8000  |	\
		      SNDRV_PCM_RATE_16000 |	\
		      SNDRV_PCM_RATE_32000 |	\

struct snd_soc_dai ad73311_dai = {
	.name = "AD73311",
	.playback = {
		.stream_name = "Playback",
		.channels_min = 1,
		.channels_max = 1,
		.rates = SNDRV_PCM_RATE_32000,
		.formats = SNDRV_PCM_FMTBIT_S16_LE, },
	.capture = {
		.stream_name = "Capture",
		.channels_min = 1,
		.channels_max = 1,
		.rates = SNDRV_PCM_RATE_32000,
		.formats = SNDRV_PCM_FMTBIT_S16_LE, },

More information about the Alsa-devel mailing list