After 3 weeks of trying to setup Kubernetes + Nextcloud + static website in Minikube I decided to take a little break and focus on some Bash.
The project I decided to make is as simple text to Morse   script.
Morse Beep Bash
The code is pretty easy to follow. First, I make reqular expression substitution for every letter of alphabet and numbers from 0 to 9.
I also need some specyfic characters to escape spaces, in this case it’s character s. For every regular expression I
need to end each Morse code character with some delimiter. I picked = so later I can pause signal generation when condition is true.
After that my enhanced Morse code is piped to fold to end every character with new line and then again piped to xargs which
invokes ffplay  that plays sine sound for specyfic period of time or use sleep when break is needed.
I recorded simple sos sos sos Morse code by using this script.
And recorded it to .wav file with arecord -vv -fdat morse.wav.
As you can see it’s really easy to make yourself simple more code translator which will make
sounds from your speaker.
Morse code audio sample data extraction
In the very end of evening I decided to also play around a bit with .dat file which can be
produced from .wav.
I really wanted to see the interval in which my Morse code plays "beep" sound and for that
first I used sox  program to extract data from .wav;
First I started with some GNU Octave  code that is plotting amplitude of Morse code signal.
This was really easy and as you can see clearly SOS SOS SOS was generated properly.
Second one is a bit more interesting as it shows spectrogram of sound.
I love the end result of it. I generated sine wave with frequency of 1000Hz and on this
diagram you can clearly see SOS generated with 1kHz.
This was a small cool project that made just to refresh a bit from dust from kubernetes cave.
As always I highly recommend to play around with Bash. It’s such a flexible scripting language. I love
to use it whenever I have an oportunity.
In 2 weeks I’m going back to Polish remote university mode but at least now everyday I wake up in the Netherlands.