use of jcog.math.tensor.ArrayTensor in project narchy by automenta.
the class Log01Wave method get.
/* (non-Javadoc)
* @see net.beadsproject.beads.data.BufferFactory#generateBuffer(int)
*/
@Override
public ArrayTensor get(int bufferSize) {
int size = bufferSize;
ArrayTensor b = new ArrayTensor(size);
for (int i = 0; i < bufferSize; i++) {
float fract = (float) i / (bufferSize - 1);
b.data[i] = 1f / (1f - (float) Math.log(fract));
}
return b;
}
use of jcog.math.tensor.ArrayTensor in project narchy by automenta.
the class NoiseWave method get.
@Override
public ArrayTensor get(int bufferSize) {
int size = bufferSize;
ArrayTensor b = new ArrayTensor(size);
for (int i = 0; i < bufferSize; i++) {
b.data[i] = (float) (1. - 2. * Math.random());
}
return b;
}
use of jcog.math.tensor.ArrayTensor in project narchy by automenta.
the class RampWave method get.
@Override
public ArrayTensor get(int bufferSize) {
int size = bufferSize;
ArrayTensor b = new ArrayTensor(size);
for (int i = 0; i < bufferSize; i++) {
b.data[i] = ramp((i + 0.5f) / bufferSize) / bufferSize;
}
return b;
}
use of jcog.math.tensor.ArrayTensor in project narchy by automenta.
the class SawWave method get.
/* (non-Javadoc)
* @see net.beadsproject.beads.data.BufferFactory#generateBuffer(int)
*/
@Override
public ArrayTensor get(int bufferSize) {
int size = bufferSize;
ArrayTensor b = new ArrayTensor(size);
for (int i = 0; i < bufferSize; i++) {
b.data[i] = (float) i / bufferSize * 2.0f - 1.0f;
}
return b;
}
use of jcog.math.tensor.ArrayTensor in project narchy by automenta.
the class SquareWave method get.
/* (non-Javadoc)
* @see net.beadsproject.beads.data.BufferFactory#generateBuffer(int)
*/
@Override
public ArrayTensor get(int bufferSize) {
int size = bufferSize;
ArrayTensor b = new ArrayTensor(size);
int halfBufferSize = bufferSize / 2;
for (int i = 0; i < halfBufferSize; i++) {
b.data[i] = 1f;
}
for (int i = halfBufferSize; i < bufferSize; i++) {
b.data[i] = -1f;
}
return b;
}
Aggregations