1 Reply Latest reply on Jan 9, 2017 4:09 AM by madhul_36

    USB Audio Streaming for 16kHZ Sampling Example




      I have an use-case of taking continuous audio data from CX3 SPI port (an I2S to SPI gives audio data) . The audio data is stereo,16 bit per sample  with 16kHZ sampling.


      I tried to modify the UAC example. The UAC example uses 96 bytes for ISO packet. This is for 48kHZ sampling rate. Also, audacity has to be run for 48kHZ sampling for this to capture. For playback of this captured data, audacity has to be run with 16kHZ sampling rate. Due to this mismatch, I saw some noise also adds in.


      Following are the questions


      1) Can I get the descriptor C file for 16kHZ sampling for same UAC example?


      2) What shall be the audio isochronous packet size and how many number of bytes shall I go and read for one DMA buffer commit  for the aforementioned sampling frequency?


      3) Can I get another example for real-time audio streaming using CX3?


      4) Or in worst case, please pin point what are the areas I have to modify the same UAC example to make this work?


      5) What is the typical I2S to SPI converter you suggest typically for audio IN for CX3?


      6) Can I connect the SPI DMA directly to USB DMA so that it run infinitely?


      A working example instead of document will be great help.

        • 1. Re: USB Audio Streaming for 16kHZ Sampling Example



          For chaging the sampling frequency to 16 KHz, in the cyuacdscr.c file, do the following change:


           0x80, 0xBB, 0x00,               /* Sampling frequency - 48000 Hz */


          Change this as


           0x80, 0x3E, 0x00,               /* Sampling frequency - 16000 Hz */


          You have just changed the frequency's hex value from 0xBB00 (48000) to 0x3E00 (16000). You need to make this same change in 3 places in the descriptor file. (In superspeed, high speed, full speed descriptor)


          Apart from this you do not have to change anything in the firmware (like packet size or buffers). As the SPI to I2S convertor is out of our scope we do not recommend any particular product. You may use anything of the kind. 


          We recommend you to follow the same firmware flow as in the example firmware, as far as the DMA operation is concerned.




          - Madhu Sudhan