I've been wanting to play with audio data for a variety of other projects, so I wanted to share this example project as a foundational building block! The example code and hardware will let you very quickly start recording and transmitting audio to a computer, and can easily be extended to playing audio on other devices, recording and using voice commands, and much much more!
The example app samples the microphone every 125 microseconds (or about 8000 times a second, the low-end for audio), and every 100 milliseconds (about 10 times a second) checks to see if someone wants to receive that audio over the internet.
The example client app connects to the listening TCP port on your Photon, and creates a single channel WAV file (since we only have one microphone) file with samples at 8Khz, and that's it! Try playing your audio file in a player like VLC, or something that can play WAV files, here's my recording: https://soundcloud.com/middleca/8khz-audio-recorded-from-a-particle-photon (warning it's quiet, and soundcloud will play a loud song after :) )
I'm looking forward to all the cool stuff you build using this example as a starting point! :)
Special thanks to Particle and Adafruit, for making such awesome easy products!
edit: I've added a 16kHz streaming example that should be smoother (no clicks / pauses), butter audio quality over 8 kHz.
Comments