NAME

MIDI::Stream::Tables - MIDI 1.0 look up tables and utility functions

VERSION

version 0.002

SYNOPSIS

use MIDI::Stream::Tables qw/ split_bytes /;

my ( $lsb, $msb ) = split_bytes( 0x1e2f );

DESCRIPTION

MIDI::Stream::Tables is a set of data and functions for encoding, decoding, and manipulating MIDI messages and events. It is intended for use in MIDI::Stream and related libraries.

FUNCTIONS

keys_for

my $keys = keys_for( 'control_change' );

Returns key/accessor names for the given event name.

status_name

my $name = status_name( 0x83 );

Returns the event name for the given status.

status_byte

my $status = status_byte( 'clock' );

Returns the status byte corresponding to the event name.

is_realtime

act_now( $byte ) if is_realtime( $byte );

Returns whether the given byte is in the realtime range.

is_single_byte

my $sb = is_single_byte( 0xfa )

Returns whether the given byte represents a single-byte message, e.g. 'clock', 'tune_request'.

message_length

my $len = message_length( 0x9f );

Returns the expected message length for the given status byte.

is_status_byte

new_status( $byte ) if is_status_byte( $byte );

Returns whether the given byte is a status byte.

has_channel

new_channel_status( $byte ) if has_channel( $byte );

Returns whether the given byte represents a channel status.

is_cc

do_cc( $byte ) if is_cc( $byte );

Returns whether the given byte is a control change status.

combine_bytes

my $value_14bit = combine_bytes( $lsb, $msb );

Combine MSB/LSB pair into a 14-bit value.

split_bytes

my ( $lsb, $msb ) = split_bytes( $value_14bit );

Split a 14-bit value into a MSB/LSB pair.

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.