Particle Photon Smart Watch Voice Transcription

Almost gave up on this one. Added electret mic amp to the build. Now this is where it gets complicated. Photon analog reads data from mic then I map it to 8 bit encoding. This is because the photon only has 12 bit analog pins. I wanted to use 16 bit audio to simplify the build but fixing this in arduino c is not straight forward. Photon then opens a TCP server and streams out the data at 100ms intervals. It also publishes an event at the same time which my node.js code is waiting for (currently running on my laptop but will be moving this a rpi zero w very soon). Node receives the event and fires back an event telling the photon it wants to start streaming data down from it and connects to the TCP server. Data is saved to an 8 bit PCM audio file which is then encoded to a 16 bit PCM audio file using ffmpeg (Google Speech API requirement). Node then calls the Google Speech API on GCP to convert the audio file to text. Result is then published back to the photon. Happy 4th to everyone!

Leave a comment