Faust.compile
— Methodcompile(code; name="score", argv=[], target="", opt=-1)
Compiles code
to a DSPBlock
.
Arguments
argv::Vector{String}
: List of args to the Faust compiler, e.g. "-double": double precision "-vec": vectorize code.target::String
: target for which to build LLVM IR. Defaults to current machine.opt::Integer
: -1 is "highest level available".
Examples
julia> d = compile("import("stdfaust.lib"); process = os.osc(freq) : *(0.25) <: _, _;")
Faust.compute!
— Methodcompute!(d)
Computes d.block_size
samples of signal and returns d.outputs
(d.blocksize, noutputs).
d.inputs
should be assigned an incoming signals matrix of dims (d.blocksize, ninputs) before calling this function.
Examples
julia> d = init!(compile("import("stdfaust.lib"); process = os.oscs(440);"));
julia> compute!(d)
256×1 Matrix{Float32}:
1.0
0.99607
0.9882256
0.9764974
0.96093166
0.9415895
0.9185469
⋮
-0.99841714
-1.0004897
-0.9986304
-0.99284655
-0.98316085
-0.96961135
-0.9522513
Faust.init!
— Methodinit!(d; block_size=256, samplerate=44100)
Initializes the DSPBlock d
for use.
Must be called before compute!
. The old DSP instance will be deleted, so this can be called repeatedly and will reset internal states, etc.
Faust.setparams!
— Methodsetparams!(d, params)
Sets the parameters on d
using keys from params
.
One can extract the available params as UIRange structs from d.ui.ranges
after iniialization.
Examples
julia> d = init!(compile("process = nentry("v", 0, 0, 1, 0.001);"))
julia> d.ui.ranges
Dict{String, Faust.UIRange} with 1 entry:
"/score/v" => UIRange(0.0, 0.0, 1.0, 0.001)
julia> setparams!(d, Dict("/score/v" => 0.5f0))