Events
- class alsa_midi.Event(type=None, *, flags=0, tag=0, queue_id=None, time=None, tick=None, source=None, dest=None, relative=None, raw_data=None)[source]
Base class for ALSA sequencer events.
Normally not instantiated directly – specialized subclasses will be used.
Most attributes are optional – when not set some defaults will be used when passing this to ALSA.
time
andtick
cannot be ever be both set.Contains python representation of ALSA snd_seq_event_t.
- Parameters
event – event type
flags (Optional[EventFlags]) – event flags
tag (int) – event tag
queue_id (Optional[int]) – queue id for the event. None for direct dispatch.
time (Optional[RealTime]) – event time in seconds and nanoseconds
tick (Optional[int]) – event time in MIDI ticks
source (Optional[Address]) – event source address
dest (Optional[Address]) – event destination address
relative (Optional[bool]) – When true then
tick
ortick
are relativeraw_data (Optional[bytes]) – Unparsed raw data part of the ALSA event. Note: this is not MIDI data.
type (Optional[EventType]) –
- Variables
event – event type
flags – event flags
tag – event tag
queue_id – queue id for the event. None for direct dispatch.
time – event time in seconds and nanoseconds
tick – event time in MIDI ticks
source – event source address
dest – event destination address
relative – When true then
tick
ortick
are relativeraw_data – Unparsed raw data part of the ALSA event. Note: this is not MIDI data.
- length()[source]
Calculates the (encoded) byte-stream size of the event.
Wraps snd_seq_event_length().
- class alsa_midi.EventType(value)[source]
Event type values.
- BOUNCE = 131
- CHANPRESS = 12
- CLIENT_CHANGE = 62
- CLIENT_EXIT = 61
- CLIENT_START = 60
- CLOCK = 36
- CONTINUE = 31
- CONTROL14 = 14
- CONTROLLER = 10
- ECHO = 50
- KEYPRESS = 8
- KEYSIGN = 24
- NONE = 255
- NONREGPARAM = 15
- NOTE = 5
- NOTEOFF = 7
- NOTEON = 6
- OSS = 51
- PGMCHANGE = 11
- PITCHBEND = 13
- PORT_CHANGE = 65
- PORT_EXIT = 64
- PORT_START = 63
- PORT_SUBSCRIBED = 66
- PORT_UNSUBSCRIBED = 67
- QFRAME = 22
- QUEUE_SKEW = 38
- REGPARAM = 16
- RESET = 41
- RESULT = 1
- SENSING = 42
- SETPOS_TICK = 33
- SETPOS_TIME = 34
- SONGPOS = 20
- SONGSEL = 21
- START = 30
- STOP = 32
- SYNC_POS = 39
- SYSEX = 130
- SYSTEM = 0
- TEMPO = 35
- TICK = 37
- TIMESIGN = 23
- TUNE_REQUEST = 40
- USR0 = 90
- USR1 = 91
- USR2 = 92
- USR3 = 93
- USR4 = 94
- USR5 = 95
- USR6 = 96
- USR7 = 97
- USR8 = 98
- USR9 = 99
- USR_VAR0 = 135
- USR_VAR1 = 136
- USR_VAR2 = 137
- USR_VAR3 = 138
- USR_VAR4 = 139
- class alsa_midi.EventFlags(value)[source]
Event flags.
- EVENT_LENGTH_FIXED = 0
- EVENT_LENGTH_MASK = 12
- EVENT_LENGTH_VARIABLE = 4
- EVENT_LENGTH_VARUSR = 8
- PRIORITY_HIGH = 16
- PRIORITY_MASK = 16
- PRIORITY_NORMAL = 0
- TIME_MODE_ABS = 0
- TIME_MODE_MASK = 2
- TIME_MODE_REL = 2
- TIME_STAMP_MASK = 1
- TIME_STAMP_REAL = 1
- TIME_STAMP_TICK = 0
- class alsa_midi.NoteEvent(note, channel=0, velocity=127, duration=0, off_velocity=0, **kwargs)[source]
Note event – a Note On followed by a Note Off.
- Parameters
- Variables
note – MIDI note number
channel – MIDI channel
velocity – note velocity
duration – note duration
off_velocity – Note Off velocity
- length()
Calculates the (encoded) byte-stream size of the event.
Wraps snd_seq_event_length().
- class alsa_midi.NoteOnEvent(note, channel=0, velocity=127, **kwargs)[source]
Note On event.
- Parameters
- Variables
note – MIDI note number
channel – MIDI channel
velocity – note velocity
- length()
Calculates the (encoded) byte-stream size of the event.
Wraps snd_seq_event_length().
- class alsa_midi.NoteOffEvent(note, channel=0, velocity=127, **kwargs)[source]
Note Off event.
- Parameters
- Variables
note – MIDI note number
channel – MIDI channel
velocity – note velocity
- length()
Calculates the (encoded) byte-stream size of the event.
Wraps snd_seq_event_length().
- class alsa_midi.KeyPressureEvent(note, channel=0, velocity=127, **kwargs)[source]
Key pressure changed (aftertouch) event.
- Parameters
- Variables
note – MIDI note number
channel – MIDI channel
velocity – note velocity
- length()
Calculates the (encoded) byte-stream size of the event.
Wraps snd_seq_event_length().
- class alsa_midi.ControlChangeEvent(channel, param, value, **kwargs)[source]
Control Change event.
- Parameters
- Variables
channel – MIDI channel
param – parameter number
value – new value
- length()
Calculates the (encoded) byte-stream size of the event.
Wraps snd_seq_event_length().
- class alsa_midi.ProgramChangeEvent(channel, value, **kwargs)[source]
Program Change event.
- Parameters
- Variables
channel – MIDI channel
value – new value
- length()
Calculates the (encoded) byte-stream size of the event.
Wraps snd_seq_event_length().
- class alsa_midi.ChannelPressureEvent(channel, value, **kwargs)[source]
Channel Pressure event.
- Parameters
- Variables
channel – MIDI channel
value – new value
- length()
Calculates the (encoded) byte-stream size of the event.
Wraps snd_seq_event_length().
- class alsa_midi.PitchBendEvent(channel, value, **kwargs)[source]
Pitch Bend event.
- Parameters
- Variables
channel – MIDI channel
value – new value
- length()
Calculates the (encoded) byte-stream size of the event.
Wraps snd_seq_event_length().
- class alsa_midi.Control14BitChangeEvent(channel, param, value, **kwargs)[source]
14-bit Control Change event.
- Parameters
- Variables
channel – MIDI channel
param – parameter number
value – new value
- length()
Calculates the (encoded) byte-stream size of the event.
Wraps snd_seq_event_length().
- class alsa_midi.NonRegisteredParameterChangeEvent(channel, param, value, **kwargs)[source]
Non Registered Parameter Change event.
- Parameters
- Variables
channel – MIDI channel
param – parameter number
value – new value
- length()
Calculates the (encoded) byte-stream size of the event.
Wraps snd_seq_event_length().
- class alsa_midi.RegisteredParameterChangeEvent(channel, param, value, **kwargs)[source]
Registered Parameter Change event.
- Parameters
- Variables
channel – MIDI channel
param – parameter number
value – new value
- length()
Calculates the (encoded) byte-stream size of the event.
Wraps snd_seq_event_length().
- class alsa_midi.SongPositionPointerEvent(channel, value, **kwargs)[source]
Song Position Pointer event.
- Parameters
- Variables
channel – MIDI channel
value – new value
- length()
Calculates the (encoded) byte-stream size of the event.
Wraps snd_seq_event_length().
- class alsa_midi.SongSelectEvent(channel, value, **kwargs)[source]
Song Select event.
- Parameters
- Variables
channel – MIDI channel
value – new value
- length()
Calculates the (encoded) byte-stream size of the event.
Wraps snd_seq_event_length().
- class alsa_midi.TimeSignatureEvent(channel, value, **kwargs)[source]
Time Signature event.
- Parameters
- Variables
channel – MIDI channel
value – new value
- length()
Calculates the (encoded) byte-stream size of the event.
Wraps snd_seq_event_length().
- class alsa_midi.KeySignatureEvent(channel, value, **kwargs)[source]
Key Signature event.
- Parameters
- Variables
channel – MIDI channel
value – new value
- length()
Calculates the (encoded) byte-stream size of the event.
Wraps snd_seq_event_length().
- class alsa_midi.StartEvent(control_queue=None, **kwargs)[source]
Start event.
- Parameters
control_queue (Optional[int]) – affected queue
- Variables
control_queue – affected queue id
- length()
Calculates the (encoded) byte-stream size of the event.
Wraps snd_seq_event_length().
- class alsa_midi.ContinueEvent(control_queue=None, **kwargs)[source]
Continue event.
- Parameters
control_queue (Optional[int]) – affected queue
- Variables
control_queue – affected queue id
- length()
Calculates the (encoded) byte-stream size of the event.
Wraps snd_seq_event_length().
- class alsa_midi.StopEvent(control_queue=None, **kwargs)[source]
Stop event.
- Parameters
control_queue (Optional[int]) – affected queue
- Variables
control_queue – affected queue id
- length()
Calculates the (encoded) byte-stream size of the event.
Wraps snd_seq_event_length().
- class alsa_midi.SetQueuePositionTickEvent(position, *args, **kwargs)[source]
Set Queue Position Tick event.
- Parameters
control_queue – affected queue
position (int) – new position
- Variables
control_queue – affected queue id
position – new position
- length()
Calculates the (encoded) byte-stream size of the event.
Wraps snd_seq_event_length().
- class alsa_midi.SetQueuePositionTimeEvent(position, *args, **kwargs)[source]
Set Queue Position Time event.
- Parameters
control_queue – affected queue
position (RealTime) – new position
- Variables
control_queue – affected queue id
position – new position
- length()
Calculates the (encoded) byte-stream size of the event.
Wraps snd_seq_event_length().
- class alsa_midi.SetQueueTempoEvent(midi_tempo=None, *, bpm=None, **kwargs)[source]
Set Queue Position Time event.
- Parameters
- Variables
control_queue – affected queue id
midi_tempo – MIDI tempo (microseconds per quarter note)
- property bpm
Approximate beats per minute value for the selected tempo.
- length()
Calculates the (encoded) byte-stream size of the event.
Wraps snd_seq_event_length().
- class alsa_midi.ClockEvent(control_queue=None, **kwargs)[source]
MIDI Clock event.
- Parameters
control_queue (Optional[int]) – affected queue
- Variables
control_queue – affected queue id
- length()
Calculates the (encoded) byte-stream size of the event.
Wraps snd_seq_event_length().
- class alsa_midi.TickEvent(control_queue=None, **kwargs)[source]
MIDI Tick event.
- Parameters
control_queue (Optional[int]) – affected queue
- Variables
control_queue – affected queue id
- length()
Calculates the (encoded) byte-stream size of the event.
Wraps snd_seq_event_length().
- class alsa_midi.QueueSkewEvent(value, base, *args, **kwargs)[source]
Queue Skew event.
- Parameters
- Variables
control_queue – affected queue id
value – skew value
base – skew base
- length()
Calculates the (encoded) byte-stream size of the event.
Wraps snd_seq_event_length().
- class alsa_midi.SyncPositionChangedEvent(position, *args, **kwargs)[source]
Sync Position Changed event.
- Parameters
control_queue – affected queue
position (int) – new position
- Variables
control_queue – affected queue id
position – new position
- length()
Calculates the (encoded) byte-stream size of the event.
Wraps snd_seq_event_length().
- class alsa_midi.TuneRequestEvent(type=None, *, flags=0, tag=0, queue_id=None, time=None, tick=None, source=None, dest=None, relative=None, raw_data=None)[source]
Tune request event.
Normally not instantiated directly – specialized subclasses will be used.
Most attributes are optional – when not set some defaults will be used when passing this to ALSA.
time
andtick
cannot be ever be both set.Contains python representation of ALSA snd_seq_event_t.
- Parameters
event – event type
flags (Optional[EventFlags]) – event flags
tag (int) – event tag
queue_id (Optional[int]) – queue id for the event. None for direct dispatch.
time (Optional[RealTime]) – event time in seconds and nanoseconds
tick (Optional[int]) – event time in MIDI ticks
source (Optional[Address]) – event source address
dest (Optional[Address]) – event destination address
relative (Optional[bool]) – When true then
tick
ortick
are relativeraw_data (Optional[bytes]) – Unparsed raw data part of the ALSA event. Note: this is not MIDI data.
type (Optional[EventType]) –
- Variables
event – event type
flags – event flags
tag – event tag
queue_id – queue id for the event. None for direct dispatch.
time – event time in seconds and nanoseconds
tick – event time in MIDI ticks
source – event source address
dest – event destination address
relative – When true then
tick
ortick
are relativeraw_data – Unparsed raw data part of the ALSA event. Note: this is not MIDI data.
- length()
Calculates the (encoded) byte-stream size of the event.
Wraps snd_seq_event_length().
- class alsa_midi.ResetEvent(type=None, *, flags=0, tag=0, queue_id=None, time=None, tick=None, source=None, dest=None, relative=None, raw_data=None)[source]
Reset event.
Normally not instantiated directly – specialized subclasses will be used.
Most attributes are optional – when not set some defaults will be used when passing this to ALSA.
time
andtick
cannot be ever be both set.Contains python representation of ALSA snd_seq_event_t.
- Parameters
event – event type
flags (Optional[EventFlags]) – event flags
tag (int) – event tag
queue_id (Optional[int]) – queue id for the event. None for direct dispatch.
time (Optional[RealTime]) – event time in seconds and nanoseconds
tick (Optional[int]) – event time in MIDI ticks
source (Optional[Address]) – event source address
dest (Optional[Address]) – event destination address
relative (Optional[bool]) – When true then
tick
ortick
are relativeraw_data (Optional[bytes]) – Unparsed raw data part of the ALSA event. Note: this is not MIDI data.
type (Optional[EventType]) –
- Variables
event – event type
flags – event flags
tag – event tag
queue_id – queue id for the event. None for direct dispatch.
time – event time in seconds and nanoseconds
tick – event time in MIDI ticks
source – event source address
dest – event destination address
relative – When true then
tick
ortick
are relativeraw_data – Unparsed raw data part of the ALSA event. Note: this is not MIDI data.
- length()
Calculates the (encoded) byte-stream size of the event.
Wraps snd_seq_event_length().
- class alsa_midi.ActiveSensingEvent(type=None, *, flags=0, tag=0, queue_id=None, time=None, tick=None, source=None, dest=None, relative=None, raw_data=None)[source]
Active Sensing event.
Normally not instantiated directly – specialized subclasses will be used.
Most attributes are optional – when not set some defaults will be used when passing this to ALSA.
time
andtick
cannot be ever be both set.Contains python representation of ALSA snd_seq_event_t.
- Parameters
event – event type
flags (Optional[EventFlags]) – event flags
tag (int) – event tag
queue_id (Optional[int]) – queue id for the event. None for direct dispatch.
time (Optional[RealTime]) – event time in seconds and nanoseconds
tick (Optional[int]) – event time in MIDI ticks
source (Optional[Address]) – event source address
dest (Optional[Address]) – event destination address
relative (Optional[bool]) – When true then
tick
ortick
are relativeraw_data (Optional[bytes]) – Unparsed raw data part of the ALSA event. Note: this is not MIDI data.
type (Optional[EventType]) –
- Variables
event – event type
flags – event flags
tag – event tag
queue_id – queue id for the event. None for direct dispatch.
time – event time in seconds and nanoseconds
tick – event time in MIDI ticks
source – event source address
dest – event destination address
relative – When true then
tick
ortick
are relativeraw_data – Unparsed raw data part of the ALSA event. Note: this is not MIDI data.
- length()
Calculates the (encoded) byte-stream size of the event.
Wraps snd_seq_event_length().
- class alsa_midi.EchoEvent(type=None, *, flags=0, tag=0, queue_id=None, time=None, tick=None, source=None, dest=None, relative=None, raw_data=None)[source]
Echo event.
Normally not instantiated directly – specialized subclasses will be used.
Most attributes are optional – when not set some defaults will be used when passing this to ALSA.
time
andtick
cannot be ever be both set.Contains python representation of ALSA snd_seq_event_t.
- Parameters
event – event type
flags (Optional[EventFlags]) – event flags
tag (int) – event tag
queue_id (Optional[int]) – queue id for the event. None for direct dispatch.
time (Optional[RealTime]) – event time in seconds and nanoseconds
tick (Optional[int]) – event time in MIDI ticks
source (Optional[Address]) – event source address
dest (Optional[Address]) – event destination address
relative (Optional[bool]) – When true then
tick
ortick
are relativeraw_data (Optional[bytes]) – Unparsed raw data part of the ALSA event. Note: this is not MIDI data.
type (Optional[EventType]) –
- Variables
event – event type
flags – event flags
tag – event tag
queue_id – queue id for the event. None for direct dispatch.
time – event time in seconds and nanoseconds
tick – event time in MIDI ticks
source – event source address
dest – event destination address
relative – When true then
tick
ortick
are relativeraw_data – Unparsed raw data part of the ALSA event. Note: this is not MIDI data.
- length()
Calculates the (encoded) byte-stream size of the event.
Wraps snd_seq_event_length().
- class alsa_midi.OSSEvent(type=None, *, flags=0, tag=0, queue_id=None, time=None, tick=None, source=None, dest=None, relative=None, raw_data=None)[source]
OSS emulation event.
Normally not instantiated directly – specialized subclasses will be used.
Most attributes are optional – when not set some defaults will be used when passing this to ALSA.
time
andtick
cannot be ever be both set.Contains python representation of ALSA snd_seq_event_t.
- Parameters
event – event type
flags (Optional[EventFlags]) – event flags
tag (int) – event tag
queue_id (Optional[int]) – queue id for the event. None for direct dispatch.
time (Optional[RealTime]) – event time in seconds and nanoseconds
tick (Optional[int]) – event time in MIDI ticks
source (Optional[Address]) – event source address
dest (Optional[Address]) – event destination address
relative (Optional[bool]) – When true then
tick
ortick
are relativeraw_data (Optional[bytes]) – Unparsed raw data part of the ALSA event. Note: this is not MIDI data.
type (Optional[EventType]) –
- Variables
event – event type
flags – event flags
tag – event tag
queue_id – queue id for the event. None for direct dispatch.
time – event time in seconds and nanoseconds
tick – event time in MIDI ticks
source – event source address
dest – event destination address
relative – When true then
tick
ortick
are relativeraw_data – Unparsed raw data part of the ALSA event. Note: this is not MIDI data.
- length()
Calculates the (encoded) byte-stream size of the event.
Wraps snd_seq_event_length().
- class alsa_midi.ClientStartEvent(addr, **kwargs)[source]
Client start event.
- Parameters
addr (Address) – sequencer address
- Variables
addr – sequencer address
- length()
Calculates the (encoded) byte-stream size of the event.
Wraps snd_seq_event_length().
- class alsa_midi.ClientExitEvent(addr, **kwargs)[source]
Client exit event.
- Parameters
addr (Address) – sequencer address
- Variables
addr – sequencer address
- length()
Calculates the (encoded) byte-stream size of the event.
Wraps snd_seq_event_length().
- class alsa_midi.ClientChangeEvent(addr, **kwargs)[source]
Client change event.
- Parameters
addr (Address) – sequencer address
- Variables
addr – sequencer address
- length()
Calculates the (encoded) byte-stream size of the event.
Wraps snd_seq_event_length().
- class alsa_midi.PortStartEvent(addr, **kwargs)[source]
Port start event.
- Parameters
addr (Address) – sequencer address
- Variables
addr – sequencer address
- length()
Calculates the (encoded) byte-stream size of the event.
Wraps snd_seq_event_length().
- class alsa_midi.PortExitEvent(addr, **kwargs)[source]
Port exit event.
- Parameters
addr (Address) – sequencer address
- Variables
addr – sequencer address
- length()
Calculates the (encoded) byte-stream size of the event.
Wraps snd_seq_event_length().
- class alsa_midi.PortChangeEvent(addr, **kwargs)[source]
Port change event.
- Parameters
addr (Address) – sequencer address
- Variables
addr – sequencer address
- length()
Calculates the (encoded) byte-stream size of the event.
Wraps snd_seq_event_length().
- class alsa_midi.PortSubscribedEvent(connect_sender, connect_dest, **kwargs)[source]
Port subscribed event.
- Parameters
- Variables
sender – sender address
dest – destination address
- length()
Calculates the (encoded) byte-stream size of the event.
Wraps snd_seq_event_length().
- class alsa_midi.PortUnsubscribedEvent(connect_sender, connect_dest, **kwargs)[source]
Port unsubscribed event.
- Parameters
- Variables
sender – sender address
dest – destination address
- length()
Calculates the (encoded) byte-stream size of the event.
Wraps snd_seq_event_length().
- class alsa_midi.SysExEvent(data, **kwargs)[source]
System Exclusive message event.
- Parameters
data (bytes) – the data
- Variables
data – the data
- length()
Calculates the (encoded) byte-stream size of the event.
Wraps snd_seq_event_length().
- class alsa_midi.BounceEvent(data, **kwargs)[source]
Error event.
- Parameters
data (bytes) – the data
- Variables
data – the data
- length()
Calculates the (encoded) byte-stream size of the event.
Wraps snd_seq_event_length().
- class alsa_midi.SystemEvent(event, result, **kwargs)[source]
System status event.
- length()
Calculates the (encoded) byte-stream size of the event.
Wraps snd_seq_event_length().
- class alsa_midi.ResultEvent(event, result, **kwargs)[source]
Returned result status event.
- length()
Calculates the (encoded) byte-stream size of the event.
Wraps snd_seq_event_length().
- class alsa_midi.UserVar0Event(data, **kwargs)[source]
USR_VAR0 event.
- Parameters
data (bytes) – the data
- Variables
data – the data
- length()
Calculates the (encoded) byte-stream size of the event.
Wraps snd_seq_event_length().
- class alsa_midi.UserVar1Event(data, **kwargs)[source]
USR_VAR1 event.
- Parameters
data (bytes) – the data
- Variables
data – the data
- length()
Calculates the (encoded) byte-stream size of the event.
Wraps snd_seq_event_length().
- class alsa_midi.UserVar2Event(data, **kwargs)[source]
USR_VAR2 event.
- Parameters
data (bytes) – the data
- Variables
data – the data
- length()
Calculates the (encoded) byte-stream size of the event.
Wraps snd_seq_event_length().
- class alsa_midi.UserVar3Event(data, **kwargs)[source]
USR_VAR3 event.
- Parameters
data (bytes) – the data
- Variables
data – the data
- length()
Calculates the (encoded) byte-stream size of the event.
Wraps snd_seq_event_length().
- class alsa_midi.MidiBytesEvent(midi_bytes, **kwargs)[source]
Pseudo ALSA event to hold MIDI messages as byte sequences.
Used to interface code that operates on MIDI bytes.
- Parameters
- Variables
midi_bytes – the MIDI message
- length()
Calculates the (encoded) byte-stream size of the event.
Wraps snd_seq_event_length().