MCPcopy Create free account
hub / github.com/bspaans/python-mingus / midi_event

Method midi_event

mingus/midi/midi_track.py:162–174  ·  view source on GitHub ↗

Convert and return the parameters as a MIDI event in bytes.

(self, event_type, channel, param1, param2=None)

Source from the content-addressed store, hash-verified

160 return self.header() + self.track_data + self.end_of_track()
161
162 def midi_event(self, event_type, channel, param1, param2=None):
163 """Convert and return the parameters as a MIDI event in bytes."""
164 assert 0 <= event_type < 16
165 assert 0 <= channel < 16
166 assert 0 <= param1 <= 0x7F
167 assert param2 is None or 0 <= param2 <= 0x7F
168
169 status_byte = channel | (event_type << 4)
170 params = [param1]
171 if param2 is not None:
172 params.append(param2)
173
174 return self.delta_time + bytes([status_byte] + params)
175
176 def note_off(self, channel, note, velocity):
177 """Return bytes for a 'note off' event."""

Callers 4

note_offMethod · 0.95
note_onMethod · 0.95
controller_eventMethod · 0.95
program_change_eventMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected