NAME
Peta::Synth::Profile - what a piece will cost to render, second by second, before it is rendered
VERSION
version 0.2610180
SYNOPSIS
use Peta::Synth::Profile;
my $profile = Peta::Synth::Profile->new(timeline => \@events, length => $seconds);
my $costs = Peta::Synth::Profile::calibrate(engine => $engine);
for my $s (@{ $profile->predict($costs, 1) }) { printf "%4d s %.2f\n", $s->{at}, $s->{load} }
my $notes = $profile->notes; # the notes it plays, most seconds first
DESCRIPTION
A piece's voices are known before it sounds: "foresee" in Peta::Synth::Synth runs its events as rendering does, without rendering, and each voice says when it will fall silent ("ends" in Peta::Synth::Voice). What sounds at each moment, and the costs of an engine measured, say how long each second of it takes to render: where it keeps up with real time and where not, and which notes are worth preparing ahead.
The cost model: a quantum (1024 samples) costs the synthesizer's own work (events, mixing, reverb, limiter), and each voice in it its controls and what it is made of: its partials (more under a moving filter), its string, its FM, its bands of noise.
METHODS
new
new(timeline => \@events, length => $s, tail => 30, rate => 48000, partials => 48, bank => ..., waves => 1): the piece's voices, each { start, end, channel, program, key, velocity, partials, copies, filter, string, fm, bands } (seconds; program undef on the drums; partials those turned one by one, copies those read from wave sequences), to where rendering would stop (length and tail). waves as Peta::Synth::Synth takes it: a store given is filled with the sequences the piece needs (made ahead).
voices, seconds
The voices; where the events end (seconds).
load
load($step = 1): for each step, the mean of what sounds: { at, voices, partials, filtered, strings, fm, bands }.
predict
predict($costs, $step = 1): [ { at, load } ], the seconds of rendering a second of sound takes at each step (1: just in real time).
notes
The notes played, { program, key, velocity, count, seconds }, most seconds first.
programs, drums
The programs the piece plays, and its drums (their keys), each once, in order.
measure
measure($engine, $step = 1): the piece rendered by the engine as Peta::Synth plays it, the seconds each step took: [ { at, load } ].
FUNCTIONS
calibrate
calibrate(engine => $engine, rate => 48000, programs => [...], drums => [...], waves => 1): the engine's costs in seconds a quantum: { engine, quantum, voice, partial, filter, copy, string, fm, band, programs => { n => ... }, drums => { key => ... } }.
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.