Integrating SD Recording with 8-band WDRC


Currently, I am trying to integrate the SD card recording code (taken from this Tympan library example code) with the 8-band WDRC example code to record the input data on SD card on the Rev D. However, after I set the SD card writer to the “Prepared” state and then start the recording, the Tympan hangs up and the red LED is constantly on (which corresponds to none of the SD card states), and the i2s output is just a constant sound. Has anyone tried working on this before? Or, is this due to the Rev D’s CPU constraints?


I believe we have an existing code that combines 8-band WDRC with SD writing. Let me check for you.

In the meantime, you can look at this example which is 8-band WDRC meant for digital mics and demonstrates SD card writing:

1 Like

So, when I decrease the number of bands to 3 from 8 (24,000 Hz sampling rate, 128 audio block size), the SD card writing works, so I guess this is due to the Rev D’s constraints.

The Rev-D is a bit limited in processing power for 8-band FIR (which takes about 80-85% of the CPU). Can you share your code?

To outline the steps of grafting on the SD card writing.

  1. instantiate the audio writer class
  2. virtually connect it into the audio chain
  3. add the setup and servicing code
  4. add some sort of user controls via Serial Monitor or Phone App to start/stop the recording.

Here is the most straightforward example to follow:

Here are some things you could try:

  • Have you verified the original 8-band WDRC code runs on your Tympan Rev-D?
  • In your code, can you comment out the WDRC code and change the patchcords to route audio directly to SD card (bypassing the WDRC?)

Ah, I see you have the 3-band WDRC working with SD writing. I’ll make a note of this limitation for the WDRC 8-band.

1 Like

SD card writing works with 8-band WDRC if we manually decrease the buffer size for the SD writer object to around 60000 (default is 150000), using audioSDWriter.allocateBuffer(60000); in the setup code for the SD writer object.

Nice work finding solutions! Woo-hoo!! :+1: