use of jcog.math.tensor.ArrayTensor in project narchy by automenta.
the class HanningWindow 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 lowerThresh = bufferSize / 4;
int upperThresh = bufferSize - lowerThresh;
for (int i = 0; i < bufferSize; i++) {
b.data[i] = i < lowerThresh || i > upperThresh ? 0.5f * (1.0f + (float) Math.cos((Math.PI + Math.PI * 4.0f * i / (float) (bufferSize - 1)))) : 1.0f;
}
return b;
}
use of jcog.math.tensor.ArrayTensor in project narchy by automenta.
the class CosineWindow 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) Math.sin((double) i / bufferSize * Math.PI);
}
return b;
}
use of jcog.math.tensor.ArrayTensor in project narchy by automenta.
the class Exp01Wave 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] = (float) Math.exp(1f - 1f / fract);
}
return b;
}
Aggregations