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.

  • Hello Asbjorn B.

    .config and autoconf.h are generated when building the application and changes made in them will not be saved across builds.

    To change the configurations, you need to add the CONFIGs you need into prj.conf if building with the default configuration file, or the .conf-file you are building with if you are specifying the configuration file you are using.

    Sample rates other than 48kHz are only supported when I2S is the audio source. You need to change the audio source to be I2S to be able to change the sample rate. To do this, include the line CONFIG_AUDIO_SOURCE_I2S=y in your configuration file.

    CONFIG_LC3_BITRATE=<value between max and min bitrate> should also be included in your configuration file to be included in the build.

    Kind Regards,
    Maria

  • Hi, and thanks for answering. 

    It seems like the files in the autoconf.h does not change, even though we have the new functions in the prj.conf. Where are all the parameters in the autoconf.h coming from (i.e. 48kHz, 16 bitdepth etc.)? Is there any other way to make changes, or some other CONFIGs that should be included in prj?

  • Hi,

    Asbjorn Bjorkkjar said:
    Hi, and thanks for answering. 

    Happy to help!

    Which version of nRF Connect SDK are you using? The nRF5340 Audio application changes from release to release, so my answer will depend on the version of NCS.

    What is going to be the same for all releases is that you need to build the application again for the new configs to be active.

    Kind Regards,
    Maria

  • 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