NAME

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

VERSION

version 0.0300

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

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.

SEE ALSO

The eg/*.pl program(s) in this distribution

MIDI::RtController::Filter::Tonal

MIDI::RtController::Filter::Drums

MIDI::RtController::Filter::CC

Moo

Types::MIDI

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.