public class GranularSamplePlayer extends SamplePlayer
Sample
using granular synthesis. GranularSamplePlayer inherits its main behaviour from SamplePlayer
but replaces the direct Sample
lookup with a granular process.
UGen
s can be used to control playback rate, pitch, loop points, grain size, grain interval, grain randomness and position (this last case assumes that the playback rate is zero).Sample
SamplePlayer.EnvelopeType, SamplePlayer.InterpolationType, SamplePlayer.LoopType
UGen.OutputInitializationRegime, UGen.OutputPauseRegime
Modifier and Type | Field and Description |
---|---|
protected float |
pitch
The pitch, bound to the pitch envelope.
|
ADAPTIVE_INTERP_HIGH_THRESH, ADAPTIVE_INTERP_LOW_THRESH, envelopeType, forwards, frame, interpolationType, killOnEnd, loopCrossFade, loopEnd, loopEndEnvelope, loopStart, loopStartEnvelope, loopType, position, positionEnvelope, positionIncrement, rate, rateEnvelope, sample, startLoop
bufferSize, bufIn, bufOut, context, ins, outputInitializationRegime, outputPauseRegime, outs
Constructor and Description |
---|
GranularSamplePlayer(AudioContext context,
int outs)
Instantiates a new GranularSamplePlayer.
|
GranularSamplePlayer(AudioContext context,
Sample buffer)
Instantiates a new GranularSamplePlayer.
|
Modifier and Type | Method and Description |
---|---|
void |
calculateBuffer()
Called by the signal chain to update this UGen's ouput data.
|
float |
getAverageNumberOfGrains()
Calculates the average number of Grains given the current grain size and grain interval.
|
UGen |
getGrainIntervalEnvelope()
Deprecated.
Use
getGrainIntervalUGen() instead. |
UGen |
getGrainIntervalUGen()
Gets the grain interval UGen.
|
UGen |
getGrainSizeEnvelope()
Deprecated.
Use
getGrainSizeUGen() instead. |
UGen |
getGrainSizeUGen()
Gets the grain size UGen.
|
UGen |
getPitchEnvelope()
Deprecated.
use
getPitchUGen() . |
UGen |
getPitchUGen()
Gets the pitch UGen.
|
UGen |
getRandomnessEnvelope()
Deprecated.
Use
getRandomnessUGen() instead. |
UGen |
getRandomnessUGen()
Gets the randomness UGen.
|
UGen |
getRandomPanEnvelope()
Deprecated.
Use
getRandomPanUGen() instead. |
UGen |
getRandomPanUGen()
Gets the random pan UGen.
|
Buffer |
getWindow() |
void |
setBuffer(Sample buffer)
Deprecated.
Use
setSample(Sample) instead. |
void |
setGrainInterval(UGen grainIntervalUGen)
Sets the grain interval UGen.
|
void |
setGrainIntervalEnvelope(UGen grainIntervalEnvelope)
Deprecated.
Use
setGrainInterval(UGen) instead. |
void |
setGrainSize(UGen grainSizeUGen)
Sets the grain size UGen.
|
void |
setGrainSizeEnvelope(UGen grainSizeEnvelope)
Deprecated.
Use
setGrainSize(UGen) instead. |
void |
setPitch(UGen pitchUGen)
Sets the pitch UGen.
|
void |
setPitchEnvelope(UGen pitchEnvelope)
Deprecated.
Use
setPitch(UGen) instead. |
void |
setRandomness(UGen randomnessUGen)
Sets the randomness UGen.
|
void |
setRandomnessEnvelope(UGen randomnessEnvelope)
Deprecated.
Use
setRandomness(UGen) instead. |
void |
setRandomPan(UGen randomPanEnvelope) |
void |
setRandomPanEnvelope(UGen randomPanEnvelope)
Deprecated.
Use
setRandomPan(UGen) instead. |
void |
setSample(Sample buffer)
Sets the Sample.
|
void |
setWindow(Buffer window) |
void |
start()
Shortcut for pause(false).
|
calculateNextPosition, getBuffer, getEndListener, getEnvelopeType, getInterpolationType, getKillOnEnd, getLoopCrossFade, getLoopEndEnvelope, getLoopEndUGen, getLoopStartEnvelope, getLoopStartUGen, getLoopType, getPosition, getPositionEnvelope, getPositionUGen, getRateEnvelope, getRateUGen, getSample, getSampleRate, inLoop, reset, reTrigger, setEndListener, setEnvelopeType, setInterpolationType, setKillOnEnd, setLoopCrossFade, setLoopEnd, setLoopEndEnvelope, setLoopPointsFraction, setLoopStart, setLoopStartEnvelope, setLoopType, setPosition, setPosition, setPositionEnvelope, setRate, setRateEnvelope, setToEnd, setToLoopStart, start
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
getKillListener, getName, isDeleted, isPaused, kill, message, messageReceived, setKillListener, setName, toString
public GranularSamplePlayer(AudioContext context, int outs)
context
- the AudioContext.outs
- the number of outputs.public GranularSamplePlayer(AudioContext context, Sample buffer)
context
- the AudioContext.buffer
- the Sample played by the GranularSamplePlayer.@Deprecated public UGen getPitchEnvelope()
getPitchUGen()
.getPitchEnvelope
in class SamplePlayer
public UGen getPitchUGen()
getPitchUGen
in class SamplePlayer
@Deprecated public void setPitchEnvelope(UGen pitchEnvelope)
setPitch(UGen)
instead.setPitchEnvelope
in class SamplePlayer
pitchEnvelope
- the new pitch envelope.public void setPitch(UGen pitchUGen)
setPitch
in class SamplePlayer
pitchUGen
- the new pitch Ugen.@Deprecated public UGen getGrainIntervalEnvelope()
getGrainIntervalUGen()
instead.public UGen getGrainIntervalUGen()
@Deprecated public void setGrainIntervalEnvelope(UGen grainIntervalEnvelope)
setGrainInterval(UGen)
instead.grainIntervalEnvelope
- the new grain interval envelope.public void setGrainInterval(UGen grainIntervalUGen)
grainIntervalUGen
- the new grain interval UGen.@Deprecated public UGen getGrainSizeEnvelope()
getGrainSizeUGen()
instead.public UGen getGrainSizeUGen()
@Deprecated public void setGrainSizeEnvelope(UGen grainSizeEnvelope)
setGrainSize(UGen)
instead.grainSizeEnvelope
- the new grain size envelope.public void setGrainSize(UGen grainSizeUGen)
grainSizeUGen
- the new grain size UGen.public Buffer getWindow()
public void setWindow(Buffer window)
@Deprecated public UGen getRandomnessEnvelope()
getRandomnessUGen()
instead.public UGen getRandomnessUGen()
@Deprecated public void setRandomnessEnvelope(UGen randomnessEnvelope)
setRandomness(UGen)
instead.randomnessEnvelope
- the new randomness envelope.public void setRandomness(UGen randomnessUGen)
randomnessUGen
- the new randomness UGen.@Deprecated public UGen getRandomPanEnvelope()
getRandomPanUGen()
instead.public UGen getRandomPanUGen()
@Deprecated public void setRandomPanEnvelope(UGen randomPanEnvelope)
setRandomPan(UGen)
instead.randomPanEnvelope
- public void setRandomPan(UGen randomPanEnvelope)
@Deprecated public void setBuffer(Sample buffer)
setSample(Sample)
instead.setBuffer
in class SamplePlayer
public void setSample(Sample buffer)
SamplePlayer
setSample
in class SamplePlayer
public void start()
Bead
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 SamplePlayer
public float getAverageNumberOfGrains()