I have a collection of microcontrollers and sensors that I am working through to create small and fun projects. I've seen a few devices that allow a voice to be recorded and then played back at a much higher pitch. I thought I would give this a try.
The ProjectHere's a short demo video of the project:
Here are the components:
The project uses an M5Stack Core2 AWS microcontroller. The Core2 has an integrated touch screen, microphone and speaker.
The project uses an Arduino Sketch which allows some user interaction and controls the microphone and speaker:
The current playback speed is displayed at the top of the screen. This can be slow, normal or fast.
There are a number of buttons at the bottom of the screen to control the project:
- The < (left arrow) button slows down the playback speed.
- The > (right arrow) button speeds up the playback speed.
- The + (plus) button starts a recording.
- The - (minus) button stops a recording. This also plays back the last recording.
A red circle appears when the device is recording:
A green circle is shown when playing a recording:
One of the challenges of this project was resource management. The project can only record or playback - it cannot do both. This means the project has to track if the microphone is being used and prevent playback. Similarly, the project has to track if the speaker is being used and prevent recording.
Recording and playback occur asynchronously - this means the Sketch does not block until recording or playback is complete. Due to this capability, the project will sometimes output the following indicator:
The orange circle informs the user that something else needs to complete before their requested action can take place.
Once the user records their voice, they can slowdown or speed up playback. The Core2 records sound in WAV format, using 16KHz 16-bit mono. Recording always occurs at this setting. The slow setting uses 12KHz to play the voice recording. This slows down the voice and makes it deeper. This is 75% of 16KHz. Initially, the project used 8KHz for the slow voice, but it was difficult to understand the playback. The fast setting uses 32KHz to play the voice recording. This speeds up the voice and make it high pitch.
The project records 1 second of audio which seems to be enough time. The recording time can be changed in the Sketch. Originally, the project used 2 seconds, but this seemed too long.
This was a fun project to work on.
Comments