omni
omni copied to clipboard
[RFC] Functional composition: chain
It'd be great if there was some way of connecting Omni code together with functional syntax, a la Faust
Perhaps, just as a way to chain things together:
Oscillators.omni:
process Sine:
ins 1
outs 1
init:
phase = 0
sample:
freq_incr = in1 / samplerate
out1 = sin(phase * twopi)
phase = (phase + freq_incr) % 1
process Saw:
ins 1
outs 1
init:
phase = 0
sample:
...
require "Oscillators.omni"
ins 1
outs 1
chain:
in1 + (abs(Sine(1)) * 100) -> Sine | Saw(in2)
A Sine
with range 0 - 100 controls frequency of another Sine
, plus in1
. A parallel Saw
is played out too.
Can chain
support defs
?
What about like variable assignments?
chain:
sine = Sine
[in1, in1 * 2] -> sine -> tanh
Gonna generate 2 distorted sine waves. Multichannel expansion in SC style?
How would it operate with outs
???
Feeback??
chain:
[in1 -> Sine] <<