NAME
MIDI::RtController::Filter::CC - Control-change based RtController filters
VERSION
version 0.1200
SYNOPSIS
use curry;
use MIDI::RtController ();
use MIDI::RtController::Filter::CC ();
my $controller = MIDI::RtController->new(
input => 'keyboard',
output => 'usb',
);
my $filter = MIDI::RtController::Filter::CC->new(rtc => $controller);
$filter->control(1); # CC#01 = mod-wheel
$filter->channel(0);
$filter->range_bottom(10);
$filter->range_top(100);
$filter->range_step(2);
$filter->time_step(0.25);
$controller->add_filter('breathe', all => $filter->curry::breathe);
$controller->run;
DESCRIPTION
MIDI::RtController::Filter::CC
is a (growing) collection of control-change based MIDI::RtController filters.
ATTRIBUTES
control
$control = $filter->control;
$filter->control($number);
Return or set the control change number between 0
and 127
.
Default: 1
(mod-wheel)
initial_point
$initial_point = $filter->initial_point;
$filter->initial_point($number);
Return or set the number of the initial point between 0
and 127
.
Default: 0
range_bottom
$range_bottom = $filter->range_bottom;
$filter->range_bottom($number);
The lowest number value between 0
and 127
.
Default: 0
range_top
$range_top = $filter->range_top;
$filter->range_top($number);
The highest number value between 0
and 127
.
Default: 127
range_step
$range_step = $filter->range_step;
$filter->range_step($number);
A number between 0
and 127
that is the current iteration step between the range_bottom and range_top.
Default: 1
time_step
$time_step = $filter->time_step;
$filter->time_step($number);
A (probably fractional) positive number that is the current iteration step in seconds.
Default: 0.25
(a quarter of a second)
step_up
$step_up = $filter->step_up;
$filter->step_up($number);
The current iteration upward step. This can be any whole number between 0
and 127
.
Default: 2
step_down
$step_down = $filter->step_down;
$filter->step_down($number);
The current iteration downward step. This can be any whole number between 0
and 127
.
Default: 1
METHODS
new
$filter = MIDI::RtController::Filter::CC->new(%arguments);
Return a new MIDI::RtController::Filter::CC
object.
UTILITIES
add_filters
MIDI::RtController::Filter::CC::add_filters(\@filters, $controllers);
Add an array reference of filters to controller instances. For example:
[
{ # mod-wheel
port => 'keyboard', # what device is controlling
type => 'breathe', # the type of filter
event => 'control_change', # or [qw(note_on note_off)] etc
control => 1, # the CC# is being controlled
trigger => 25, # the CC# that triggers the control
time_step => 0.25, # a module attribute parameter
},
...
]
In this list, port
and type
are required, and event
is optional. These keys are metadata, and all others are assumed to be object attributes to set.
The controllers come from "open_controllers" in MIDI::RtController and is a hash reference of MIDI::RtController
instances keyed by MIDI input device port names.
FILTERS
single
$control->add_filter('single', all => $filter->curry::single);
This filter sets a single control change message, over the MIDI channel.
If trigger is set, the filter checks that against the MIDI event note
to see if the filter should be applied.
clock_it
$control->add_filter('clock_it', all => $filter->curry::clock_it);
This filter sets the running flag and sends a clock message, over the MIDI channel, every iteration of time_step.
If the halt attribute is set to true, the running filter will stop.
breathe
$control->add_filter('breathe', all => $filter->curry::breathe);
This filter sets the running flag, then iterates between the range_bottom and range_top by range_step increments, sending a control change message, over the MIDI channel every iteration.
Passing all
means that any MIDI event will cause this filter to be triggered.
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.
If the halt attribute is set to true, the running filter will stop.
scatter
$control->add_filter('scatter', all => $filter->curry::scatter);
This filter sets the running flag, chooses a random number between the range_bottom and range_top, and sends that as the value of a control change message, over the MIDI channel, every iteration.
The initial_point is used as the first CC# message, then the randomization takes over.
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.
If the halt attribute is set to true, the running filter will stop.
stair_step
$control->add_filter('stair_step', all => $filter->curry::stair_step);
This filter sets the running flag, uses the initial_point for the fist CC# message, then adds step_up or subtracts step_down from that number successively, sending the value as a control change message, over the MIDI channel, every iteration.
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.
If the halt attribute is set to true, the running filter will stop.
ramp_up
$control->add_filter('ramp_up', all => $filter->curry::ramp_up);
This filter ramps-up a control change message, over the MIDI channel, from range_bottom until the range_top is reached.
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.
If the halt attribute is set to true, the running filter will stop.
ramp_down
$control->add_filter('ramp_down', all => $filter->curry::ramp_down);
This filter ramps-down a control change message, over the MIDI channel, from range_top until the range_bottom is reached.
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.
If the halt attribute is set to true, the running filter will stop.
flicker
$control->add_filter('flicker', all => $filter->curry::flicker);
This filter toggles a control change message, over the MIDI channel, between the range_bottom ("off") and the range_top ("on").
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.
If the halt attribute is set to true, the running filter will stop.
SEE ALSO
The eg/*.pl program(s) in this distribution
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.