A Question about Synths and Postln

Dear Community,
I have to code a little Synth who estimate the frequency of a music part,
and put this value all 100ms in a File.
So my first try is to code it so that postln; will show me this value.
A little Synth with a gape is already coded.:

(
SynthDef(\FreqMeter, { |freq=440|
var sig, freqf, hasfreq;
sig = SinOsc.ar(freq);
Out.ar(0, [sig, sig]);
# freqf, hasfreq = Pitch.kr(sig);
// here I’m not knowing the right Code
}).add;
)

a = Synth(\FreqMeter);
a.set(\freq, 880);

Can anybody help me please.

CreCo

Hello,

postln is for the language. Inside of a synth you should use .poll

so, in your case:

freqf.poll

Sam

Ok,
thaths works Fine.
So in which way I can get now this Values in a File I knew

f = File("~/Frequencys.txt".standardizePath,“w”);
f.write(freqf);
// The last will return.
f.close;

To write a file you need the values in the language:

.) Send to language with SendReply
.) Catch values with OSCdef / OSCfunc, store them e.g. in a List (can be extended)
.) Write Array / List to file

Sorry, no time to write an example, but there are examples for each part in the help files.

Thanks it seams it is the Solution I need.

Ok,
this was really the Answer I needed.