Supex.Ugen (supex v0.1.1)
View SourceFor composing Oscillators and other SuperCollider's UGens (UnitGnerators).
examples
iex> import Supex.Ugen iex> osc() |> freq(690) |> phase(6) |> mul(0.9) |> add(0.69) |> name("y") %Supex.Ugen{add: 0.69, phase: 6, freq: 690, mul: 0.9, sc_command: "SinOsc.ar(freq: 690, phase: 6, mul: 0.9, add: 0.69);", sc_name: "y"}
iex> alias Supex.Ugen iex> Ugen.osc(%Supex.Ugen{add: 0.69, phase: 6, freq: 690, mul: 0.9}) %Supex.Ugen{add: 0.69, phase: 6, freq: 690, mul: 0.9, sc_command: "SinOsc.ar(freq: 690, phase: 6, mul: 0.9, add: 0.69);"}
Summary
Functions
Transforms a "normal" oscillator to a LFO.
Name the oscillator. SuperCollider only excepts single chars, like "y", "i"...
Adding play to the sc_command, and naming it for referencing.
Stop sc_command with name reference.
Functions
@spec lfo(%Supex.Ugen{ add: term(), freq: term(), lfo: term(), mul: term(), osc: term(), phase: term(), sc_command: term(), sc_name: term(), width: term() }) :: binary()
Transforms a "normal" oscillator to a LFO.
It uses kr
(control rate) instead of ar
(audio rate),
cf. https://doc.sccode.org/Tutorials/Getting-Started/05-Functions-and-Sound.html
Name the oscillator. SuperCollider only excepts single chars, like "y", "i"...
@spec play( binary() | %Supex.Ugen{ add: term(), freq: term(), lfo: term(), mul: term(), osc: term(), phase: term(), sc_command: term(), sc_name: term(), width: term() } ) :: <<_::64, _::_*8>>
Adding play to the sc_command, and naming it for referencing.
You can pass a %Ugen{} struct or a SuperCollider's command.
Supex and raw SuperCollider's command will by default refrenced with the variable "x".
For example, you can stop playing it with osc() |> name("x") |> stop()
@spec stop(%Supex.Ugen{ add: term(), freq: term(), lfo: term(), mul: term(), osc: term(), phase: term(), sc_command: term(), sc_name: term(), width: term() }) :: <<_::48, _::_*8>>
Stop sc_command with name reference.