nRF5340 Audio DK, Sample- & bitrate

Hi,

I have 3 nRF5340 Audio DK's and want to decrease the sample rate and the bit rate. By now, I have changed the rates in the .config and autoconf.h files (from 48kHz to 24kHz).

When compiling, the values are reset to 48kHz if I change the lines in autoconf.h. When I change the lines in the .config file, the compiler throws an error.

Do you know any solution for changing the rates? The same issue has occurred for the bit rate. 

If not, is there any other way to decrease the different rates, such that the latency decreases?

Thanks,

Asbjorn B.

Parents Reply Children
  • Hi,

    Other sample rates are not supported by NCS v2.1.1 You can see the configuration for AUDIO_SAMPLE_RATE_HZ on lines 33-38 in src/audio/Kconfig. Changing this range will make it possible to choose other sample rates, though I have not tested if the application works after changing in v2.1.1.

    In the main branch of NCS the configuration for AUDIO_SAMPLE_RATE_HZ has been modified to enable a sample frequency choice between 16, 24 and 48kHz. The implementation is here. Note that the link is to the main branch, which is regularly updated.

    There are three ways you can update your application with the modified audio sample configurations:

    1. Switch to the main branch by entering
      git fetch origin
      git checkout origin/main
      west update
      into the command line from <ncs-installation>/nrf.
    2. Checkout a specific commit by specifying the commit hash. To check out the latest commit which updated the nRF5340 Audio application you can replace
      git checkout origin/main
      with
      git checkout 4840dd921f469db47b9cb835fd565b9039b36944
      .
      This commit introduced the support for sampling frequencies other than 48kHz.
    3. If you can't switch branches, replace the implementation for config AUDIO_SAMPLE_RATE_HZ and with the lines 33-60 from the main branch version of src/audio/Kconfig. The code below is copied from there.

    choice AUDIO_SAMPLE_RATE
    	prompt "Audio sample rate"
    	default AUDIO_SAMPLE_RATE_48000_HZ if BT_AUDIO_BROADCAST_RECOMMENDED || BT_AUDIO_UNICAST_RECOMMENDED
    	default AUDIO_SAMPLE_RATE_16000_HZ if BT_AUDIO_BROADCAST_16_2_1 || BT_AUDIO_BROADCAST_16_2_2 || BT_AUDIO_UNICAST_16_2_1
    	default AUDIO_SAMPLE_RATE_24000_HZ if BT_AUDIO_BROADCAST_24_2_1 || BT_AUDIO_BROADCAST_24_2_2 || BT_AUDIO_UNICAST_24_2_1
    	help
    	  This will be selected based on the BAP settings.
    
    config AUDIO_SAMPLE_RATE_16000_HZ
    	bool "16 kHz"
    	depends on AUDIO_SOURCE_I2S
    
    config AUDIO_SAMPLE_RATE_24000_HZ
    	bool "24 kHz"
    	depends on AUDIO_SOURCE_I2S
    
    config AUDIO_SAMPLE_RATE_48000_HZ
    	bool "48 kHz"
    endchoice
    
    config AUDIO_SAMPLE_RATE_HZ
    	int
    	default 16000 if AUDIO_SAMPLE_RATE_16000_HZ
    	default 24000 if AUDIO_SAMPLE_RATE_24000_HZ
    	default 48000 if AUDIO_SAMPLE_RATE_48000_HZ
    	help
    	  I2S supports 16, 24, and 48 kHz sample rates for both input and output.
    	  USB supports only 48 kHz for input.

    Kind Regards,
    Maria

Related