NAME
MIDI::RtController::Filter::Tonal - Tonal RtController filters
VERSION
version 0.0401
SYNOPSIS
use curry;
use MIDI::RtController ();
use MIDI::RtController::Filter::Tonal ();
my $rtc = MIDI::RtController->new(
input => 'keyboard',
output => 'usb',
);
my $filter = MIDI::RtController::Filter::Tonal->new(rtc => $rtc);
$rtc->add_filter('pedal', note_on => $filter->curry::pedal_tone);
$rtc->run;
DESCRIPTION
MIDI::RtController::Filter::Tonal
is the collection of tonal MIDI::RtController filters.
ATTRIBUTES
pedal
$pedal = $filter->pedal;
$filter->pedal($note);
The note used by the pedal-tone filter.
Default: 55
Which is the MIDI-number for G below middle-C.
delay
$delay = $filter->delay;
$filter->delay($number);
The current delay time.
Default: 0.1
seconds
factor
$factor = $filter->factor;
$filter->factor($number);
This is a generic number that can be used in a calculation, like the "delay_tone" filter.
Default: undef
velocity
$velocity = $filter->velocity;
$filter->velocity($number);
The velocity (or volume) change increment (0-127).
Default: 10
feedback
$feedback = $filter->feedback;
$filter->feedback($number);
The feedback.
Default: 1
offset
$offset = $filter->offset;
$filter->offset($number);
The note offset number.
Default: -12
key
$key = $filter->key;
$filter->key($number);
The musical key (C-B
).
scale
$scale = $filter->scale;
$filter->scale($name);
The name of the musical scale.
intervals
$intervals = $filter->intervals;
$filter->intervals(\@intervals);
The voice intervals used by the walk_tone
filter.
arp
$arp = $filter->arp;
$filter->arp(\@notes);
A list of MIDI numbered pitches used by the arp_tone
and walk_tone
filters.
arp_types
$arp_types = $filter->arp_types;
$filter->arp_types(\@strings);
A list of known arpeggiation types. This is an Array::Circular instance.
Default: [up, down, random]
arp_type
$arp_type = $filter->arp_type;
$filter->arp_type($string);
The current arpeggiation type.
Default: up
METHODS
new
$filter = MIDI::RtController::Filter::CC->new(%arguments);
Return a new MIDI::RtController::Filter::CC
object.
UTILITIES
add_filters
MIDI::RtController::Filter::Tonal::add_filters(\@filters, $controllers);
Add an array reference of filters to controller instances. For example:
[
{ port => 'keyboard',
event => [qw(note_on note_off)],
type => 'delay_tone',
delay => 0.15,
},
...
]
In this list, port
is required, and event
is optional. These keys are metadata, and all others are assumed to be object attributes to set.
FILTERS
All filter methods must accept the object, a MIDI device name, a delta-time, and a MIDI event ARRAY reference, like:
sub pedal_tone ($self, $name, $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.
pedal_tone
Play a series of notes in succession by delay.
Default: pedal, $note, $note + 7 semitones
Where pedal is the object attribute.
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 factor attribute is set, this is multiplied by the delay time before being sent to a MIDI output.
chord_tone
Play a diatonic chord based on the given event note, key and scale attributes.
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.
delay_tone
Play a delayed note, or series of notes, based on the given event note, and the delay and feedback attributes.
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 factor attribute is set, this is multiplied by the delay time before being sent to a MIDI output.
offset_tone
Play a note and an offset note given the offset value.
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.
walk_tone
Play a chaotically walking, quasi-melody starting with the event note. The number of notes in the "melody" is the feedback setting.
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 factor attribute is set, this is multiplied by the delay time before being sent to a MIDI output.
arp_tone
Play a series of subsequently pressed notes based on the feedback setting.
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 factor attribute is set, this is multiplied by the delay time before being sent to a MIDI output.
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.