Post Go back to editing

ALSA Driver and ADAU1761 Sample Rate

Category: Software
Product Number: ADAU1761
Software Version: Kuiper Linux

Is it possible to set the sample rate in ADAU1761 via the ALSA driver supplied with Kuiper Linux?  I don't see a control for it when running amixer controls.  If it cannot be controlled via the driver, is it best to just set this via an I2C write?  I want to use 44.1kHz rather than the default 48kHz

Regards

Andy

  • Hi,

    In ALSA we have custom controls (the ones printed by amixer) and standard controls implemented by the ALSA framework.

    Sample Rate (FS) is a standard control implemented by ALSA and implemented by the ADAU1761 linux driver too. It is implemented here in the driver: linux/adau17x1.c at master · analogdevicesinc/linux · GitHub
    FS, digital audio interface formats (I2S, TDM, Justified), Channels number, DAI clocks direction are all controlled through the standard ALSA controls.

    All these DAI parameters are negotiated based on the requested stream parameters and the capabilities of the codec and host DAI capabilities.

    There are parameters which can be forced through devicetree so please check linux/simple-card.yaml at master · analogdevicesinc/linux · GitHub

    Also, take care that in Linux some resampling can happen and, in that case, the sampling rate the codec and DAI is using is different from the sample rate of user-space stream.

    But coming back to your use case you can for example start a playback stream with the speaker-test tool.

    speaker-test -Dhw:ADAU1761,0 -r44100 -c2 -FS32_LE

    This will start a stream of white noise on 2 channels, 44100kHz sampling rate, sample format is signed, 32 bits little endian.

  • Thanks, I was able to get this to work by referencing the sound card number (1 in my case).  I'm not able to find a name that works with the -D option, but this doesn't seem to much different than the sound card reference anyway.

  • Specifying the card using -c parameter is perfectly fine. In the end you should get the same result.

    In order to get the devices list for -D you can query the list with 

    aplay -L