mingus.midi.sequencer

A general purpose sequencer for the objects in mingus.containers.

You can use the Sequencer object either by creating a subclass and implementing some of the events (init, play_event, stop_event, cc_event, instr_event) or by attaching observer objects via ‘attach’ and catching the messages in the notify(msg_type, param_dict) function of your object.

See SequencerObserver for a pre made, easy to extend base class that can be attached to the Sequencer.

class mingus.midi.sequencer.Sequencer[source]
MSG_CC

Attribute of type: int 2

MSG_INSTR

Attribute of type: int 3

MSG_PLAY_BAR

Attribute of type: int 9

MSG_PLAY_BARS

Attribute of type: int 10

MSG_PLAY_COMPOSITION

Attribute of type: int 13

MSG_PLAY_INT

Attribute of type: int 0

MSG_PLAY_NC

Attribute of type: int 7

MSG_PLAY_NOTE

Attribute of type: int 5

MSG_PLAY_TRACK

Attribute of type: int 11

MSG_PLAY_TRACKS

Attribute of type: int 12

MSG_SLEEP

Attribute of type: int 4

MSG_STOP_INT

Attribute of type: int 1

MSG_STOP_NC

Attribute of type: int 8

MSG_STOP_NOTE

Attribute of type: int 6

__init__(self)[source]
attach(self, listener)[source]

Attach an object that should be notified of events.

The object should have a notify(msg_type, param_dict) function.

cc_event(self, channel, control, value)[source]
control_change(self, channel, control, value)[source]

Send a control change message.

See the MIDI specification for more information.

detach(self, listener)[source]

Detach a listening object so that it won’t receive any events anymore.

init(self)[source]
instr_event(self, channel, instr, bank)[source]
main_volume(self, channel, value)[source]

Set the main volume.

modulation(self, channel, value)[source]

Set the modulation.

notify_listeners(self, msg_type, params)[source]

Send a message to all the observers.

output

Attribute of type: NoneType None

pan(self, channel, value)[source]

Set the panning.

play_Bar(self, bar, channel=1, bpm=120)[source]

Play a Bar object.

Return a dictionary with the bpm lemma set on success, an empty dict on some kind of failure.

The tempo can be changed by setting the bpm attribute on a NoteContainer.

play_Bars(self, bars, channels, bpm=120)[source]

Play several bars (a list of Bar objects) at the same time.

A list of channels should also be provided. The tempo can be changed by providing one or more of the NoteContainers with a bpm argument.

play_Composition(self, composition, channels=None, bpm=120)[source]

Play a Composition object.

play_Note(self, note, channel=1, velocity=100)[source]

Play a Note object on a channel with a velocity[0-127].

You can either specify the velocity and channel here as arguments or you can set the Note.velocity and Note.channel attributes, which will take presedence over the function arguments.

play_NoteContainer(self, nc, channel=1, velocity=100)[source]

Play the Notes in the NoteContainer nc.

play_Track(self, track, channel=1, bpm=120)[source]

Play a Track object.

play_Tracks(self, tracks, channels, bpm=120)[source]

Play a list of Tracks.

If an instance of MidiInstrument is used then the instrument will be set automatically.

play_event(self, note, channel, velocity)[source]
set_instrument(self, channel, instr, bank=0)[source]

Set the channel to the instrument _instr_.

sleep(self, seconds)[source]
stop_Note(self, note, channel=1)[source]

Stop a note on a channel.

If Note.channel is set, it will take presedence over the channel argument given here.

stop_NoteContainer(self, nc, channel=1)[source]

Stop playing the notes in NoteContainer nc.

stop_event(self, note, channel)[source]
stop_everything(self)[source]

Stop all the notes on all channels.


Back to Index