[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[sc-users] BufWr not receiving from input UGen



Dear list, 

I've been hacking away at this for a good while now and can't find my error. If one of you wizards can point me in the right direction I'd be very grateful. I'm trying to fill a running buffer with peak amplitude data, which I will then pull selected indices from to use as a control on another synth. I'm sometimes able to get the first frame of the buffer populated, but nothing else.  Everything appears to be in order upstream, i.e. the synth whose amplitude is to be tracked is outputting audio to the right bus. Any ideas? 

(
~ampbuf = Buffer.alloc(s, 22050, 1);
~ampbus = Bus.new('audio', 8, 1, s);
~ampin = In.ar(~ampbus);

SynthDef(\ampSender, {
|attack=0.01,
decay=0.01,
out=4|

var amp = Amplitude.ar(~ampin, attack, decay);

var buf = BufWr.ar(amp, ~ampbuf.bufnum, Phasor.ar(0, BufRateScale.kr(~ampbuf.bufnum)));
}).add;
)

~item1 = ~ampbuf.get(0, {|msg| msg.postln});
~item2 = ~ampbuf.get(10025, {|msg| msg.postln});
~item3 = ~ampbuf.get(22049, {|msg| msg.postln});