nrf53 - play audio on gateway

Hi,

I would like to modify nrf53 audio dk application in a way that in USB mode gateway will also play music, beside sending it to headset. Is this possible ? How do I start with that ?

Best regards,
Michal

Parents
  • Hello Michal,

    Thank you for your patience with this.

    In the easiest case, if you just would like to output the audio received from USB to the I2S you can look at the code that is responsible for outputing the I2S audio in the headset configuration as a reference, and include this in your gateway application.
    If you intend for this playback to be synchronized with the playback at the headset side this will require a little more work, as you will need to add the synchronization mechanism as well. This will require you to get the SDU reference for the latest package from the controller on the gateway side, and perform the same presentation delay calculations as is happening in the audio_datapath on the headset side.
    Luckily, you will only have to merge in the existing functionality from the headset configuration into your gateway (no need to 'reinvent the wheel' with regards to the syncrhonization), apart from getting a hold of the SDU reference and correctly setting up the syncrhonization based on it.

    I would recommend that you start out by just getting the audio correctly output on the gateway side first, and then add the synchronized playback with the headset side after. Please give this a try, and let me know if you encounter any issues or questions! :) 

    Best regards,
    Karl

  • I was solving other issues before and only came back to this last week. I am stuck now, because I am unsure how loopback sound to i2s ? I mean where and which function needs to be called in the gateway code that will send audio from USB to i2s, assuming all is properly configured (I think I done that part correctly ...)? I would imagine in some USB data handler there is raw audio data that I just need to send to i2s using something like i2s_put().

    I would appreciate any tips, as you seem to know topic very well.

    In the next step I will try synchronize sound as well.

    Best regards,
    Michal

  • Hello again, Michal

    Michal said:
    I was solving other issues before and only came back to this last week.

    No worries, we will continue this whenever you have the chance.

    Michal said:
    I am stuck now, because I am unsure how loopback sound to i2s ? I mean where and which function needs to be called in the gateway code that will send audio from USB to i2s, assuming all is properly configured (I think I done that part correctly ...)? I would imagine in some USB data handler there is raw audio data that I just need to send to i2s using something like i2s_put().

    For this part you will have to reference code both from the gateway and the headset source files.
    On the one hand, you would like to see how the USB is set up in the gateway to receive data and pass it on to the controller, so that you can reroute this data to the I2S instead.
    On the other hand you would like to look at how the I2S is used to output data in the headset side.
    The highest level handling of this is done in the cis_gateway and cis_headset files, but you could also look into the audio_datapath file to see how the data is routed and syncrhonized as well.

    Please let me know if any part of this should be unclear so that I may elaborate on the particular part! :) 

    Best regards,
    Karl

Reply
  • Hello again, Michal

    Michal said:
    I was solving other issues before and only came back to this last week.

    No worries, we will continue this whenever you have the chance.

    Michal said:
    I am stuck now, because I am unsure how loopback sound to i2s ? I mean where and which function needs to be called in the gateway code that will send audio from USB to i2s, assuming all is properly configured (I think I done that part correctly ...)? I would imagine in some USB data handler there is raw audio data that I just need to send to i2s using something like i2s_put().

    For this part you will have to reference code both from the gateway and the headset source files.
    On the one hand, you would like to see how the USB is set up in the gateway to receive data and pass it on to the controller, so that you can reroute this data to the I2S instead.
    On the other hand you would like to look at how the I2S is used to output data in the headset side.
    The highest level handling of this is done in the cis_gateway and cis_headset files, but you could also look into the audio_datapath file to see how the data is routed and syncrhonized as well.

    Please let me know if any part of this should be unclear so that I may elaborate on the particular part! :) 

    Best regards,
    Karl

Children
No Data
Related