Going faster slowly

For a while I’ve been using Amazing Slow Downer on the phone and PlayItSlowly on Linux for transcribing fast passages and to practice playing along with a tempo that I can manage. However, I frequently would like to just repetitively play a section a boatload of times while gradually increasing the BPM — without taking my hands off the fretboard to adjust a slider. So I wrote a thing.

# play a segment of a song over and over, gradually
# increasing the tempo

step=$(echo "scale=4; ($end_speed - $start_speed)/$attempts"| bc -l)

for t in $(seq $start_speed $step $end_speed); do
    echo "*** $t ***"
    mpv --no-video --start=$start --end=$end $file --o=/dev/stdout --of=ogg 2>/dev/null |
        gst-launch-1.0 fdsrc fd=0 ! decodebin ! pitch tempo="$t" ! autoaudiosink >/dev/null 2>&1

Run it like so:

# between seconds 40 and 95, run 20 steps between half and full speed
./speedy.sh billies_bounce.ogg 40 95 20 .5 1

It would probably be nicer if the increase was logarithmic so you take smaller steps the faster it gets, but this worked out pretty well so far.

It’s kind of ridiculous to use mpv to segment the stream, but I couldn’t find a way to do windowing with just gst-launch (gnonlin seems to no longer be a thing) so, anyway, it works.