Module jecho
Class AudioFilter
Base class of all the audio filters.
Method summary
static jecho.AudioFilter |
|
static jecho.AudioFilter |
|
static jecho.AudioFilter |
|
void |
|
Methods
static
jecho.AudioFilter
createFilter
(
-
filterFunction
:Function
Create a new filter from a filter function.
Parameters
-
filterFunction
FunctionFunction that will filter the audio data buffer. Its prototype is the following:
function(channel,input,output,length){}
.
Returns
jecho.AudioFilter:
static
jecho.AudioFilter
createLowPass
(
-
alpha
:Float
Create a low pass filter.
Parameters
-
alpha
FloatThe cutoff frequency between 0 and 2
Returns
A low-pass filter
static
jecho.AudioFilter
createZ
(
-
zFilterFunction
:Function
Create a new filter with Z transform expressions
Parameters
-
zFilterFunction
FunctionThe
zFilterFunction
prototype is the following:
function(x,y,i){}
withx
the input buffery
the output bufferi
the current output index
Returns
The newly created filter
Example
// This filter decreases the output volume
// by a factor of two.
audio.addFilter(jecho.createZFilter(function(x,y,i)
{
var outSample = x[i];
outSample *= 0.5;
return outSample;
}));
void
filter
(
-
channel
:Integer
-
input
:Array
-
output
:Array
-
length
:Integer
[ absract ] Filter an audio buffer.
Parameters
-
channel
IntegerThe channel number
-
input
ArrayThe input data buffer
-
output
ArrayThe output data buffer
-
length
IntegerThe length of the buffers