Saturday, August 25, 2012

9th Activity: Applications of Morphological Operations 2 of 3: Playing Notes by Image Processing

     I was so surprised when I learned that Scilab could actually play notes! So before doing what was actually tasked to us, I first explored this function by playing some songs. :)  I have had piano lessons when I was a kid. I also had violin lessons at the Conservatory of Music. Aaaaand I love to sing. :) So as you could see, I really love music. So when asked to choose for a music sheet, I couldn't decide what to actually use after being familiar to lots of it.

     Going back to the real thing, I chose the first piece that I was able to play when I was a kid. It was entitled "Ode to Joy." The first line is shown in Figure 1.

Figure 1. First line of Ode to Joy
     I then inverted it and removed the g-clef as shown in Figure 2.

Figure 2. Inverted image
    Using the function imcorrcoef, the image is being compared to another image which is referred to as a template. I made a quarter note and a half note as templates as shown in Figure 3.

 

Figure 3. Templates to be used
  
     Thresholding was done after taking the result of the correlation. This was done to obtain a single pixel location for the quarter notes and half notes. These are shown in Figure 4 and Figure 5.



Figure 4. Locations of quarter notes

Figure 5. Location of half note


     Now that the locations of the notes are determined, the melody can now be played by assigning the frequencies for each note and then using the sound function. The sound file can now played below.



Reference
[1]Maricor Soriano. 2012. Activity 9 - Applications of Morphological Operations 2 of 3 - Playing Notes by Image Processing. Applied Physics 186

No comments:

Post a Comment