NAME

MIDI::RtController::Filter::Tonal - Tonal RtController filters

VERSION

version 0.0203

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

rtc

$rtc = $filter->rtc;

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

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.

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

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 Music::VoiceGen and the chord_tone filter.

arp

$arp = $filter->arp;
$filter->arp(\@notes);

The list of MIDI numbered pitches used by the arp_tone filter.

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

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

pedal, $note, $note + 7

Where the pedal is the object attribute.

chord_tone

Play a diatonic chord based on the given event note, key and scale attributes.

delay_tone

Play a delayed note, or series of notes, based on the given event note, and the delay and feedback attributes.

offset_tone

Play a note and an offset note given the offset value.

walk_tone

Play a chaotically walking, quasi-melody starting with the event note. The number of notes in the "melody" is the feedback setting.

arp_tone

Play a series of subsequently pressed notes based on the feedback setting.

SEE ALSO

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

MIDI::RtController::Filter::Drums

MIDI::RtController::Filter::Math

MIDI::RtController::Filter::CC

Array::Circular

List::SomeUtils

List::Util

MIDI::RtMidi::ScorePlayer

Moo

Music::Scales

Music::Chord::Note

Music::Note

Music::ToRoman

Music::VoiceGen

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.