jecho - An easy-to-use js audio library

API Docs for: 0.0.1
Module jecho

Class AudioFilter

Base class of all the audio filters.

Method summary

static jecho.AudioFilter

createFilter

(
  • filterFunction: Function
)

Create a new filter from a filter function.

static jecho.AudioFilter

createLowPass

(
  • alpha: Float
)

Create a low pass filter.

static jecho.AudioFilter

createZ

(
  • zFilterFunction: Function
)

Create a new filter with Z transform expressions

void

filter

(
  • channel: Integer
  • input: Array
  • output: Array
  • length: Integer
)

[ absract ] Filter an audio buffer.

Methods

static jecho.AudioFilter

createFilter

(
  • filterFunction: Function
)

Create a new filter from a filter function.

Parameters

  • filterFunction Function

    Function 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 Float

    The 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 Function

    The zFilterFunction prototype is the following:
    function(x,y,i){} with

    • x the input buffer
    • y the output buffer
    • i 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 Integer

    The channel number

  • input Array

    The input data buffer

  • output Array

    The output data buffer

  • length Integer

    The length of the buffers