How can i receive stereo audio signal on the nrf5340 audio DK configured for headset

Although I know that the nrf5340 audio dk only has a mono codec(CS47l63), I still want to try whether the headset can receive and process stereo signals in the same time, as I must evaluate this feature in our project. Both in BIS mode and CIS mode.

I have tried everything i can do, but i am just a beginner. In CIS mode, I can see the gateway only sends one channel signals to the corresponding headset. But in the BIS mode,the gateway broadcast the stereo audio signal, and the headset only recive the corresponding one channel signal, So i think it will be easier for me to implement this feature in the BIS mode. But i still can not find the way, i can modify the value of active_stream_index in the appropriate location to change whether the headset receives audio signals from the left or right channels, but I am still unable to receive stereo signals and process them in the same time.

If this function can be implemented, I can verify it by checking the I2S output signals on the nrf5340 audio dk through an oscilloscope.

So I would like to ask for advice on how to implement this function. I hope someone can help me, thanks.

  • Hello,

    For a CIS stereo headset, please take a look at this brief sample that illustrates the necessary changes to achieve this.
    There is also another such sample you could take a look at for the BIS stereo headset, though this is last tested on a much older NCS version and so it might require more work to get up and running with the newest NCS release.

    Please keep in mind that these samples are just quick tests thrown together by one of our engineers, so it is not samples that we officially support or will keep up to date - but they can serve as a useful reference to see how specific configurations and changes can be made, at least :) 

    Please do not hesitate to ask if any parts of this should be unclear, or if you should have any follow-up questions! 

    Best regards,
    Karl

  • Hello, Karl.

    Thank you very much for your help. I have tried the CIS version of the code and it works very well. I have learned a lot of skills from this example.

    I also implemented the function by myself in CIS mode. I found that the gateway sends the whole signal containing the left and right channels to the headset, while in the default configuration, only the first half of the data (left) or the second half of the data (right) is sent to the corresponding headset. After receiving the signal stream, the headset processes the data in stereo mode(sw_codec_cfg.decoder.num_ch = SW_CODEC_STEREO;), decodes the left and right channels signals separately, and then combines the mono PCM data into a stereo PCM data and output to the codec, What makes me curious is that this codec only supports single channel but seems to be able to receive stereo i2s data, and can output the signal to the headphones when I test left or right inputs separately. I will check the data manual of CS47L63 to verify it.

    I am not sure if my understanding above is correct. If there are any errors, please point them out. Thank you.

    Next, I will test the BIS code, but I think it may take some time as you mentioned. But I can't wait to confirm your reply as the answer, so if I encounter any problems while debugging BIS code in the future, I will continue to ask you questions under this ticket. I hope you can continue to help me if you have time. Thank you.

  • Hello,

    Sorry for the terribly late reply - the ticket had got the 'verified answer' status internally, so I was not notified about your comment unfortunately.

    huma said:
    Thank you very much for your help. I have tried the CIS version of the code and it works very well. I have learned a lot of skills from this example.

    No problem at all, I am happy to help and glad to read that the example was useful! :) 

    huma said:
    What makes me curious is that this codec only supports single channel but seems to be able to receive stereo i2s data, and can output the signal to the headphones when I test left or right inputs separately. I will check the data manual of CS47L63 to verify it.

    Part of the confusion here could be with the fact that there are two things referred to as 'the codec' in the application - the hardware codec (CS47L63) and the software codec (LC3).
    You are also correct that both of these are mono codecs - they can only process one channel at the time - and while the LC3 codec is still able to process stereo data (by processing the mono in sequence), but CS47L63 can only input and output mono.
    For this reason you are not able to input stereo data through the LINE_IN input, but you can do so through the USB option.
    If you need to input stereo data as I2S you will need to use an external stereo hardware codec, in which case you can include it in your project using the following steps:



    huma said:
    Next, I will test the BIS code, but I think it may take some time as you mentioned. But I can't wait to confirm your reply as the answer, so if I encounter any problems while debugging BIS code in the future, I will continue to ask you questions under this ticket. I hope you can continue to help me if you have time. Thank you.

    Regarding stereo BIS's - I was in the beginning of the week made aware that there is an issue with the BIS headsets when receiving stereo through BIS, so I am not sure if this will work right off the bat unfortunately.

    Please do not hesitate to ask if any parts of this should be unclear! :) 

    Best regards,
    Karl

  • Hello, Karl.

    Thank you for your reply.

    Now I am currently facing some difficulties that I cannot solve, and I hope you can help me.

    My requirement is to enable stereo signals to be input from one headset (possibly mic or I2S), transmitted to the gateway, and then relay them to another headset through the gateway.

    If my gateway only connects to one headset(just like the example), it can transmit stereo signals. I think the problem is that when I try to connect to the second headset, the code will automatically allocate relevant resources, and the required resources will be doubled. So i had to reduce the sampling rate to 24K to reduce the sdu size. But that's not what I wanted. You can check my code from github.com/.../cis_stereo_headset_v240 , the cis_stereo_headset_v240 branch. I just made some change to make the gateway can connect two headset and transmit the stereo signal to the two headset(sampling rate is 24K).

    But according to my needs, the second headset does not need to receive audio signals from the gateway, but instead transmits the audio signals it receives to the gateway and gateway can relay them to the first headset. Therefore, I am trying to find and modify this part of the code to see if it can save resources and use a 48K sampling rate.If you have any suggestions, please also provide them. Thank you.

    and should i post a new ticket so that you can quickly see the problem? how can i invite you to reply my question?and there is another ticket i had posted, If it's convenient, you can answer me below that post.

    when i receive stereo audio signal on the nrf5340 audio DK, it has many limitations - Nordic Q&A - Nordic DevZone - Nordic DevZone (nordicsemi.com)

Related