Timbre.js

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

FFT

Fast Fourier transform

Constructor

fft = T("fft", bufferSize=512, window="Hann", onfft=NOP, ...);

// ...   Input objects which will be added and processed
        

Properties

fft.window;     // [String / Function]
fft.interval;   // [Number]    An interval of a FFT processing
fft.noSpectrum; // [Boolean]   not calcurate spectrum

fft.spectrum;   // [Readonly]  Spectrum (Float32Array(fft.size))
fft.size;       // [Readonly]
        

Methods

//           
fft.listen(...);          
        

Events

//           
fft.onfft = function(real, imag) {};          
        

Example

synth = T("wav", "public/audio/amen.wav", true).load().play();

fft = T("fft");

fft.onfft = function(real, imag) {
    // window.background.draw( this.spectrum );
};

fft.listen(synth);          
        

See Also: