Class AudioJack
Object
|
+--AudioJack
- class
AudioJack
The Audio Jack class collects audio and analizes it for use in parameters
This object collects audio from a
Jack source, it can be used to
change parameter values based on the audio input.
16 harmonics are provided using a fast fourier transform, returning
values available for assignement to parameters.
Example:
// create the audio collector
// args: jack_port, samplesize, samplerate
audio = new AudioJack("xine:out_l", 2048, 44100);
// set an adequate resolution
H=640;
M=H/128;
W=H/(H/80);
set_resolution(W,H);
// create a geometry layer to draw levels
geo = new GeometryLayer();
geo.start();
add_layer(geo);
// run the analisis on every frame and draw lines
bang = new TriggerController();
bang.frame = function() {
// this function must be called to refresh harmonics
audio.fft();
for(c=0;c<16;c++) {
hc = audio.get_harmonic(c);
geo.vline( c*M, H, H-( hc ));
}
}
Defined in AudioCollector.js
Author: Dave Griffiths, Jaromil
Constructor Summary |
AudioJack(<string> jack_port, <int> sample_size, <int> sample_rate)
This constructor instantiates an AudioJack collector for Jack
|
Method Summary |
void
|
fft()
The Audio object processes the current input with an FFT (the cpu
consuming part) to be ready to provide up-to-date harmonics values
on request of get_harmonics.
|
void
|
get_harmonic(<int> harmonic)
A call to get_harmonics returns up to 16 values for each harmonic
detected on the audio, as the last time fft() was called.
|
AudioJack
AudioJack(<string> jack_port, <int> sample_size, <int> sample_rate)
This constructor instantiates an AudioJack collector for Jack
Parameters:
jack_port
- an input name like "alsa_pcm:input_1", see jack connections
sample_size
- size of the samples in bytes, best if same as jack configuration
sample_rate
- rate of the audio in input, best if same as jack configuration
Returns:
a new allocated Audio Jack
Author: Dave Griffiths, Jaromil
fft
void fft()
The Audio object processes the current input with an FFT (the cpu
consuming part) to be ready to provide up-to-date harmonics values
on request of get_harmonics.
get_harmonic
void get_harmonic(<int> harmonic)
A call to get_harmonics returns up to 16 values for each harmonic
detected on the audio, as the last time fft() was called. This
function provides values that are "in sync to the music" and can
be used to set parameters.
Parameters:
harmonic
- number of the harmonic, from 1 to 16
FreeJ scripting documentation is Copyleft (C) 2000 - 2007 dyne.org foundation. Verbatim copying and distribution of this entire page is permitted in any medium, provided this notice is preserved.
Send inquiries & questions to dyne.org's hackers.
Documentation generated by
JSDoc on Thu May 29 20:56:52 2008