Interval Workout Audio Tracks Automated by pydub and gTTS
Introduction
It is one month into 2020 and I am still holding onto my new year’s resolution with a white-knuckled grasp. This resolution is simply to workout for around 10 minutes every day. Part of the reason I have yet to fall off of the horse is that it’s a relatively easy resolution. I know that I’m not going to become extremely fit with such a light routine, but I do have the confidence that it is much better to do a little of something every day than to do nothing ever.
I have been doing the same routine for a month. I do one movement for 30 seconds and rest for 10. My workout is inspired by the famous “7-Minute Workout” that has rolled through a number of health news resources starting back in the early 2010s (1, 2).
To perform this routine, I have been using a wall clock to time myself, but it is difficult to look up at a clock in the middle of doing push-ups or sit ups. During one of the times that I was struggling to crane my head up and look at the clock, I realized that I had a problem. To solve it, I developed a script that generates an mp3 file that you can listen to while you work out. It’s not on the same level as a playlist that gets you totally pumped up and really excited to move, but it provides a consistent set of signals that one can use to know where they are in the course of an interval workout. Most importantly, you only need your ears to get these signals which means that you can focus more on your movement.
The linked project tells you which exercise to do next (customizable) and provides timing signals to let you know how far into a movement’s time allotment you have progressed.
Editing Audio in Python
One of the most exciting elements of using python is that there really seems to be a library for everything. Editing and automating the creation of audio tracks is no exception. The linked project makes use of the pydub
package and Google Text-to-Speech (gTTS
) to generate a guided audio workout. pydub
has an intuitive interface and makes it really to get started editing audio with zero experience with python audio interfaces. Thanks pydub
!