(*) it is musically what is called equal temperament. As you have 12 semitones in one octave, you will get C 5 at midi note 81, and the famous A440 (midi note 69) is A 4 in scientific notation.Īs an example for the table Midi note | Scientific notation So C 4 is midi note 69, and midi notes are separated with a semitone(*). (from MIDI Tuning Standard - Frequency values)Īnd finally from C (musical note) - Designation by octave Scientific designation |Octave name | Frequency (Hz) | Other names Ĭonverting from midi note number (d) to frequency (f) is given by the following formula: GM specifies that note number 69 plays A440, which in turn fixes middle C as note number 60. I understand that what you really need is a way to convert a midi note number to a note in standard notation. There is also the issue of timing, but you said that that's not a problem for you. I don't think that you can handle the velocity using a computer keyboard. This means that you might need to be able to send more than one key press event at the same time. Note that in MIDI multiple notes can be played simultaneously, or can overlap in time. The next problem that you will face is sending the key events. From there you can work out the mapping for the MIDI numbers to the supported virtualpiano keys it's this: midi_to_vk = ( The next note, Cs_5, is MIDI 61 which is uppercase T (-t).
With a 0 being no sound and 127 being the loudest. Other values such as velocity are recorded as numbers between 0 and 127. So pretty much any note you could ever wish to play.
Middle C is equal to MIDI 60 and this note corresponds to the 25th key on the virtualpiano keyboard which is activated by pressing the letter t. The MIDI ‘protocol’, as it is known, can support up to 128 notes, ranging from C five octaves below middle C up to G ten octaves higher. Now all of that is interesting, but you don't really need to convert the MIDI number to a note, you just need to convert it to the keyboard key for that note as used by. The NoteOnEvent contains timing, MIDI number/pitch and velocity which you can retrieve: > on = midi.NoteOnEvent(tick=0, channel=0, data=) Midi.NoteOffEvent(tick=100, channel=0, data=), Midi.Pattern(format=1, resolution=220, tracks=\ Opening a MIDI file with read_midifile() returns a Pattern object which looks like this (taken from the examples): > midi.read_midifile('example.mid') If you take a look at the midi module that you are using, you will see that there are some constants that can be used to convert notes to their MIDI number and vice versa.