this post was submitted on 21 Aug 2023
26 points (96.4% liked)

Bash

722 readers
1 users here now

Talk about the Bash Shell and Bash scripting

founded 4 years ago
MODERATORS
 

So today I sat down to practice guitar and I realized that I left both my metronomes at my sister's room. Obviously I wasn't going to get up to go and fetch one, so I picked up a bash spell tome (man SoX) and with a little bash magic, made a basic metronome.

Here is the actual code:

tempo () 
{ 
play -n -c1 synth 0.001 sine 1000 pad $(awk "BEGIN { print 60/$1 -.001 }") repeat 999999
}
top 2 comments
sorted by: hot top controversial new old
[โ€“] VubDapple 4 points 1 year ago (1 children)

I love that you are printing a sound

[โ€“] wolandark 1 points 1 year ago

I love that about SoX. I also wanted to make the terminal flash on beat with tput flash, but couldn't sync the beat with the flash for the life of me.