public class UGen extends Object implements Constants, GraphElem
Control
), therefore
to construct a ugen graph requires you to make successive calls
to the static constructor methods provided by this class. See
SynthDef
and JColliderDemo
for examples
of how to construct a graph.
When you use the static constructor methods of UGen
,
the class relies on the UGen database to be loaded into UGenInfo
.
Please see the UGenInfo
doc for details about this database.
While some methods like array( ... )
would better
fit into the GraphElemArray
class, they have been included
here, simply because it's shorter to write UGen.array( ... )
and it gives your code a more homogeneous and pathological look.
To access a single output of a multi-output UGen, use either the
getOutput
or getChannel
method. To create
controls, use the separate Control
class.
kAddAfter, kAddBefore, kAddReplace, kAddToHead, kAddToTail, kAudioRate, kControlRate, kDemandRate, kDoneFree, kDoneFreeAll, kDoneFreeAllPred, kDoneFreeAllSucc, kDoneFreeGroup, kDoneFreePausePred, kDoneFreePauseSucc, kDoneFreePred, kDoneFreePredGroup, kDoneFreePredGroupDeep, kDoneFreeSucc, kDoneFreeSuccGroup, kDoneFreeSuccGroupDeep, kDoneNothing, kDonePause, kDumpBoth, kDumpHex, kDumpOff, kDumpText, kHeaderAIFF, kHeaderIRCAM, kHeaderNeXT, kHeaderRaw, kHeaderWAVE, kSampleALaw, kSampleDouble, kSampleFloat, kSampleInt16, kSampleInt24, kSampleInt32, kSampleInt8, kSampleMuLaw, kScalarRate
Modifier | Constructor and Description |
---|---|
protected |
UGen(String name,
Object rate,
Object[] outputRates,
UGenInput[] inputs,
int specialIndex)
This constructor is used by
SynthDef
when building the UGen from a def file. |
Modifier and Type | Method and Description |
---|---|
static GraphElem |
ar(String name)
Constructs a new audio rate UGen
with zero arguments.
|
static GraphElem |
ar(String name,
GraphElem in1)
Constructs a new audio rate UGen
with one given argument
|
static GraphElem |
ar(String name,
GraphElem in1,
GraphElem in2) |
static GraphElem |
ar(String name,
GraphElem in1,
GraphElem in2,
GraphElem in3) |
static GraphElem |
ar(String name,
GraphElem in1,
GraphElem in2,
GraphElem in3,
GraphElem in4) |
static GraphElem |
ar(String name,
GraphElem in1,
GraphElem in2,
GraphElem in3,
GraphElem in4,
GraphElem in5) |
static GraphElem |
ar(String name,
GraphElem in1,
GraphElem in2,
GraphElem in3,
GraphElem in4,
GraphElem in5,
GraphElem in6) |
static GraphElem |
ar(String name,
int numChannels)
Constructs a new audio rate UGen
with zero arguments and a required explict
output channel number.
|
static GraphElem |
ar(String name,
int numChannels,
GraphElem in1)
Constructs a new audio rate UGen
with one given argument and an explicit
number of output channels.
|
static GraphElem |
ar(String name,
int numChannels,
GraphElem in1,
GraphElem in2) |
static GraphElem |
ar(String name,
int numChannels,
GraphElem in1,
GraphElem in2,
GraphElem in3) |
static GraphElem |
ar(String name,
int numChannels,
GraphElem in1,
GraphElem in2,
GraphElem in3,
GraphElem in4) |
static GraphElem |
ar(String name,
int numChannels,
GraphElem in1,
GraphElem in2,
GraphElem in3,
GraphElem in4,
GraphElem in5) |
static GraphElem |
array(GraphElem g1,
GraphElem g2)
Assembles two graph elements (such as UGens,
or Constants) into one array which in turn
can be used for multichannel expansion when passed
as an argument to one of the UGen constructor
methods
|
static GraphElem |
array(GraphElem g1,
GraphElem g2,
GraphElem g3)
Assembles three graph elements (such as UGens,
or Constants) into one array which in turn
can be used for multichannel expansion when passed
as an argument to one of the UGen constructor
methods
|
static GraphElem |
array(GraphElem g1,
GraphElem g2,
GraphElem g3,
GraphElem g4)
Assembles four graph elements (such as UGens,
or Constants) into one array which in turn
can be used for multichannel expansion when passed
as an argument to one of the UGen constructor
methods
|
static GraphElem |
array(GraphElem g1,
GraphElem g2,
GraphElem g3,
GraphElem g4,
GraphElem g5)
Assembles five graph elements (such as UGens,
or Constants) into one array which in turn
can be used for multichannel expansion when passed
as an argument to one of the UGen constructor
methods
|
UGenInput[] |
asUGenInputs() |
static GraphElem |
dr(String name) |
static GraphElem |
dr(String name,
GraphElem in1) |
static GraphElem |
dr(String name,
GraphElem in1,
GraphElem in2) |
static GraphElem |
dr(String name,
GraphElem in1,
GraphElem in2,
GraphElem in3) |
static GraphElem |
dr(String name,
GraphElem in1,
GraphElem in2,
GraphElem in3,
GraphElem in4) |
static GraphElem |
dr(String name,
GraphElem in1,
GraphElem in2,
GraphElem in3,
GraphElem in4,
GraphElem in5) |
static GraphElem |
dr(String name,
int numChannels)
"dr" stands for demand-rate
|
static GraphElem |
dr(String name,
int numChannels,
GraphElem in1) |
static GraphElem |
dr(String name,
int numChannels,
GraphElem in1,
GraphElem in2) |
static GraphElem |
dr(String name,
int numChannels,
GraphElem in1,
GraphElem in2,
GraphElem in3) |
static GraphElem |
dr(String name,
int numChannels,
GraphElem in1,
GraphElem in2,
GraphElem in3,
GraphElem in4) |
static GraphElem |
dr(String name,
int numChannels,
GraphElem in1,
GraphElem in2,
GraphElem in3,
GraphElem in4,
GraphElem in5) |
String |
dumpName()
Returns a string representation of the UGen.
|
UGenChannel |
getChannel(int ch) |
UGenInput |
getInput(int index)
Returns the UGen's input at the given index.
|
UGenInput[] |
getInputs()
Returns an array of the UGen's inputs.
|
String |
getName()
Returns the class name of the UGen.
|
int |
getNumInputs()
Returns the number of input arguments.
|
int |
getNumOutputs() |
GraphElem |
getOutput(int idx) |
Object |
getOutputRate(int channel)
Returns the rate of one of the UGens output channels.
|
Object[] |
getOutputRates()
Returns an array of the rates at which the individual
output channels run.
|
Object |
getRate()
Returns the rate at which this UGen is running
|
int |
getSpecialIndex()
Returns the so-called special index of the UGen.
|
static GraphElem |
ir(float value)
A shorthand method for creating a constant
in the ugen graph.
|
static GraphElem |
ir(String name) |
static GraphElem |
ir(String name,
GraphElem in1) |
static GraphElem |
ir(String name,
GraphElem in1,
GraphElem in2) |
static GraphElem |
ir(String name,
GraphElem in1,
GraphElem in2,
GraphElem in3) |
static GraphElem |
ir(String name,
GraphElem in1,
GraphElem in2,
GraphElem in3,
GraphElem in4) |
static GraphElem |
ir(String name,
GraphElem in1,
GraphElem in2,
GraphElem in3,
GraphElem in4,
GraphElem in5) |
static GraphElem |
ir(String name,
int numChannels) |
static GraphElem |
ir(String name,
int numChannels,
GraphElem in1) |
static GraphElem |
ir(String name,
int numChannels,
GraphElem in1,
GraphElem in2) |
static GraphElem |
ir(String name,
int numChannels,
GraphElem in1,
GraphElem in2,
GraphElem in3) |
static GraphElem |
ir(String name,
int numChannels,
GraphElem in1,
GraphElem in2,
GraphElem in3,
GraphElem in4) |
static GraphElem |
ir(String name,
int numChannels,
GraphElem in1,
GraphElem in2,
GraphElem in3,
GraphElem in4,
GraphElem in5) |
static GraphElem |
kr(String name) |
static GraphElem |
kr(String name,
GraphElem in1) |
static GraphElem |
kr(String name,
GraphElem in1,
GraphElem in2) |
static GraphElem |
kr(String name,
GraphElem in1,
GraphElem in2,
GraphElem in3) |
static GraphElem |
kr(String name,
GraphElem in1,
GraphElem in2,
GraphElem in3,
GraphElem in4) |
static GraphElem |
kr(String name,
GraphElem in1,
GraphElem in2,
GraphElem in3,
GraphElem in4,
GraphElem in5) |
static GraphElem |
kr(String name,
GraphElem in1,
GraphElem in2,
GraphElem in3,
GraphElem in4,
GraphElem in5,
GraphElem in6) |
static GraphElem |
kr(String name,
int numChannels) |
static GraphElem |
kr(String name,
int numChannels,
GraphElem in1) |
static GraphElem |
kr(String name,
int numChannels,
GraphElem in1,
GraphElem in2) |
static GraphElem |
kr(String name,
int numChannels,
GraphElem in1,
GraphElem in2,
GraphElem in3) |
static GraphElem |
kr(String name,
int numChannels,
GraphElem in1,
GraphElem in2,
GraphElem in3,
GraphElem in4) |
static GraphElem |
kr(String name,
int numChannels,
GraphElem in1,
GraphElem in2,
GraphElem in3,
GraphElem in4,
GraphElem in5) |
protected void |
setSpecialIndex(int idx)
This is called by
SynthDef when assembling
controls. |
public Object getRate()
kAudioRate
, kControlRate
,
kDemandRate
or kScalarRate
public Object[] getOutputRates()
public Object getOutputRate(int channel)
public UGenInput[] getInputs()
public UGenInput getInput(int index)
Out
, each element of the
channelsArray
argument is a separate
input with a separate index (as you would expect
from the binary compiled synth def format).public int getSpecialIndex()
BinaryOpUGen
and UnaryOpUGen
to specify the mathematical operator,
and by Control
to specify the index in
the control name table. Note that this index is invalid
for Control
until the graph has been constructed
by SynthDef
.protected void setSpecialIndex(int idx)
SynthDef
when assembling
controls. Do not call this method directly.
To create unary and binary operator ugens, simply
construct them with their operator name and the
ugen factory will set the right index itself. So to
create a multiplying binary ugen, you will call:
UGen.ar( "*", firstUGen, secondUGen );and not
UGen myBin = UGen.ar( "BinaryOpUGen", firstUGen, secondUGen ); myBin.setSpecialIndex( 2 );
public int getNumInputs()
Out
UGen with three input channels will report
4
(three inputs plus bus parameter).public int getNumOutputs()
getNumOutputs
in interface GraphElem
public UGenInput[] asUGenInputs()
asUGenInputs
in interface GraphElem
public UGenChannel getChannel(int ch)
public String getName()
UGen
in the UGenInfo
dictionary.UGenInfo.infos
public String dumpName()
public static GraphElem ar(String name, int numChannels)
LocalIn.ar
.
This method can also be used for UGens with more
than zero arguments, if the info dictionary contains
default values for the missing arguments. An example
is BufRd
which actually has four arguments
for bufNum, phase, loop and interolation, but specifies
defaults for all of them (bufNum 0, phase zero, loop 1, interpolation 2).
name
- either ugen class name or
alias name (for unary/binary op)numChannels
- number of output channels to createIllegalArgumentException
- if the UGen cannot be found in the info dictionary,
if the rate is not allowed for the ugenIllegalStateException
- if the UGens requires arguments
which have not been provided and have no default valuespublic static GraphElem ar(String name)
This method can also be used for UGens with more
than zero arguments, if the info dictionary contains
default values for the missing arguments. An example
is SinOsc
which actually has two arguments
for frequency and phase, but both of them have default
values (440 hertz, zero degrees phase).
name
- either ugen class name or
alias name (for unary/binary op)IllegalArgumentException
- if the UGen cannot be found in the info dictionary,
if the rate is not allowed for the ugen,
or if the UGen requires the explicit specification of the
number of output channelsIllegalStateException
- if the UGens requires arguments
which have not been provided and have no default valuespublic static GraphElem ar(String name, int numChannels, GraphElem in1)
PanAz.ar
.
This method can also be used for UGens with more
than one argument (e.g. PanAz
), if the info
dictionary contains
default values for the missing arguments. For example,
PanAz
has five arguments, the first one
being the input signal which needs to specified, but
the other ones having default values (pos 0.0, level 1.0, width 2.0, orientation 0.5).
name
- either ugen class name or
alias name (for unary/binary op)numChannels
- number of output channels to createin1
- first input argumentIllegalArgumentException
- if the UGen cannot be found in the info dictionary,
if the rate is not allowed for the ugenIllegalStateException
- if the UGens requires arguments
which have not been provided and have no default valuespublic static GraphElem ar(String name, GraphElem in1)
This method can also be used for UGens with more
than one argument (e.g. Osc
), if the info
dictionary contains
default values for the missing arguments.
name
- either ugen class name or
alias name (for unary/binary op)in1
- first input argumentIllegalArgumentException
- if the UGen cannot be found in the info dictionary,
if the rate is not allowed for the ugen,
or if the UGen requires the explicit specification of the
number of output channelsIllegalStateException
- if the UGens requires arguments
which have not been provided and have no default valuespublic static GraphElem ar(String name, int numChannels, GraphElem in1, GraphElem in2, GraphElem in3)
public static GraphElem ar(String name, int numChannels, GraphElem in1, GraphElem in2, GraphElem in3, GraphElem in4)
public static GraphElem ar(String name, GraphElem in1, GraphElem in2, GraphElem in3, GraphElem in4)
public static GraphElem ar(String name, int numChannels, GraphElem in1, GraphElem in2, GraphElem in3, GraphElem in4, GraphElem in5)
public static GraphElem ar(String name, GraphElem in1, GraphElem in2, GraphElem in3, GraphElem in4, GraphElem in5)
public static GraphElem ar(String name, GraphElem in1, GraphElem in2, GraphElem in3, GraphElem in4, GraphElem in5, GraphElem in6)
public static GraphElem kr(String name, int numChannels, GraphElem in1, GraphElem in2, GraphElem in3)
public static GraphElem kr(String name, int numChannels, GraphElem in1, GraphElem in2, GraphElem in3, GraphElem in4)
public static GraphElem kr(String name, GraphElem in1, GraphElem in2, GraphElem in3, GraphElem in4)
public static GraphElem kr(String name, int numChannels, GraphElem in1, GraphElem in2, GraphElem in3, GraphElem in4, GraphElem in5)
public static GraphElem kr(String name, GraphElem in1, GraphElem in2, GraphElem in3, GraphElem in4, GraphElem in5)
public static GraphElem kr(String name, GraphElem in1, GraphElem in2, GraphElem in3, GraphElem in4, GraphElem in5, GraphElem in6)
public static GraphElem dr(String name, int numChannels, GraphElem in1, GraphElem in2, GraphElem in3)
public static GraphElem dr(String name, int numChannels, GraphElem in1, GraphElem in2, GraphElem in3, GraphElem in4)
public static GraphElem dr(String name, GraphElem in1, GraphElem in2, GraphElem in3, GraphElem in4)
public static GraphElem dr(String name, int numChannels, GraphElem in1, GraphElem in2, GraphElem in3, GraphElem in4, GraphElem in5)
public static GraphElem dr(String name, GraphElem in1, GraphElem in2, GraphElem in3, GraphElem in4, GraphElem in5)
public static GraphElem ir(float value)
new Constant( value )
.public static GraphElem ir(String name, int numChannels, GraphElem in1, GraphElem in2, GraphElem in3)
public static GraphElem ir(String name, int numChannels, GraphElem in1, GraphElem in2, GraphElem in3, GraphElem in4)
public static GraphElem ir(String name, GraphElem in1, GraphElem in2, GraphElem in3, GraphElem in4)
public static GraphElem ir(String name, int numChannels, GraphElem in1, GraphElem in2, GraphElem in3, GraphElem in4, GraphElem in5)
public static GraphElem ir(String name, GraphElem in1, GraphElem in2, GraphElem in3, GraphElem in4, GraphElem in5)
public static GraphElem array(GraphElem g1, GraphElem g2)
g1
- first graph element such as a UGen
, Constant
,
UGenChannel
or GraphElemArray
g2
- second graph elementpublic static GraphElem array(GraphElem g1, GraphElem g2, GraphElem g3)
g1
- first graph elementg2
- second graph elementg3
- third graph elementpublic static GraphElem array(GraphElem g1, GraphElem g2, GraphElem g3, GraphElem g4)
g1
- first graph elementg2
- second graph elementg3
- third graph elementg4
- fourth graph elementpublic static GraphElem array(GraphElem g1, GraphElem g2, GraphElem g3, GraphElem g4, GraphElem g5)
g1
- first graph elementg2
- second graph elementg3
- third graph elementg4
- fourth graph elementg5
- fifth graph elementCopyright © 2015–2022 SciJava. All rights reserved.