Musical Knowledge

Share for us
Share on facebook
Share on twitter
Share on pinterest
Share on whatsapp

First, let us have a basic understanding of musical knowledge and then program it through codes.

  • Play single notes: A piece of music consists of several notes with one note responding to one frequency. Output the frequency to the buzzer via Arduino and the buzzer will beep correspondingly. Here is a table for your reference.
  • Time of playing notes: After learning the process of performing notes, we start to learn how to control the time of playing notes. A piece of beautiful music is performed based on playing a note for several time instead of playing all the notes at once. Then how to define the time of playing a note?

As we know, a note is divided into one beat, half beat, a quarter beat and an eighth beat etc. Here we define one beat note as 1, half beat note as 0.5, a quarter beat as 0.25 and an eighth beat as 0.125.

Let’s have a look at how to translate the numbered musical notations into frequency and beats. Take For Alice for example.

Let’s check the details in the music score. Look at 1=C on the top left corner in the figure above. It means it uses the key of C. Check the C line (in red and bolded) in the frequency table previously. In the first note, there is a dot above 3, so it corresponds to 661 and its corresponding variable is NOTE_CH3. The time is half beat, which is 0.5 in the array duration[]. As for the second note, there is another dot above 2 and it is 589. The time is half beat equaling to 0.5.

As for the definition of scale, we’ve already defined it in the underlying library so you can use it directly. NOTE_A1 means DO in the key of A, Note_A2 for RE, NOTE_AH1 for the treble DO, and NOTE_AD1 for the bass DO in key A……

Note that there should be no sound for 0 in the score. And the beat should be 1.

Every “-” added behind a note, it means +1 of the beat (1+1).

The dot behind a note means a half beat – for example, the beat of 3• is 1+0.5.

An easy way for rhythm: If one single note is not underlined, it means one beat (1); one underline = half beat (0.5); two underlines = 1/4 beat (0.25); one “—” (dash) = duplicate beat of the former note (+1).

For pitch: Find the value of the note in the table previously based on the pitch (dot at the top or bottom of the number).

After knowing the principle of notes, it is easy for you to translate numbered musical notations into codes. Now, let’s get started.