Automation
In many cases, we will want to have some kind of DAW-style automation of certain parameters when generating or processing audio in our scripts. One way of doing this is through breakpoint functions — numeric lists that describe a certain shape or trajectory. This tutorial shows the different syntaxes available in bellplay~ for specifying breakpoint functions.
automation.bell
## duration value for all buffers
$dur = 2000;
## frequency envelope, in equi-distant linear syntax
$fq = 220 440 330 220;
## generate and transcribe sinusoidal oscillator buffer
cycle(
@frequency $fq @duration $dur
).transcribe();
## add marker to match start of sinusoidal oscillator
addmarker(
@onset 0 @names 'sinusoidal'
);
## ----------------------------------------------
## frequency envelope, in wrapped xy-pair syntax
$fq = [0 220] [1 440] [3 220];
## generate and transcribe triangular wave oscillator buffer
tri(
@frequency $fq @duration $dur
).transcribe(@onset $dur);
## another marker matching start of triangular wave oscillator
addmarker(
@onset $dur @names 'triangular'
);
## ----------------------------------------------
## wrapped xy-slope tuples (linear)
$fq = [0 220 0] [1 440 0] [3 220 0];
## generate and transcribe square wave oscillator buffer
rect(
@frequency $fq @duration $dur
).transcribe(@onset $dur * 2);
## third marker matching start of square wave oscillator
addmarker($dur * 2, 'square');
## ----------------------------------------------
## wrapped xy-slope tuples (with curves)
$fq = [0 220 0] [1 440 0.5] [3 220 -0.5];
## generate and transcribe sawtooth wave oscillator buffer
saw(
@frequency $fq @duration $dur
).transcribe(@onset $dur * 3 @gain .125);
## last marker matching start of sawtooth wave oscillator
addmarker($dur * 3, 'sawtooth — has curved envelope');
## render everything
render(@play 1)