Tempo and pitch
The next two features of music are tempo and pitch. Tempo is defined as the number of beats to be played per minute. Therefore, a piece of high-tempo music will play more beats per minute (bpm) and will sound fast. Similarly, if we keep the tempo value low, then we can hear the same melody as a piece of slow-paced music. In Micro:bit’s MicroPython implementation, we have the music.set_tempo(bpm=tempo)
function to set the tempo of the melody.
For example, the following code will play the melody at 100 bpm:
music.set_tempo(bpm=100)
Pitch is defined as the frequency of the tone. Frequency is the number of cycles in 1 second. We can’t be confused about understanding tempo and pitch. Let us consider a note, A4, with a pitch of 440 Hz. This means that the speaker’s membrane will vibrate 440 times every second to play this tone in octave 4. If we place the tone with A5, then the frequency or the pitch will double – that is, 880 Hz. Now...