3 summary:: An oscilloscope
4 categories:: GUI>Interfaces
5 related:: Classes/ScopeView, Classes/FreqScope
9 Stethoscope provides a complete oscilloscope GUI. It displays a window containing a bus-plotting link::Classes/ScopeView:: and an interface to configure the plotting and choose among the buses.
11 SUBSECTION:: Creation by message .scope
13 Several classes provide a convenient 'scope' method that creates a Stethoscope to display their data. See for example: link::Classes/Server#-scope::, link::Classes/Bus#-scope::, link::Classes/Function#-scope::.
15 SUBSECTION:: Keyboard shortcuts
17 The following keyboard shortcuts may be used when focused on the Stethoscope display:
20 ## strong::Shortcut:: || strong::Action::
21 ## J || one channel back
22 ## K || switch rate (audio vs. control)
23 ## L || one channel forward
24 ## O || jump to first hardware output channel and adjust numChannels to hardware
25 ## I || jump to first hardware input channel and adjust numChannels to hardware
26 ## space || run, if not running already
28 ## M || toggle screen size
29 ## + / - || zoom horizontally
30 ## * / _ || zoom vertically
31 ## S || change style between parallel and overlay
32 ## Shift+S || change style to lissajou
33 ## Shift+A || allocate buffer size so it fills the screen (to next power of two) (this can be dangerous, might crash)
42 Create a Stethoscope, either as a window, or placed on a given parent view.
45 In Qt GUI: any local Server (internal or another process on the same machine).
46 In other GUI kits: must be Server.internal.
47 argument:: numChannels
48 An integer. Default value is 2.
50 The offset index. An Integer. Default is nil.
52 The size of the analysis buffer. Default is 4096.
54 Horizontal maginification of the displayed wave. Default is 1.
56 \audio or \control. Default is \audio.
58 The optional parent view. Default is nil. If nil, then it will open in its own Window.
60 The id number of the Buffer to analyze. Default value is nil. If nil, then a Buffer of size bufSize is allocated.
65 Server.default = s = Server.internal
67 {SinOsc.ar([330,440], 0, 0.4)}.play;
73 Returns an array of the running ugen scopes.
76 Server.default = s = Server.internal
78 {[SinOsc.ar.scope,WhiteNoise.ar(0.5).scope]*0.1}.scope(2);
79 SCStethoscope.ugenScopes; // returns the ugen scopes
82 METHOD:: defaultServer
84 SCStethoscope's default server. Returns Server.internal
87 METHOD:: isValidServer (aServer)
89 Tests if a server is a valid server. Returns a n instanc of Boolean;
90 aServer - An instance of Server.
94 A utility used by Ugen : scope to tile scope windows.
102 Returns an array of the running UGen scopes, just like the class method link::#*ugenScopes::.
108 The server on which the scope operates.
111 Whether to operate on audio or control busses.
113 One of the two symbols: code::\audio:: or code::\control::.
116 The starting index of the busses to scope.
121 The amount of adjacent busses to scope (from link::#-index:: on).
126 The size of the scope buffer.
132 The (parent) Window of the scope.
135 Sets the width and the height of the scope window.
137 An Integer (the window is square).
141 Toggle between small and large size.
144 A synonym for link::#-xZoom::.
147 Zoom horizontally by the given factor.
153 Zoom vertically by by the given factor.
160 ## 0 = the channels are vertically spaced
161 ## 1 = the channels are overlayed
162 ## 2 = lissajou; the first two channels are used for 2D plotting (as streams of x and y coordinates).
166 One of the above Integers.
169 SUBSECTION:: Operation
173 Starts the scope, if not already running.
177 Closes the window, and cleans up any used synths and buffers.
179 SUBSECTION:: Convenience
181 METHOD:: setProperties (numChannels, index, bufsize, zoom, rate)
183 Sets several properties at once: link::#-numChannels::, link::#-index::, link::#-bufsize::, link::#-zoom::, and link::#-rate::.
189 SUBSECTION:: A step-by-step example
192 Server.default = Server.internal;
198 SinOsc.ar([225, 450, 900], 0, 0.2)
200 LFPulse.ar(226 * [1, 2, 5],[0,0.1,0.1],0.2, 0.2),
201 MouseX.kr(20, 10000, 1)
206 // server.scope only changes the properies explicitly given:
208 s.scope(numChannels:5);
213 s.scopeWindow.size = 600;
214 s.scopeWindow.size = 222;
219 { WhiteNoise.ar(0.2.dup(4)) }.play(s, a);
223 c = Bus.control(s, 3);
224 { WhiteNoise.kr(1.dup(4) * MouseX.kr) }.play(s, c);
228 // note that scoping control rate buses shows block size interpolation (this is due to the
229 // fact that ScopeOut.kr doesn't work yet.)
232 SUBSECTION:: Embedded use
233 You can pass your own view in to add a stethoscope to it:
236 w = Window.new("my own scope", Rect(20, 20, 400, 500));
237 w.view.decorator = FlowLayout(w.view.bounds);
238 c = Stethoscope.new(s, view:w.view);
239 w.onClose = { c.free }; // don't forget this