|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jass.engine.Out jass.generators.ConstantLoopBuffer jass.generators.GranularConstantLoopBuffer
public class GranularConstantLoopBuffer
Jump through a buffer, loaded from an audio file or provided by caller. No speed or volume control is provided. Sample is divided into segments with segmentation array segs[]. seg[k] is start of segment k, except last element of segs[], which denotes the end of the last segment (in order not to run into the artificial buffer end). Playback starts at segment i, then makes transition to setgment k, with transition probability tprob[i][k] (user provided matrix). Generally you must define first the segments, then the transition matrix.
Field Summary | |
---|---|
protected int |
currentSegIndex
Current segment index |
protected float |
fadeTime
Fade-in time for grains |
protected int[] |
isSeg
array telling you segment index of sample k in loopBuffer[]. |
protected float |
linearBias
If 1 will have linear wavetable playback, 0 total random |
protected int[] |
segs
Locations of segments in samples. |
protected double[][] |
tprob
Transition probabilities. |
protected float |
volume
volume |
Fields inherited from class jass.generators.ConstantLoopBuffer |
---|
ix, loopBuffer, loopBufferLength, srate |
Fields inherited from class jass.engine.Out |
---|
buf, bufferSize, bufOld, lock |
Constructor Summary | |
---|---|
GranularConstantLoopBuffer(float srate,
int bufferSize,
float[] loopBuffer)
Construct from provided buffer |
|
GranularConstantLoopBuffer(float srate,
int bufferSize,
java.lang.String fn)
Construct from named file. |
|
GranularConstantLoopBuffer(float srate,
int bufferSize,
java.net.URL url)
Construct from url. |
Method Summary | |
---|---|
void |
computeBuffer()
Compute the next buffer. |
void |
initRandom(int n,
float linearBias)
Random initialization with n segments (not counting last unused one) |
void |
setFadeTime(float dur)
Set duration of fade-in at the grain boundaries This method only works if the segments are ordered sequentually in time. |
void |
setLinearBias(float val)
Set probability that InitRandom() generated random transition matrix will favour sequential playback |
void |
setSegments(float[] segs)
Define segments as float array of times. |
void |
setSegments(int n)
Define n segments randomly |
void |
setTransitionMatrix()
Define random transition matrix. |
void |
setTransitionMatrix(double[][] t)
Define transition matrix |
void |
setVolume(float vol)
Set volume |
Methods inherited from class jass.generators.ConstantLoopBuffer |
---|
getLoopBuffer, getSamplingRate |
Methods inherited from class jass.engine.Out |
---|
clearBuffer, copyToOld, getBuffer, getBuffer, getBufferSize, getTime, peekAtBuffer, resetTime, setBufferSize, setTime, setTimeAndNotify |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected int[] segs
protected double[][] tprob
protected int currentSegIndex
protected int[] isSeg
protected float fadeTime
protected float linearBias
protected float volume
Constructor Detail |
---|
public GranularConstantLoopBuffer(float srate, int bufferSize, java.lang.String fn)
srate
- sampling rate in Hertz.bufferSize
- bufferSize of this Outfn
- Audio file name.public GranularConstantLoopBuffer(float srate, int bufferSize, java.net.URL url)
srate
- sampling rate in Hertz.bufferSize
- bufferSize of this Outurl
- Audio file url.public GranularConstantLoopBuffer(float srate, int bufferSize, float[] loopBuffer)
srate
- sampling rate in Hertz.bufferSize
- bufferSize of this Out.loopBuffer
- looping buffer.Method Detail |
---|
public void initRandom(int n, float linearBias)
n
- number of segmentslinearBias
- how likely a linear playback is (1 will give looping, 0 total randomness)public void setFadeTime(float dur)
fadeTime
- fade-in time in secondspublic void setLinearBias(float val)
val
- probability for linear orderpublic void setSegments(float[] segs)
segs
- segments. Last segment is unused, but used to make end of prev.public void setSegments(int n)
n
- number of segments (not including last one)public void setTransitionMatrix(double[][] t)
t
- transition matrix of size (segs.length-1)*(segs.length-1)public void setTransitionMatrix()
n
- transition matrix of size (segs.length-1)*(segs.length-1)public void setVolume(float vol)
vol
- volumepublic void computeBuffer()
computeBuffer
in class ConstantLoopBuffer
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |