This depends on github/olemb/mido
Use from MIDIVelocityData import *
LoadVelocityDataFromMIDIFile ( fileName ) read the MIDI file fileName and return a numpy array d = [length of piece in ticks X MIDI.Note_Count] where:
If note n is playing at time t, then d[t,n] is the velocity used when the note began.
If note n is not playing at time t, then d[t,n] is zero.
A note n begins at time t if d[t,n] > d[t-1,n]
A note n ends at time t if d[t-1,n] > 0 and d[t,n] = 0
This is the "piano roll" representation of a musical piece.
SaveVelocityDataToMIDIFile ( data, fileName ) creates a MIDI file using the data.
Contains constants describing notes, octaves and pitch classes, and these utility functions:
Music.pitchClass ( note )
Music.octave ( note )
Music.noteFromOctaveAndPitchClass ( octave, pitchClass )
Music.pitchInHz ( note )
Music,noteName ( note )
Music.intervalClassicalConsonance ( note1, note2 ) Consonance as it is taught to elementary music theory students, with four possible values: Music.dissonance, Music.consonant, Music.perfectConsonance, Music.unison
Contains constants from the general MIDI standard for messages, notes, controllers and so on.