This week, we seperate the work into 2 part. First the OCR thing, I let my friend take care of it and second is MIDI.
Today, I just write program to generate the sound, that's Marry have a little lamp. You know what, I heard that Thomas Edison made the first recording of the human voice in 1877 with this song. I don't know why I selected this song but when I work with the sound or playing music, I always start with this song. By the way, next I'm going to make the song able to have the rest sign (-) and then make the rhythm. Actually, I think I already done this part but my problem is how to use the Thai sound bank. I hope I can finish this part within this weekend. So let see the flow...
As I tell you on the Progress report last month, after we have the music characters then we make sound from it. Midi represent the sound by the number and sequence like
- midi.note_on(channel=0, note=do)
So to make the sound we have to define the number of note (from ลฺ till ซํ)
- a3=57 (ลฺ)
- b3=59 (ทฺ)
- c3=60 (ด)
- d3=62 (ร)
- e3=64 (ม)
- f3=65 (ฟ)
- g3=67 (ซ)
- a4=69 (ล)
- b4=71 (ท)
- c4=72 (ดํ)
- d4=74 (รํ)
- e4=76 (มํ)
- f4=77 (ฟํ)
- g4=79 (ซํ)
Then we make the event for the song and generate into sound.
- midi.update_time(time)
midi.note_on(channel, note)
midi.update_time(time+sequence)
midi.note_off(channel, note)
Sound easy, isn't it? I think so but the important point of this project is OCR. Now we just work on blob coloring. I hope that we can recognize the character soon.