Package jazzparser :: Package misc :: Package raphsto :: Module midi :: Class MidiHandler
[hide private]
[frames] | no frames]

Class MidiHandler

source code

object --+
         |
        MidiHandler

Class to encapsulate all the midi processing needed for getting input to a Raphsto model. Read in midi files using the midi library and load an midi.EventStream. Then use this class to get whatever form of data out of it you need for your input.

Instance Methods [hide private]
 
__init__(self, stream, time_unit=4, remove_drums=False, tick_offset=0)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
get_emission_stream(self)
Get a list of emissions from the midi stream's note on events.
source code
 
get_slices(self)
Get a list of midi.slice.EventStreamSlices corresponding to the chunks that this midi stream will be divided into.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, stream, time_unit=4, remove_drums=False, tick_offset=0)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Parameters:
  • stream (midi.EventStream) - the midi data to get input from
  • time_unit (int or float) - number of beats to take as the basic unit of time for observations
Overrides: object.__init__

get_emission_stream(self)

source code 

Get a list of emissions from the midi stream's note on events.

Returns a 2-tuple of the list of emissions and their corresponding start times in midi ticks.

get_slices(self)

source code 

Get a list of midi.slice.EventStreamSlices corresponding to the chunks that this midi stream will be divided into. This includes all midi events, not just note-ons.