[C++ / Qt] HumComposer : make music by humming
Having music composition as a hobby, I often find myself with a melody in the head, but don’t have my computer around to compose and save it.
So, as an exercise in Qt, I began to work on a software that could produce a MIDI file by processing humming/voice via the microphone. Basically, this needs 3 steps :
1. Recording the sound
QAudioInput is well fit for this, and quite easy to use.
2. Processing the sound
What we need to do is to identify every notes in the sample sound recorded from the microphone.
For that we have to detect a change of level in the samples which will be, for us, representative of a note sang by the voice of the user.
Once we know which set of values in the sample may define a possible note, we need to compute the pitch of this whole set, then convert this value in a MIDI note.
I used the aubio library to help me with this part.
3. Build and Play the MIDI
The last part is to build a MIDI file with the notes we found, and then play it.
With JDKSMidi, you can build MIDI data quite easily.
The real tricky part is to play the MIDI, has it requires different kinds of technology depending on which system you are. For example I have not yet found a library that would allow me to generically play MIDI on PC and Android.
This work is still in progress
Comments are closed, but trackbacks and pingbacks are open.