NAME

Peta::Synth::Arpeggiator - the keys held, played one after another in a pattern

VERSION

version 0.2610180

SYNOPSIS

my $arp = Peta::Synth::Arpeggiator->new(rate => 48000, channel => 0,
    settings => { on => 1, mode => 'updown', rate => '1/16', tempo => 128, octaves => 2 });
$arp->press(60, 100, $now);
$arp->press(64, 100, $now);
my @events = $arp->events($now, $now + 512);    # [sample, event], ...

DESCRIPTION

What a channel's keys play when its arpeggiator is on ("arpeggiator" in Peta::Synth::Synth): one note a step, in a pattern of the keys held, at a tempo; the settings are listed at the top of the source. The patterns are those of Music::MelodicDevice::Arpeggiation (up, down, updown, random, converge, diverge, pedal_up, pedal_down, pedal_updown), and downup, played (as the keys came) and chord (all of them each step). The steps begin with the first key pressed and stop when none is held (latched: when another chord is pressed, the last goes on).

METHODS

new

new(rate => 48000, channel => 0, settings => {...}).

set, params, on

set(%fields) changes settings (an unknown one dies); params gives them all; on whether it is on.

press, release, stop

press($key, $velocity, $at) and release($key, $at), at a sample; stop($at) forgets every key and returns the note offs of what sounds.

events

events($from, $to): the notes it plays in those samples, as [sample, event] (note on and note off events, marked arp).

step, play

step($at): the step events marked (an arp_step), played at sample $at: its notes on, [sample, event], of the keys held then (their note offs kept for events); with no key held, the steps stop. play($from, $to): what it plays in [$from, $to) on its own, not in a synthesizer: the note events, [sample, event], in time order.

nrpn

nrpn($setting, $msb, $lsb): the setting MIDI steers with NRPN 0x7D (125) and data entry, as (name => value): 0 on, 1 the pattern (its place in the list above, from 0), 2 the rate (1/4, 1/8, 1/8T, 1/16, 1/16T, 1/32: 0 .. 5), 3 the tempo (beats a minute, CC6 and CC38 as 14 bits), 4 octaves, 5 gate (0 .. 127 of a step), 6 swing (0 .. 127 of half a step), 7 latch; on and latch from 64.

field_info, defaults

The settings as an editor shows them (name, min, max, scale, choices), and their defaults.

AUTHOR

PetaMem s.r.o. <info@petamem.com>

COPYRIGHT

Copyright (c) 2026 PetaMem s.r.o.

LICENSE

This package is free software, dual-licensed under the Artistic License 2.0 and the BSD 2-Clause License. See the LICENSE file of the distribution.