NAME
Peta::MIDI::Decoder - MIDI bytes into events
VERSION
version 0.2610180
SYNOPSIS
my $decoder = Peta::MIDI::Decoder->new(enable_14bit_cc => 1);
$decoder->attach_callback(qr/^note/ => sub ($event) { say "@{ $event->as_arrayref }" });
$decoder->decode($bytes);
my @events = $decoder->events;
say $decoder->tempo;
DESCRIPTION
As MIDI::Stream::Decoder does: bytes in any pieces, running status, system exclusive, real-time bytes anywhere; Peta::MIDI::Events, kept and handed to callbacks.
METHODS
new
new(retain_events => 1, enable_14bit_cc => 0, callback => sub ($event) {...}, clock_ppqn => 24, clock_samples => 24, round_tempo => 0).
decode
decode(@bytes): the bytes decoded; how many events are kept.
events, fetch_one_event
The events kept, all (and forgotten) or the first.
attach_callback, cancel_event_callback, cancel_callback, stop, continue
attach_callback($which, sub ($event) {...}): a callback for events of a name, of names matching a pattern, of a list of names, or all. A callback that returns $decoder->stop ends the others for that event.
tempo
The beats a minute of the clock's last ticks (clock_samples of them, clock_ppqn a beat).
AUTHOR
PetaMem s.r.o. <info@petamem.com>
COPYRIGHT
Copyright (c) 2026 PetaMem s.r.o.
LICENSE
This package is free software, dual-licensed under the Artistic License 2.0 and the BSD 2-Clause License. See the LICENSE file of the distribution.