With this Python challenge, we will create a metronome app to help musicians keep the right tempo when practising their favourite tunes. By the end of this project, we will have a program that takes user input for the BPM (Beats Per Minute) and the time signature, then generates a matching tempo on screen.
Our first task is to write a Python program that:
-
Takes user input for BPM (beats per minute) and time signature (e.g., 4/4, 3/4, 6/8).
Calculates the interval between beats based on the BPM
Generates a visual metronome on the screen, showing the beats in real-time and refreshing the screen based on the bpm and the time signature
Our second aim will be to add a menu system to our app. The menu will give the user two options:
-
Option 1: The user can use the metronome from our first task and will therefore be asked to enter the BPM and time signature to use.
Option 2: The user will be asked to enter the name of a famous rock song they would like to practise on. The program will then try to find this rock song in the rock-songs.csv file provided to find out the BPM and time signature to use to configure the metronome.
BPM and Beat Interval
The interval (in seconds) between two beats can be calculated using the given bpm of a track as follows:

So for instance with a bpm of 120 (beats per minute), the delay between two beats is: 60/120 = 0.5 seconds.

Time Signature
The time signature determines how many beats are in each measure. For example, 4/4 means 4 beats per measure, while 3/4 means 3 beats. Our metronome should group beats accordingly by clearing the screen after each measure and displaying the first beat within a measure as a “Tick” while the other beats will be displayed as “Tock”.

Python Code
Here is the full code for the first part of this challenge, enabling the user to enter the BPM and time signature to be used by the metronome.
You will need to complete this code to add the menu system and let the user configure the metronome using either option 1 (entering the BPM and time signature) or option 2 (entering a song title).

Solution...
The solution for this challenge is available to full members!Find out how to become a member:
➤ Members' Area






