Sunday, September 29, 2013

Playing Notes in Scilab

The focus of this activity is to obtain a music sheet of a song and translate it to actual sound using Scilab. The music that I chose is an American folk song entitled Oh My Darling, Clementine. I learned this song when I was in grade school. Back then, I learned to read music sheets and this song has been our staple example. I liked this song because it is quite easy to play in the piano but the emotion of the song is so strong.

For this activity I chose to play only the first staff of the music sheet. I got the music sheet from the Free Notes website [1]. I removed the unnecessary texts in the sheet and thus obtained Figure 1.
Figure 1. First musical staff of "Oh My Darling Clementine".

I used Scilab to extract the position of the centroid of the notes. I obtained that information by using imcomplement() to reverse the image. The dark pixels become white pixels and vice versa. I removed the horizontal and vertical lines using the vertical and horizontal structure elements respectively. The final processed image is shown in Figure 2.

Figure 2. Processed image of Figure 1.

Obtaining the pixel position of the centroid of each blob, I can translate it to sound. The x pixel values represent time and the y pixel values represent the frequency of the notes. Using the sound() function of Scilab I was able to play the music which is attached below.



For this activity I give myself a grade of 10/10 because I was able to do the required tasks. Sorry for the late upload.

[1] http://www.free-notes.net/cgi-bin/noten_Song.pl?song=Oh+My+Darling+Clementine&profile=null&lang=en&db=Main 
[2] Soriano, Maricor. Activity 12 manual.

No comments:

Post a Comment