Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.
public final class ConvolverNode
Convolves its input with an impulse response, for reverb and cabinet or
room simulation: the Web Audio ConvolverNode.
The response is a 1, 2 or 4 channel AudioData at the context’s sample
rate. One channel is applied to each input channel; two are a left and a
right response; four are true stereo (left to left, left to right, right to
left, right to right). The output is mono only for a mono response on a
mono input, otherwise stereo.
OfflineAudioContext audio = new OfflineAudioContext(2, 44100, 44100);
OscillatorNode dry = audio.createOscillator();
GainNode wetGain = audio.createGain();
AudioData impulse = audio.createBuffer(2, 22050, 44100); // decoded or synthesised response
ConvolverNode hall = audio.createConvolver();
hall.setBuffer(impulse);
dry.connect(hall).connect(wetGain).connect(audio.getDestination());Convolution is uniformly partitioned in the frequency domain, one 128 frame block at a time, so there is no added latency. Work grows linearly with the response’s length; a few seconds of stereo reverb is practical, a whole cathedral on a low-end phone may not be.
Methods
public AudioData getBuffer() | The impulse response, or null. |
public void setBuffer(AudioData buffer) | Sets the impulse response. |
public boolean isNormalize() | Whether a response set from now on is scaled to a standard loudness; true by default. |
public void setNormalize(boolean normalize) | Sets whether a response set from now on is scaled to a standard loudness. |
Inherited methods
Method details
getBuffer
public AudioData getBuffer()Returns
setBuffer
public void setBuffer(AudioData buffer)Parameters
bufferAudioData- 1, 2 or 4 channels at the context’s sample rate, or null
isNormalize
public boolean isNormalize()Returns
setNormalize
public void setNormalize(boolean normalize)setBuffer(AudioData).Parameters
normalizeboolean- true to normalize