Timbre.js

JavaScript Library for Objective Sound Programming
system requirements: Chrome 14- or Firefox 4-

Filter

Filter

Constructor

filter = T("filter", type="lpf", freq=3200, band=1, gain=6, ...);

// type  [String] Filter type
// freq  [Object] Frequency {kr-only}
// band  [Object] Bandwidth {kr-only}
// gain  [Object] Gain {kr-only}
// ...   Input objects which will be added and processed
        

Properties

filter.type // [String] Filter type
filter.freq // [Object] Frequency
filter.band // [Object] Bandwidth
filter.gain // [Object] Gain
        

Methods

        

Events

        

Change the filter type

// The filter class has some aliases.
T("lpf")       // Low pass filter
T("hpf")       // High pass filter
T("bpf")       // Band pass filter
T("brf")       // Band reject filter
T("allpass")   // Allpass filter
T("peaking")   // Peaking filter
T("lowboost")  // Low-Boost filter
T("highboost") // High-Boost filter
        

Register the filter parameters

params = {
    default_freq: 800, default_band: 1, default_gain: 6,
    set_params: function(freq, band) {
        // calculate below parameters
        this._.a1;
        this._.a2;
        this._.b0;
        this._.b1;
        this._.b2;
    }
};

T("filter").setFilter("myfilter", params);

// Use it
T("filter", "myfilter");
        

See Also:

T("rfilter")