3 summary:: Frequency analysis view
5 related:: Classes/SCFreqScopeWindow, Classes/SCScope
8 FreqScopeView shows the frequency spectrum of a specified audio bus.
10 subsection:: A Very Important Issue Regarding FreqScope:
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
30 An instance of link::Classes/Rect::, or a link::Classes/Point:: indicating code::width@height::.
34 // Start internal server
35 s = Server.internal.boot;
37 // Create analyzer in a window
39 w = Window("My Analyzer", Rect(0, 0, 511, 300)); // width should be 511
40 f = FreqScopeView(w, w.view.bounds);
41 f.active_(true); // turn it on the first time;
43 w.onClose_({ f.kill }); // you must have this
45 { SinOsc.ar([500, 1000], 0, 0.25).mean.dup }.play(s); // start two sine waves
50 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.
54 An instance of link::Classes/Rect::, or a link::Classes/Point:: indicating code::width@height::.
56 The bus on which the "pre" signal is found.
58 The bus on which the "post" signal is found.
60 Linear (0) or log(1) frequency mode. Defaults to 1.
64 Server.default = s = Stethoscope.defaultServer.boot;
66 // basic usage. try these. Each one will open a new window
67 // move the mouse left and right to test response in different ranges
71 BBandPass.scopeResponse
72 BLowShelf.scopeResponse // by default BLowShelf doesn't mangle much
75 Integrator.scopeResponse
76 Median.scopeResponse // nonlinear, and therefore interesting
78 // customize the parameters for more informative scoping
79 {|in| MoogFF.ar(in, freq: MouseX.kr(10, 10000, 1),
80 gain:MouseY.kr(4, 0))}.scopeResponse
83 subsection:: Subclassing and Internal Methods
85 The following methods are usually not used directly or are called by a primitive. Programmers can still call or override these as needed.
88 Returns link::Classes/SCScope::. See also Subclassing and Internal Methods in link::Classes/SCView::.
89 warning::Cocoa specific::
92 Sets the classvar, code::server = Server.internal::.
95 A classvar. Must be code::Server.internal::.
100 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.
103 Turn the scope on or off.
105 An instance of link::Classes/Boolean::.
109 0 = linear, 1 = logarithmic.
112 The bus to listen on.
114 An audio link::Classes/Bus:: number.
117 Get/set the amplitude range.
119 A link::Classes/Number::.
122 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.
124 Name of the link::Classes/SynthDef:: you wish to use.
126 Extra arguments that you may wish to pass to the synth.
129 subsection:: Subclassing and Internal Methods
131 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.