Skip to content

Instantly share code, notes, and snippets.

@gosub
Created July 28, 2015 11:22
Show Gist options
  • Save gosub/753bcb12f22a86a0585d to your computer and use it in GitHub Desktop.
Save gosub/753bcb12f22a86a0585d to your computer and use it in GitHub Desktop.
Shell script to generate with SoX the famous nokia sms tone (SMS in morse)
#!/bin/sh
FILENAME="nokia_sms_tone_morse.wav"
# DOT = short bip, 0.1s
DOT="|sox -n -p synth 0.1 sine 2500 synth 0.1 sine mix 5000 synth 0.1 sine mix 7500"
# DASH = long bip, 0.3s
DASH="|sox -n -p synth 0.3 sine 2500 synth 0.3 sine mix 5000 synth 0.3 sine mix 7500"
# p = short pause, 0.1s (between bips of the same letter)
p="|sox -n -p trim 0 0.1"
# pp = medium pause, 0.3s (between letters)
pp="|sox -n -p trim 0 0.3"
# ppp = long pause, 1s (between words)
ppp="|sox -n -p trim 0 1"
sox --combine concatenate \
"$DOT" "$p" "$DOT" "$p" "$DOT" \
"$pp" \
"$DASH" "$p" "$DASH" \
"$pp" \
"$DOT" "$p" "$DOT" "$p" "$DOT" \
"$ppp" \
"$DOT" "$p" "$DOT" "$p" "$DOT" \
"$pp" \
"$DASH" "$p" "$DASH" \
"$pp" \
"$DOT" "$p" "$DOT" "$p" "$DOT" \
-r 44100 -b 16 $FILENAME vol -15dB
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment