## SwingOSC – Java-based GUI classes

This class is meant as an emulation of SCFreqScope. last mod: 17-jul-09 sciss ; for bugs and different behaviour, see also the JStethoscope help file.

# JSCFreqScope

Note: please use the abstraction layer FreqScopeView if possible!

`JSCFreqScope` shows the frequency spectrum of a specified audio bus. The scope will remain active after a command-period. To turn it off you must use the 'active' method. See also: JFreqScope, JSCView.

## Instantiation

    	JSCFreqScope.new( <(JSCView) parent>, <(Rect) bounds> )

## kill

    aScope.kill

Very important. This must be run when the parent window is closed to avoid problems. It also frees the buffers that the scope allocated and stops the FFT analysis synth.

## active_

    aScope.active_( <(Boolean) bool> )

Turns the scope on if true or off if false. When the scope is turned on for the first time, it will send SynthDefs to the internal server, allocate the FFT and scope buffers, and start the FFT analysis synth. After that, only the FFT synth will be turned on and off.

## dbRange_

    aScope.dbRange_( <(Integer) db> )

Determines the amplitude range. This sets the lowest negative decibel reading.

## freqMode_

    aScope.freqMode_( <(Integer) mode> )

Can be either 0 or 1. 0 displays frequencies on a linear scale and 1 displays frequencies on a logarithmic or equally spaced octave scale.

## inBus_

    aScope.inBus_( <(Integer) num> )

Change the bus number to analyze.

## Example

    // Start local server
    s = JStethoscope.defaultServer.boot;

    // Create analyzer in a window
    (
    w = JSCWindow( "My Analyzer", Rect( 0, 0, 511, 300 )); // width should be 511
    f = JSCFreqScope( w, w.view.bounds );
    f.active_( true ); 	// turn it on the first time

    w.onClose_({ f.kill });  // you must have this
    w.front;
    )

    { SinOsc.ar([ 500, 1000 ], 0, 0.25 )}.play( s );  // start two sine waves

    f.freqMode_( 1 );		// change to log scale so we can see them
    f.inBus_( 1 );			// look at bus 1
    f.dbRange_( 200 );		// expand amplitude range
    f.active_( false );		// turn scope off (watch CPU)
    f.active_( true );		// turn it back on

Now press command-period - the scope is still running.

    { SinOsc.ar([ 500, 1000 ], 0, 0.25 )}.play( s );  // start sines again

Close window and the scope is killed.