NAME
MIDI::RtController - Control your MIDI controller
VERSION
version 0.0300
SYNOPSIS
use MIDI::RtController ();
my $rtc = MIDI::RtController->new(
input => 'input-MIDI-device',
output => 'output-MIDI-device',
);
sub filter_notes {
my ($note) = @_;
return $note, $note + 7, $note + 12;
}
sub filter_tone {
my ($event) = @_;
my ($ev, $channel, $note, $vel) = $event->@*;
my @notes = filter_notes($note);
$rtc->send_it([ $ev, $channel, $_, $vel ]) for @notes;
return 0;
}
$rtc->add_filter('filter_tone', $_ => \&filter_tone)
for qw(note_on note_off);
# add other stuff to the $rtc->loop...
$rtc->run;
DESCRIPTION
MIDI::RtController
allows you to control your MIDI controller using plug-in filters.
ATTRIBUTES
verbose
$verbose = $rtc->verbose;
Show progress.
input
$input = $rtc->input;
Return the MIDI input port.
output
$output = $rtc->output;
Return the MIDI output port.
loop
$loop = $rtc->loop;
Return the IO::Async::Loop.
filters
$filters = $rtc->filters;
Return or set the filters.
METHODS
new
$rtc = MIDI::RtController->new(verbose => 1);
Create a new MIDI::RtController
object.
send_it
$rtc->send_it($event);
Send a MIDI event to the output port.
delay_send
$rtc->delay_send($delay_time, $event);
Send a MIDI event to the output port when the delay_time expires.
run
$rtc->run;
Run the asynchronous loop!
add_filter
$rtc->add_filter($name, $event_type, $action);
Add a named filter, defined by the CODE reference action, for an event_type like note_on
or note_off
.
THANK YOU
This code would not exist without the help of CPAN's JBARRETT (John Barrett AKA fuzzix).
SEE ALSO
The eg/*.pl example program(s)
AUTHOR
Gene Boggs <gene.boggs@gmail.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2025 by Gene Boggs.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.