The sound files you have recorded probably need some work. Our microcontroller really works best if we provide it sound files in a standard format that it understands easily, so that it can do other things at the same time in projects.

For our target language, CircuitPython, the format we can use is the WAV (wave) file format. WAV files can come in a variety of types (way too many) so we will be specific to what we want:

  • 16-Bit Pulse Control Modulation (PCM)
  • Sampling speed no greater than 22,050 Hz 

If you have a microcontroller that can process stereo (left/right) sound like the NeoTrellis M4, you can make your files stereo. For other microcontrollers, Adafruit specifies using mono (single channel) only.

Converting Your Clips

Adafruit has a separate guide on using software to convert sound files to the correct WAV format:

Programs like Audacity, used in that guide, can trim files to eliminate all but the desired recording. They can also trim one big file like a script into individual recordings.

Convert your files, ensuring the exact parameters noted above and in the conversion guide. Save the files on your computer with a .wav extension on the filename, such as 1.wav, hello.wav, spooky.wav, one.wav, two.wav, etc.

Next we'll code some CircuitPython to use those sound files.

This guide was first published on Dec 19, 2018. It was last updated on Nov 16, 2018.

This page (Converting Sound Files for Use) was last updated on Nov 16, 2018.

Text editor powered by tinymce.