3 summary:: Frequency analysis view
5 related:: Classes/FreqScope
8 FreqScopeView shows the frequency spectrum of a specified audio bus.
12 The scope will remain active after a command-period. To turn it off you must use the 'active' method.
13 Very important: You must run code::kill():: when the parent window is closed to avoid problems. It also frees the buffers that the scope allocated and stops the FFT analysis synth. So:
16 w = Window("My Analyzer", Rect(0, 0, 511, 300));
17 f = FreqScopeView(w, w.view.bounds);
18 w.onClose_({ f.kill }); // YOU MUST HAVE THIS
32 An instance of link::Classes/Rect::, or a link::Classes/Point:: indicating code::width@height::.
36 // Start internal server
37 s = Server.internal.boot;
39 // Create analyzer in a window
41 w = Window("My Analyzer", Rect(0, 0, 511, 300)); // width should be 511
42 f = FreqScopeView(w, w.view.bounds);
43 f.active_(true); // turn it on the first time;
45 w.onClose_({ f.kill }); // you must have this
47 { SinOsc.ar([500, 1000], 0, 0.25).mean.dup }.play(s); // start two sine waves
52 Create a scope in a special frequency-response mode. This uses FFT-based spectral division to estimate the frequency response of some effect, on the assumption that the signal to bus1 is transformed to the signal at bus2 by some linear time-invariant process.
56 An instance of link::Classes/Rect::, or a link::Classes/Point:: indicating code::width@height::.
58 The bus on which the "pre" signal is found.
60 The bus on which the "post" signal is found.
62 Linear (0) or log(1) frequency mode. Defaults to 1.
66 Server.default = s = Stethoscope.defaultServer.boot;
68 // basic usage. try these. Each one will open a new window
69 // move the mouse left and right to test response in different ranges
73 BBandPass.scopeResponse
74 BLowShelf.scopeResponse // by default BLowShelf doesn't mangle much
77 Integrator.scopeResponse
78 Median.scopeResponse // nonlinear, and therefore interesting
80 // customize the parameters for more informative scoping
81 {|in| MoogFF.ar(in, freq: MouseX.kr(10, 10000, 1),
82 gain:MouseY.kr(4, 0))}.scopeResponse
85 subsection:: Subclassing and Internal Methods
87 The following methods are usually not used directly or are called by a primitive. Programmers can still call or override these as needed.
90 Returns link::Classes/SCScope::. See also Subclassing and Internal Methods in link::Classes/SCView::.
91 warning::Cocoa specific::
94 Sets the classvar, code::server = Server.internal::.
97 A classvar. Must be code::Server.internal::.
102 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.
105 Turn the scope on or off.
107 An instance of link::Classes/Boolean::.
111 0 = linear, 1 = logarithmic.
114 The bus to listen on.
116 An audio link::Classes/Bus:: number.
119 Get/set the amplitude range.
121 A link::Classes/Number::.
124 Put the scope into a special mode using a user-specified link::Classes/SynthDef::. Note that only very particular SynthDefs should be used, namely ones that are derived from the code::\freqScope0:: or code::\freqScope1:: SynthDefs. Most users will not need to use this method directly, but it can be used to provide a customised analysis shown in the scope.
126 Name of the link::Classes/SynthDef:: you wish to use.
128 Extra arguments that you may wish to pass to the synth.
131 subsection:: Subclassing and Internal Methods
133 The following methods are usually not used directly or are called by a primitive. Programmers can still call or override these as needed.
141 method:: initFreqScope
143 method:: sendSynthDefs
145 method:: allocBuffers
160 // Start internal server
161 s = Server.internal.boot;
164 // Create analyzer in a window
166 w = Window("My Analyzer", Rect(0, 0, 511, 300)); // width should be 511
167 f = FreqScopeView(w, w.view.bounds);
168 f.active_(true); // turn it on the first time;
170 w.onClose_({ f.kill }); // you must have this
172 { SinOsc.ar([500, 1000], 0, 0.25).mean.dup }.play(s); // start two sine waves
175 f.freqMode_(1); // change to log scale so we can see them
176 f.inBus_(1); // look at bus 1
177 f.dbRange_(200); // expand amplitude range
178 f.active_(false); // turn scope off (watch CPU)
179 f.active_(true); // turn it back on
181 // Now press command-period. The scope is still running.
183 { Mix.ar(SinOsc.ar([500, 1200, 3000, 9000, 12000], 0, [0.2, 0.1, 0.05, 0.03, 0.01])) }.play(s); // restart some sines
185 // Close window and scope is killed.