Hi, first, are there any reason not to use a buffer like this instead of a bus or sendtrig? To me this seems simpler and more flexible. Also any way to avoid this refresh problem so that not have to refresh the whole window. What I did notice with buffer is when I used 2 channels and a size of 2048 parts of the buffer got just lots of zeros. Maybe also here the refresh takes so much power so the buffer dont get written correctly. Any thoughts on this? Jesper s = Server.local.boot; ~n = 256; ~buf = Buffer.alloc(s, ~n, 2); ~data = 0 ! ~n; ~dataL = 0 ! ~n / 2; ~dataR = 0 ! ~n / 2; ( SynthDef("xy", { var x; x = SinOsc.ar([ 225, 450 ], MouseY.kr(2pi, 0), 0.6) + LPF.ar( SinOsc.ar( 226 * [ 1, 3.2 ],[ 0, 0.1 ], 0.2), MouseX.kr( 20, 10000, 1)); BufWr.ar( x, ~buf.bufnum, Phasor.ar(0, BufRateScale.kr(~buf.bufnum) * 1, 0, BufFrames.kr(~buf.bufnum))); Out.ar( 0, x ); }).send(s); ) ( //lissajou scope var n, width, height, wpos, v; height = 1006; width = 1006; w = SCWindow( "Digits", Rect( 0, 0, width, height )).front; w.view.background = ""> w. x.free; r.stop; }; v = SCUserView.new( w, Rect( 10, 10, 986, 986 ) ) .relativeOrigin_( true ).clearOnRefresh_( true ); v.background = "" style="color: #0000bf">Color.black; v.drawFunc = { Pen.translate( 493, 493); (~n/2).do({ arg i; ~pL = ( ~dataL.at( i ) * 493 ); ~pR = ( ~dataR.at( i ) * 493 ); Pen.fillColor = Color.hsv( ~dataL.at( i ) * 0.5 + 0.5, 1, 1); Pen.fillOval( Rect( ~pL, ~pR , 16, 16) ); }); }; x = Synth("xy"); r = { loop { ~buf.getn(0, ~n, { arg newData; if( ~data != newData, { ~data = ""> ~foo = ~data.clump(2).flop; ~dataL = ~foo[ 0 ]; ~dataR = ~foo[ 1 ]; { w.refresh }.defer; }) }); 0.01.wait; } }.fork; ) Jesper Elén Studio Manager Visby International Centre for Composers Skeppsbron 18, 621 57 Visby, Sweden +46 705 249914 +46 498 249904 +46 498 249900 ( also fax ) |