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

[sc-dev] making PV feature extractors

I'm trying to make some feature extractor PV UGens but
need to check how best to proceed- I need to make a
constant output for each fft frame that is the current
feature value. I make PV_HFC (below) run at audio rate
like the IFFT UGen but I'm not convinced I'm doing
this correctly since some investigation with scope
doesn't lead to my seeing constant outputs over frames
but rather some impulse like jumping... How can I best
write output? Do I need to write to a server buffer as
an intermediate step and use BufRd? Or is this acting
like an IFFT UGen the correct way to proceed...

I might have done something stupid of course...

	*new { arg buffer;
		^this.multiNew('audio', buffer);

void PV_HFC_Ctor(PV_Unit *unit)
	//ZOUT0(0) = 0.0; //ZIN0(0);

void PV_HFC_next(PV_Unit *unit, int inNumSamples)

	SCPolarBuf *p = ToPolarApx(buf);
        float hfc=0.0;
	for (int i=1; i<numbins; ++i) {
        hfc *= 1.0/((float)(numbins*numbins));
        printf("hfc %f %d \n",hfc, inNumSamples);
        float *out = ZOUT(0);
        for (int i=0; i<inNumSamples; ++i) {
		*++out = hfc;

//my scoping test code
var scopebuf;
s = Server.internal; 

b = Buffer.alloc(s,8192,1);

scopebuf=Buffer.alloc(s, 10*640, 1);

w = SCWindow("scope test", Rect(128, 64, 300, 300));

n = SCScope(w, Rect(10,10,200,200));
n.bufnum = scopebuf.bufnum;
//n.background = Color.red(0.2);
n.resize = 1; //5;
n.background = Color.black;
n.waveColors = [Color.green(1),Color.blue(1.5)];


SynthDef("help-hfc", { arg out=0,bufnum=0;
	var in, chain, proc, hfc, output;
	in = SinOsc.ar(SinOsc.kr(0.2, 0, 3000, 3500));
	chain = FFT(bufnum, in); //chain is buffer number of
FFT output
	output=0.00000000001*hfc; //SinOsc.ar(1000*hfc, 0,
	Out.ar(out, output);


BT Yahoo! Broadband - Save £80 when you order online today. Hurry! Offer ends 21st December 2003. The way the internet was meant to be. http://uk.rd.yahoo.com/evt=21064/*http://btyahoo.yahoo.co.uk