SCScope oscilliscope: render a buffer to a view in real time

Inherits from: Object : SCView

An oscilloscope-type view.

SCScope can only work with the internal server.

See also: the useful tool: Stethoscope

SCSoundFileView

s = Server.internal;

s.boot;

f = Buffer.alloc(s,1024,1);

b = Bus.audio(s,1);

w=GUI.window.new.front;

c = SCScope(w.view,w.view.bounds.insetAll(10,10,10,10));

c.bufnum = f.bufnum;

(

// listening to the bus, using ScopeOut to write it to the buffer

SynthDef("monoscope", { arg bus, bufnum;

var z;

z = In.ar(bus,1);

// ScopeOut writes the audio to the buffer

ScopeOut.ar(z, bufnum);

}).play(

RootNode(s),

[\bus,b.index, \bufnum, f.bufnum] ,

\addToTail // make sure it goes after what you are scoping

);

)

(

// making noise onto the buffer

SynthDef("noise", { arg bus;

var z;

z = LFSaw.ar(SinOsc.kr(0.1).range(300,1000)) * 0.1;

Out.ar(bus, z);

}).play(

s,

[\bus,b.index]

);

)

c.style = 0 // vertically spaced

c.style = 1 // overlapped

c.style = 2 // x/y

The update speed is based on the size of the buffer.

A 2 second buffer (44100*2) will update every 2 seconds.

<>bufnum

The buffer number the view will use.

x

x_ (val)

y

y_ (val)

xZoom

xZoom_ (val)

yZoom

yZoom_ (val)

gridColor

gridColor_ (color)

waveColors

waveColors_ (arrayOfColors)

style_ (val)

// 0 = vertically spaced

// 1 = overlapped

// 2 = x/y