|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ddf.minim.effects.Convolver
public class Convolver
Convolver
is an effect that convolves a signal with a kernal.
The kernal can be thought of as the impulse response of an audio filter, or
simply as a set of weighting coefficients. Convolver
performs
brute-force convolution, meaning that it is slow, relatively speaking.
However, the algorithm is very straighforward. Each output sample
i
is calculated by multiplying each kernal value
j
with the input sample i - j
and then summing
the resulting values. The output will be
kernal.length + signal.length - 1
samples long, so the extra
samples are stored in an overlap array. The overlap array from the previous
signal convolution is added into the beginning of the output array, which
results in a output signal without pops.
Field Summary | |
---|---|
protected float[] |
kernal
|
protected float[] |
outputL
|
protected float[] |
outputR
|
protected float[] |
overlapL
|
protected float[] |
overlapR
|
protected int |
sigLen
|
Constructor Summary | |
---|---|
Convolver(float[] k,
int sigLength)
Constructs a Convolver with the kernal k that expects buffer
of length sigLength . |
Method Summary | |
---|---|
void |
process(float[] signal)
Processes signal in some way. |
void |
process(float[] sigLeft,
float[] sigRight)
Processes sigLeft and sigRight in some way. |
void |
setKernal(float[] k)
Sets the kernal to k . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected float[] kernal
protected float[] outputL
protected float[] overlapL
protected float[] outputR
protected float[] overlapR
protected int sigLen
Constructor Detail |
---|
public Convolver(float[] k, int sigLength)
k
that expects buffer
of length sigLength
.
k
- the kernal of the filtersigLength
- the length of the buffer that will be convolved with the kernalMethod Detail |
---|
public void setKernal(float[] k)
k
. The values in k
are
copied so it is not possible to alter the kernal after it has been set
except by setting it again.
k
- the kernal to usepublic void process(float[] signal)
AudioEffect
signal
in some way.
process
in interface AudioEffect
signal
- an array of audio samples, representing a mono sound stream.public void process(float[] sigLeft, float[] sigRight)
AudioEffect
sigLeft
and sigRight
in some way.
process
in interface AudioEffect
sigLeft
- an array of audio samples, representing the left channel of a
stereo sound streamsigRight
- an array of audio samples, representing the right channel of a
stereo sound stream
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |