VSinOsc
Multidimensional sinusoidal video oscillator
See also: SinOsc
Description
VSinOsc, just like the audio UGen SinOsc UGen, is a sinusoidal oscillator. It can process inputs of one to four dimensions and produces an output in the same dimension. The arguments parallel the arguments used by SinOsc , with the only difference being that the default mul
and add
argument values are modified to support producing a sin output range within [0, 1]
instead of the audio range [-1, 1]
.
Supported Rates: frame, shape, pixel
Class Methods
VSinOsc.fr(freq: 1.0, phase: 0.0, mul: 0.5, add: 0.5)
VSinOsc.sr(freq: 1.0, phase: 0.0, mul: 0.5, add: 0.5)
VSinOsc.pr(freq: 1.0, phase: 0.0, mul: 0.5, add: 0.5)
Make a VSinOsc VGen at requested rate.
Arguments
freq
Oscillator frequency in cycles per second or Hz.
phase
Oscillator phase in radians.
mul
Multiplier to apply to oscillator output.
add
Value to add to oscillator output after multiply.
Dimensions
input |
output |
1, 1, 1, 1 |
1 |
2, 2, 2, 2 |
2 |
3, 3, 3, 3 |
3 |
4, 4, 4, 4 |
4 |
Examples
(
// This example demonstrates using the three-dimensional
// VSinOsc to produce separate red, green, and blue
// channel outputs. Note that all arguments have to be
// provided to the higher dimensional VSinOsc instances,
// because the defaults are only 1-dimensional, and
// Scintillator currently can't "autosplat" defaults to
// higher-dimensional arguments.
~k = ScinthDef.new(\k, { |dot = 0.5|
var r = VLength.pr(VNormPos.pr);
var rgb = VSinOsc.pr(VVec3.pr(r, 2.0 * r, 3.0 * r),
VVec3.pr, VSplat3.pr(0.5), VSplat3.pr(0.5));
VRGBOut.pr(VX.pr(rgb), VY.pr(rgb), VZ.pr(rgb));
}).add;
)
(
~t = Scinth.new(\k);
)
Last modified July 28, 2020: Update for a 0.0.7 Scintillator release (#5) (0177d81)