antmicro-labs / voice-assistant

Apache License 2.0
0 stars 1 forks source link

Converting microphone input to data appropriate for TFLite #24

Closed Marzecki closed 4 years ago

Marzecki commented 4 years ago

We need to find a way to convert microphone input to data that will be fed to the TFLite model. Conversion: (singed 24bit PCM, stereo, little endian, 44100 Hz) => (signed 16bit PCM)

kgugala commented 4 years ago

converting singed 24bit PCM -> signed 16bit PCM is fairly easy - simply discard 8 least significant bits in each sample.

What about the rest of the parameters? Do they fit the model requirements?

plonajakub commented 4 years ago

I will check it and let you know.

plonajakub commented 4 years ago

I've done some research and here is what I've found:

linear 16-bit single-channel PCM values, at a 16 kHz rate

so I conclude that the recordings were mono (and so should be our data).

kgugala commented 4 years ago

making mono, from stereo is also fairly easy - simply use mono microphone and discard single channel from recorded data (the ADC you have will always record stereo data, but if you use mono mic, both channels should be identical)

Changing sample rate will require adjusting the clocks we provide to the DAC

szymon-filipiak commented 4 years ago

Although the need for preprocessing has emerged I consider this task as done.