NAME

MIDI::Stream::Event - MIDI event base class

VERSION

version 0.002

DESCRIPTION

Base class for encapsulation of MIDI events parsed by MIDI::Stream::Decoder. An instance of this class will represent any single byte status, e.g. clock, active_sensing.

See subclass documentation for additional information on multi-byte events:

MIDI::Stream::Event::AfterTouch
MIDI::Stream::Event::ControlChange
MIDI::Stream::Event::Note
MIDI::Stream::Event::PitchBend
MIDI::Stream::Event::PolyTouch
MIDI::Stream::Event::ProgramChange
MIDI::Stream::Event::SongPosition
MIDI::Stream::Event::SongSelect
MIDI::Stream::Event::SysEx
MIDI::Stream::Event::TimeCode

METHODS

new

my $event = MIDI::Stream::Event->new( dt => $time, message => $midi_bytes_arrayref );
my $event = MIDI::Stream::Event->new( dt => 0, message => [ 0xfe ] );

Returns a new event instance. Options:

dt

Dela-time

message

MIDI byte array

name

The event name, e.g. 'note_on'

dt

Dela-time - time since the previous event was seen.

message

The original message byte array passed to the constructor.

bytes

String representation of message.

as_hashref

Hash representation of the event. See "Events and Parameters" in MIDI::Stream::Encoder for keys you should expect in the hash for a given event. The event name is accessible under the key 'name'.

TO_JSON

Alias for as_hashref.

as_arrayref

Array representation of the event, in [ name = @parameters ]> form.

AUTHOR

John Barrett <john@jbrt.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2026 by John Barrett.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.