|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ddf.minim.ugens.Wavetable
public class Wavetable
Wavetable wraps a float array of any size and lets you sample array using a normalized value [0,1]. This means that if you have an array that is 2048 samples long, then value(0.5) will give you the 1024th sample. You will most often use Wavetables as the Waveform in an Oscil, but other uses are also possible. Additionally, Wavetable provides a set of methods for transforming the samples it contains.
Constructor Summary | |
---|---|
Wavetable(float[] waveform)
Construct a Wavetable that will use waveform as the float array to sample from. |
|
Wavetable(int size)
Construct a Wavetable that contains size entries. |
|
Wavetable(Wavetable wavetable)
Make a new Wavetable that has the same waveform values as wavetable . |
Method Summary | |
---|---|
void |
addNoise(float sigma)
Adds gaussian noise to the waveform scaled by sigma . |
void |
flip(float in)
Flip the values in the table around a particular value. |
float |
get(int i)
Returns the value of the ith entry in this Wavetable's waveform. |
float[] |
getWaveform()
Returns the underlying waveform, not a copy of it. |
void |
invert()
Flips the table around 0. |
void |
normalize()
Normalizes the Wavetable by finding the largest amplitude in the table and scaling the table by the inverse of that amount. |
void |
offset(float amount)
Apply a DC offset to this Wavetable. |
void |
rectify()
Inverts all values in the table that are less than zero. |
void |
scale(float scale)
Multiplies each value of the underlying waveform by scale . |
void |
set(int i,
float value)
Sets the ith entry of the underlying waveform to value . |
void |
setWaveform(float[] waveform)
Sets this Wavetable's waveform to the one provided. |
int |
size()
Returns the length of the underlying waveform. |
void |
smooth(int windowLength)
Smooths out the values in the table by using a moving average window. |
float |
value(float at)
at is expected to be in the range [0,1]. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Wavetable(int size)
size
entries.
size
- public Wavetable(float[] waveform)
waveform
as the float array to sample from.
This will not copy waveform
, it will use it directly.
waveform
- public Wavetable(Wavetable wavetable)
wavetable
. This will
copy the values from the provided Wavetable into this Wavetable's waveform.
wavetable
- Method Detail |
---|
public void setWaveform(float[] waveform)
waveform
- public float get(int i)
public float value(float at)
at
is expected to be in the range [0,1]. This will sample the waveform
using this value and interpolate between actual sample values as needed.
value
in interface Waveform
at
- a value in the range [0, 1]
public float[] getWaveform()
public void set(int i, float value)
value
.
This is equivalent to:
getWaveform()[i] = value;
public int size()
getWaveform().length
public void scale(float scale)
scale
.
public void offset(float amount)
amount
to every
sample.
amount
- the amount to add to every sample in the tablepublic void normalize()
public void invert()
flip(0)
.
public void flip(float in)
in
- public void addNoise(float sigma)
sigma
.
sigma
- public void rectify()
public void smooth(int windowLength)
windowLength
- how many samples large the window should be
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |