External input for microphone record

Hi Kf :smile:

I would like to share how I (almost) finished my project to you and maybe to others attempting a similar project.

The sound data I was receiving from (the ThunderboardSense) had two main problems.

  1. The data was VOX ADPCM encoded
  2. The data sent was in packets of 224 bytes where I was only receiving 20bytes at a time causing me to lose out on 204 bytes every packet. Hence the slow speed.

To overcome problem 2 I sent out data from the thunderboard sense at 20 bytes per packet instead and the number of samples improved.

I had streamed the data into a text file after storing all the values and appending the data to an array for a set time interval. Since the data in the txt file was still an VOX ADPCM encoded message I needed to decode it. (I had used an encoded compressed form to send data because for the set baud rate of the thunderboard sense of 115200 I am unable to send 16kHz samples at 8-bits but VOX ADPCM encoding enables me to do so).

To decode the audio message from the .txt file to a satisfactory level, I did the following:

  1. Used Matlab to format the text file so it has one row and an ‘x’ amount of columns, where ‘x’ represents the number of samples.
  2. Used Matlab to convert the array created from the text file to a WAV file using half the sampling rate of the mic. (Since VOX ADPCM encodes 2 bytes of audio as 1 byte)
  3. Used Audacity to convert the WAV file to an unsigned 8-Bit .RAW Audio file
  4. Used Audacity to convert the .Raw Audio to a WAV file using their inbuilt VOX ADPCM decoder in the software at the original sample rate of the mic.

That was it, I was able to create a mic that operates via Bluetooth low Energy with the ability to record the data. Although the sound quality is not crystal clear, the sound is still audible :slight_smile:

Thank you again Kf, your insight on how to go about this aspect of the project is much appreciated. :smiley:

1 Like