Skip to content

Instantly share code, notes, and snippets.

@nicheath
Created March 26, 2024 17:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nicheath/c9db93deba2513a9cc2c17911b9d928d to your computer and use it in GitHub Desktop.
Save nicheath/c9db93deba2513a9cc2c17911b9d928d to your computer and use it in GitHub Desktop.
Morse Code or CW generator using speaker-test in linux [dirty hack]
#!/bin/sh
# speaker-test is not designed for this.. you could make this longer but
# making it shorter just won't work due to silly way I am doing this.
long=0.2
short=0.1
lspace=0.3
wspace=0.5
# letter space
lspace() {
sleep $lspace
}
# word space
wspace() {
sleep $wspace
}
long() {
speaker-test -t sine -f 600 1> /dev/null & sleep $long && kill -9 "$!"
}
short() {
speaker-test -t sine -f 600 1> /dev/null & sleep $short && kill -9 "$!"
}
# TU 5NN 73
long
lspace
short
short
long
wspace
short
short
short
short
short
lspace
long
short
lspace
long
short
wspace
long
long
short
short
short
lspace
short
short
short
long
long
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment