|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.beadsproject.beads.core.Bead
net.beadsproject.beads.core.UGen
net.beadsproject.beads.ugens.RandomPWM
public class RandomPWM
A simple random-length pulse wave modulator. This UGen generates constant
pulses of lengths randomly distributed between a minimum length and a maximum
length (specified in samples). Additionally, the distribution of the randomly
controlled by setting the pulse length exponent parameter (see
setLengthExponent
).
A RandomPWM instance has three modes:
ALTERNATING
(default) - pulses alternate between -1 and 1.PULSING
(default) - pulses alternate between 0 and 1.NOISE
- pulses are distributed continuously between -1 and 1.SAW
- for random-length ramps between -1 and 1.RAMPED_NOISE
- for random-length ramps between random values between -1 and 1.NOISE_ENVELOPE
- for random-length ramps between random values between 0 and 1.
Nested Class Summary | |
---|---|
static class |
RandomPWM.Mode
|
Nested classes/interfaces inherited from class net.beadsproject.beads.core.UGen |
---|
UGen.OutputInitializationRegime, UGen.OutputPauseRegime |
Field Summary | |
---|---|
static RandomPWM.Mode |
ALTERNATING
|
protected float |
baseVal
|
protected float |
count
|
protected float |
lengthDiff
|
protected float |
lengthExponent
|
protected float |
maxLength
|
protected float |
minLength
|
protected RandomPWM.Mode |
mode
|
static RandomPWM.Mode |
NOISE
|
static RandomPWM.Mode |
NOISE_ENVELOPE
|
protected float |
pulseLen
|
static RandomPWM.Mode |
PULSING
|
static RandomPWM.Mode |
RAMPED_NOISE
|
static RandomPWM.Mode |
SAW
|
protected float |
targetVal
|
protected float |
valDiff
|
Fields inherited from class net.beadsproject.beads.core.UGen |
---|
bufferSize, bufIn, bufOut, context, ins, outputInitializationRegime, outputPauseRegime, outs |
Constructor Summary | |
---|---|
RandomPWM(AudioContext context,
RandomPWM.Mode mode,
float minl,
float maxl)
Constructor specifying mode, and minumum and maximum pulse lengths. |
|
RandomPWM(AudioContext context,
RandomPWM.Mode mode,
float minl,
float maxl,
float lexp)
Constructor specifying all parameters |
Method Summary | |
---|---|
void |
calculateBuffer()
Called by the signal chain to update this UGen's ouput data. |
protected void |
calcVals()
|
float |
getLengthExponent()
Gets the pulse length exponent. |
float |
getMaxLength()
Gets the maximum pulse length. |
float |
getMinLength()
Gets the minimum pulse length. |
RandomPWM.Mode |
getMode()
Gets the pulse mode. |
DataBead |
getParams()
Gets a DataBead filled with properties corresponding to this object's parameters. |
void |
messageReceived(Bead message)
Responds to an incoming message. |
DataBeadReceiver |
sendData(DataBead db)
Use the properties "mode", "minLength", "maxLength", and "lengthExponent" to set the corresponding parameters (type Mode for "mode", floats only for the others). |
RandomPWM |
setLengthExponent(float lexp)
Sets the pulse length exponent. |
RandomPWM |
setMaxLength(float maxl)
Sets the maximum pulse length. |
RandomPWM |
setMinLength(float minl)
Sets the minimum pulse length. |
RandomPWM |
setMode(RandomPWM.Mode mode)
Sets the pulse mode. |
RandomPWM |
setParams(float minl,
float maxl,
float lexp)
Sets the minimum pulse length, maximum pulse length, and pulse length exponent. |
RandomPWM |
setParams(RandomPWM.Mode mode,
float minl,
float maxl,
float lexp)
Sets the pulse mode (see setMode ), minimum pulse
length, maximum pulse length, and pulse length exponent. |
Methods inherited from class net.beadsproject.beads.core.UGen |
---|
addDependent, addInput, addInput, clearDependents, clearInputConnections, containsInput, crossfadeInput, getConnectedInputs, getContext, getEnvelopes, getIns, getNumberOfConnectedUGens, getNumberOfDependents, getOutBuffer, getOuts, getTimeTakenLastUpdate, getValue, getValue, getValueDouble, getValueDouble, initializeOuts, isTimerMode, isUpdated, noInputs, pause, printInBuffers, printInputList, printOutBuffers, removeAllConnections, removeConnection, removeDependent, setOutsToPause, setTimerMode, setValue, update, zeroIns, zeroOuts |
Methods inherited from class net.beadsproject.beads.core.Bead |
---|
getKillListener, getName, isDeleted, isPaused, kill, message, setKillListener, setName, start, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final RandomPWM.Mode ALTERNATING
public static final RandomPWM.Mode NOISE
public static final RandomPWM.Mode PULSING
public static final RandomPWM.Mode SAW
public static final RandomPWM.Mode RAMPED_NOISE
public static final RandomPWM.Mode NOISE_ENVELOPE
protected RandomPWM.Mode mode
protected float targetVal
protected float baseVal
protected float valDiff
protected float count
protected float pulseLen
protected float minLength
protected float maxLength
protected float lengthExponent
protected float lengthDiff
Constructor Detail |
---|
public RandomPWM(AudioContext context, RandomPWM.Mode mode, float minl, float maxl)
context
- The audio context.mode
- The pulse mode; see setMode
.minl
- The minimum pulse length.maxl
- The maximum pulse length.public RandomPWM(AudioContext context, RandomPWM.Mode mode, float minl, float maxl, float lexp)
context
- The audio context.mode
- The pulse mode; see setMode
.minl
- The minimum pulse length.maxl
- The maximum pulse length.lexp
- The pulse length exponent.Method Detail |
---|
public void calculateBuffer()
UGen
UGen.bufIn
and putting data
into UGen.bufOut
in some way. UGen.bufIn
and UGen.bufOut
are 2D arrays of floats of the form float[numChannels][bufferSize]. The length of the buffers is given by
UGen.bufferSize
, and the number of channels of the input and output buffers are given by UGen.ins
and UGen.outs
respectively.
calculateBuffer
in class UGen
protected void calcVals()
public RandomPWM setParams(RandomPWM.Mode mode, float minl, float maxl, float lexp)
setMode
), minimum pulse
length, maximum pulse length, and pulse length exponent.
mode
- The pulse mode.minl
- The minimum pulse length.maxl
- The maximum pulse length.lexp
- The pulse length exponent.public RandomPWM setParams(float minl, float maxl, float lexp)
minl
- The minimum pulse length.maxl
- The maximum pulse length.lexp
- The pulse length exponent.public RandomPWM setMinLength(float minl)
minl
- The minimum pulse length.public float getMinLength()
public RandomPWM setMaxLength(float maxl)
maxl
- The maximum pulse length.public float getMaxLength()
public RandomPWM setLengthExponent(float lexp)
lexp
- The pulse length exponent.public float getLengthExponent()
setLengthExponent(float)
public RandomPWM setMode(RandomPWM.Mode mode)
ALTERNATING
for pulses that alternate between -1 and 1.PULSING
for pulses that alternate between 0 and 1.NOISE
for pulses distributed randomly between -1 and 1.SAW
for random-length ramps between -1 and 1.RAMPED_NOISE
for random-length ramps between random
values.
mode
- The pulse mode.public RandomPWM.Mode getMode()
setMode(Mode)
public DataBeadReceiver sendData(DataBead db)
sendData
in interface DataBeadReceiver
db
- The DataBead message.
this
.public void messageReceived(Bead message)
Bead
messageReceived
in class Bead
message
- the messagepublic DataBead getParams()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |