Thursday, November 24, 2016

Activity 9 - Playing notes by image processing

Activity 9 is sort of a synthesis of what we have learned so far. In this activity, we had to play notes in a musical sheet by image processing. Without further ado, let's go on with the steps I did.

To start, I worked with a simple octave as shown below.



I opened the image in Paint and erased the G-clef and the time signature. I also deleted the end line, leaving the staff and the notes as shown below. 



Next thing, also with Paint, I listed the y positions of the lines and the spaces in the staff. I also took note of the possible deviations in position. For example, if a line is at 10 and the adjacent spaces are at 6 and 14, then the possible locations to be considered on the line are bounded by 10 \(\pm\) 2. 

After this, the image was loaded in Scilab, and was converted into a binary image, which is shown below.


Note that we only need the positions of the elliptical blobs in each note, so we don't need the staff and the vertical lines of the notes. We can remove these by eroding the image, using ErodeImage() with vertical and horizontal lines. The resulting image is shown below. 


Now, we determine the separate blobs using SearchBlobs(), and one by one, we take the centroid of the blob. For each blob, we check which note's range it falls under. 

The resulting sound can be heard below.



I was planning on playing another piece which includes quarter notes and half notes, automating the determination of the type of note. I have made initial progress, but time is ticking. There are 2 more activities plus our project, the report and presentation of which is already next week! I need to move on to the next activities! This is it for now. Hopefully I can add some more to this post. 

No comments:

Post a Comment