NAME

MIDI::RtController::Filter::Math - Math based RtController filters

VERSION

version 0.0105

SYNOPSIS

use curry;
use Future::IO::Impl::IOAsync;
use MIDI::RtController ();
use MIDI::RtController::Filter::Math ();

my $rtc = MIDI::RtController->new; # * input/output required

my $rtf = MIDI::RtController::Filter::Math->new(rtc => $rtc);

$rtc->add_filter('stair_step', note_on => $rtf->curry::stair_step);

$rtc->run;

DESCRIPTION

MIDI::RtController::Filter::Math is the collection of Math based MIDI::RtController filters.

ATTRIBUTES

rtc

$rtc = $rtf->rtc;

The required MIDI::RtController instance provided in the constructor.

channel

$channel = $rtf->channel;
$rtf->channel($number);

The current MIDI channel (0-15, drums=9).

Default: 0

delay

$delay = $rtf->delay;
$rtf->delay($number);

The current delay time.

Default: 0.1 seconds

feedback

$feedback = $rtf->feedback;
$rtf->feedback($number);

The amount of feedback.

Default: 3

up

$up = $rtf->up;
$rtf->up($number);

The upward movement steps.

Default: 2

down

$down = $rtf->down;
$rtf->down($number);

The downward movement steps.

Default: -1

METHODS

All filter methods must accept the object, a delta-time, and a MIDI event ARRAY reference, like:

sub stair_step ($self, $dt, $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.

SEE ALSO

Moo

Types::Standard

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.