Andy Jarrett // Code. Develop. Create.

Creating Custom Sounds for My Beep Test App

Man running towards mountains

As part of my journey in creating the Free Beep Test App at github.com/andyj/free-beep-test-timer I wanted to make sure all aspects of the project were unique and original, including the sounds used during the test. I didn’t want to rely on pre-made sounds that might have licensing issues or not fit perfectly with what I envisioned for the app. So, I decided to create my own sounds using a bash script on MacOS. Here’s how I did it and why.

Why Custom Sounds?

The beep test relies heavily on audio cues to guide participants through the stages. I wanted these cues to be clear, consistent, and completely free from any copyright issues. By creating my own sounds, I could ensure that they fit the needs of the app perfectly and that I had full ownership of them.

The Bash Script

I used a combination of MacOS's built-in say command and the lame tool to generate and convert the audio files. Here’s the script I wrote:

View this on Github


#!/bin/bash

# Created using MacOS and Lame
# $ brew install lame


# Generate the AIFF file for the countdown message
say -o startingin.aiff "Starting in 5.4.3.2.1"

# Convert the AIFF file to MP3 using lame
lame -m m startingin.aiff startingin.mp3

# Generate the AIFF file for the beep sound
say -v Bells -o beep.aiff "beep"

# Convert the AIFF file to MP3 using lame
lame -m m beep.aiff beep.mp3

# Generate the AIFF file for the finishing message
say -o finished.aiff "The beep test has finished. Well done!"

# Convert the AIFF file to MP3 using lame
lame -m m finished.aiff finished.mp3

rm *.aiff

mv *.mp3 ../src/mp3s/

echo "Audio files created and conversion completed"

Breaking Down the Script

Creating Countdown Audio:
The say command on MacOS can convert text to speech and save it as an audio file. I used this to create a countdown message:

say -o startingin.aiff "Starting in 5.4.3.2.1"

This command generates an AIFF file with the spoken countdown.

Converting AIFF to MP3:
To make the audio files more web-friendly, I converted the AIFF files to MP3 using lame, a high-quality MPEG Audio Layer III (MP3) encoder:

lame -m m startingin.aiff startingin.mp3

Creating the Beep Sound:
For the beep sound, I used a special voice setting in the say command:

say -v Bells -o beep.aiff "beep"

The -v Bells option uses the "Bells" voice, which produces a tone that sounds just like a beep. This was the best choice to create a clear, recognisable beep sound for the test.

Creating the Finishing Message:
I also created an audio file to signal the end of the test:

say -o finished.aiff "The beep test has finished. Well done!"

Cleaning Up:
After converting all the AIFF files to MP3, the script removes the original AIFF files and moves the MP3s to the appropriate directory:


rm *.aiff
mv *.mp3 ../src/mp3s/

Completion Message:
Finally, the script outputs a message indicating the audio files have been created and converted:

echo "Audio files created and conversion completed"

Why I’m Sharing This

Creating these custom sounds was a key part of making the Beep Test App truly my own. By sharing this script, I hope to help others who might be looking to add custom sounds to their projects or just want to learn more about text-to-speech and audio conversion on MacOS.

Feel free to try it out and modify it to suit your needs. Your feedback and suggestions are always welcome!

I’m here, learning and working away. If you liked this content and want to keep me going, consider buying me a coffee. Your support keeps this site running and the coffee brewing! ☕️