NAME
MIDI::RtController::Filter::Math - Math based RtController filters
VERSION
version 0.0302
SYNOPSIS
use curry;
use MIDI::RtController ();
use MIDI::RtController::Filter::Math ();
my $rtc = MIDI::RtController->new(
input => 'keyboard',
output => 'usb',
);
my $filter = MIDI::RtController::Filter::Math->new(rtc => $rtc);
$filter->control(1); # CC#01 = mod-wheel
$filter->channel(0);
$rtc->add_filter('stair_step', note_on => $filter->curry::stair_step);
$rtc->run;
DESCRIPTION
MIDI::RtController::Filter::Math
is the collection of Math based MIDI::RtController filters.
ATTRIBUTES
rtc
$rtc = $filter->rtc;
The required MIDI::RtController instance provided in the constructor.
channel
$channel = $filter->channel;
$filter->channel($number);
The current MIDI channel (0-15, drums=9).
Default: 0
value
$value = $filter->value;
$filter->value($number);
Return or set the MIDI event value. This is a generic setting that can be used by filters to set or retrieve state. This often a whole number between 0
and 127
, but can take any number.
Default: undef
trigger
$trigger = $filter->trigger;
$filter->trigger($number);
Return or set the trigger. This is a generic setting that can be used by filters to set or retrieve state. This often a whole number between 0
and 127
, but can take any number.
Default: undef
delay
$delay = $filter->delay;
$filter->delay($number);
The current delay time.
Default: 0.1
seconds
feedback
$feedback = $filter->feedback;
$filter->feedback($number);
The amount of feedback.
Default: 3
up
$up = $filter->up;
$filter->up($number);
The upward movement steps.
Default: 2
down
$down = $filter->down;
$filter->down($number);
The downward movement steps.
Default: -1
METHODS
All filter methods must accept the object, a MIDI device name, a delta-time, and a MIDI event ARRAY reference, like:
sub stair_step ($self, $device, $delta, $event) {
my ($event_type, $chan, $note, $value) = $event->@*;
...
return $boolean;
}
A filter also must return a boolean value. This tells MIDI::RtController to continue processing other known filters or not.
stair_step
Notes are played from the event note, in up-down, stair-step fashion.
If trigger or value is set, the filter checks those against the MIDI event note
or value
, respectively, to see if the filter should be applied.
SEE ALSO
The eg/*.pl program(s) in this distribution
MIDI::RtController::Filter::Tonal
MIDI::RtController::Filter::Drums
MIDI::RtController::Filter::CC
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.