Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## ddf.minim.effects
Class Convolver

    java.lang.Object
      ddf.minim.effects.Convolver

All Implemented Interfaces:
  AudioEffect

    public class Convolver

extends java.lang.Object
implements AudioEffect

`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.

Author:
  Damien Di Fede
See Also:
  Convolution

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

### kernal

    protected float[] kernal

### outputL

    protected float[] outputL

### overlapL

    protected float[] overlapL

### outputR

    protected float[] outputR

### overlapR

    protected float[] overlapR

### sigLen

    protected int sigLen

Constructor Detail

### Convolver

    public Convolver(float[] k,
                     int sigLength)

  Constructs a Convolver with the kernal `k` that expects buffer of length `sigLength`.

  Parameters:
    `k` - the kernal of the filter
    `sigLength` - the length of the buffer that will be convolved with the kernal

Method Detail

### setKernal

    public void setKernal(float[] k)

  Sets the kernal to `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.

  Parameters:
    `k` - the kernal to use

### process

    public void process(float[] signal)

  Description copied from interface: `AudioEffect`
  Processes `signal` in some way.

  Specified by:
    `process` in interface `AudioEffect`
  Parameters:
    `signal` - an array of audio samples, representing a mono sound stream.

### process

    public void process(float[] sigLeft,
                        float[] sigRight)

  Description copied from interface: `AudioEffect`
  Processes `sigLeft` and `sigRight` in some way.

  Specified by:
    `process` in interface `AudioEffect`
  Parameters:
    `sigLeft` - an array of audio samples, representing the left channel of a stereo sound stream
    `sigRight` - an array of audio samples, representing the right channel of a stereo sound stream

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD