Class:            Spectrum

Environment:      Siren
Superclass:         Siren.Function
Category:         Music-Functions
Instance variables:   sound window windowSize stepSize magReal
Indexed variables:   objects

Instances of Spectrum represent 3-D data functions derived from sound analysis.

Instance Variables:
   sound the receiver's sound
   window the window type id
   windowSize the window size
   stepSize the step between windows
   fft the receiver's FFT analyzer
   magReal The spectrum type: mag, real, polar, or complex

accessing

D
   Answer the receiver's decimation factor.

D: factor
   Set the receiver's decimation factor.

N
   Answer the receiver's 'windowSize'.

N: aNum
   Set the receiver's instance variable 'windowSize' to be aNum.

sound
   Answer the receiver's 'sound'.

sound: anObject
   Set the receiver's instance variable 'sound' to be anObject.

stepSize
   Answer the receiver's 'stepSize'.

stepSize: anObject
   Set the receiver's instance variable 'stepSize' to be anObject.

windowSize
   Answer the receiver's 'windowSize'.

windowSize: aNum
   Set the receiver's instance variable 'windowSize' to be aNum.

computing

compute
   Do the FFT and store the results into the receiver's data.

compute0
   Do the FFT and store the results into the receiver's data.

setData
   Create the receiver's data array for the right number of frames.

updateRange
   Iterate over the receier's data getting the RMS data range

window: which
   Answer the real data array for the given window of the receiver's sound.

modes

complex
   Set the receiver's instance variable 'magReal' to be #complex.

real
   Set the receiver's instance variable 'magReal' to be #real.

setWindow: aSymbol
   Set the receiver's 'window'.

window
   Answer the receiver's 'window'.

time warp

interpolateFrame: ind
   Answer a new frame interpolated for the given (floating-point) index.

timewarpBy: fact
   Interpolate/decimate the receiver by the given (float or function) time factor.

printing

display
   Display the receiver

printOn: aStream
   Format and print the receiver on the argument.

initialize-release

initialize
   Set up the receiver.

frames

at: anIndex
   Answer the value at the given index (between 1 and self size).

at: anIndex put: aValue
   Answer the value at the given index (between 0 and 1).

frame: anIndex
   Answer the frame at the given index (between 1 and self size).

frame: anIndex do: aBlock
   Iterate over a single frame with the given block.

frame: frm imagAt: frq
   Answer the given imag value in the given frame.

frame: frm imagAt: frq put: val
   Set the given imag value in the given frame.

frame: anIndex put: aValue
   Set the value at the given index (between 0 and 1).

frame: frm realAt: frq
   Answer the requested real value from the given frame.

frame: frm realAt: frq put: val
   Set the given real value in the given frame.

MetaClass:         Spectrum class

examples

fileExample
   Read a sound from disk and take its fft.

sweepExample
   Create a swept sine wave and take its fft.