[COMMIT?] FFTTrigger (was Re: [Sc-devel] FFT question)

Josh Parmenter josh at realizedsound.net
Thu Nov 8 08:03:27 PST 2007


On Nov 8, 2007, at 12:56 AM, Dan Stowell wrote:

> Josh,
>
> Don't commit it before SC 3.1.1 is out. Otherwise, I'm happy with what
> it looks like (haven't tried it). A couple of questions:
>
> * What's the ToComplexApx() call for in the ctor? It can't be to
> ensure coord is set, since you do it manually straight after, so I'm
> not sure.

Not sure why this was, but it actually came up when I was making the  
PV_PlayBuf UGens. You sent the hint about buf->coord and I through it  
in, then everything worked fine. However, I was already doing the  
transformation of the data using ToPolarApx, and I realized it was  
redundant. So I took it out, and there were problems again. Put it  
back in, and it was fine. I thought that was strange and meant to go  
back to it and forgot until I saw your email just now... so, there is  
something there to track down. But for right now, without the call AND  
coord setting, things explode.
>
> * You can get rid of the "SCComplexBuf *p" part of that line anyway,
> since you don't subsequently use p.

Yes! thanks...

>
> * Could we please have an optional flag about whether this fills in
> the coord value with either coord_Complex or coord_Polar?
>
Sure... will through that in.

Josh
> Best
> Dan
>
>
> 2007/11/8, Josh Parmenter <josh at realizedsound.net>:
>> Hi all... this seems to work on my end... what do you think?
>>
>>
>>
>> FFTTrigger : PV_ChainUGen
>> {
>> *new { | buffer, hop = 0.5|
>> ^this.multiNew('control', buffer, hop)
>> }
>> }
>>
>>
>> void FFTTrigger_Ctor(FFTTrigger *unit)
>> {
>> World *world = unit->mWorld;
>>
>> uint32 bufnum = (uint32)IN0(0);
>> //Print("FFTBase_Ctor: bufnum is %i\n", bufnum);
>> if (bufnum >= world->mNumSndBufs) bufnum = 0;
>> SndBuf *buf = world->mSndBufs + bufnum;
>>
>>
>> unit->m_fftsndbuf = buf;
>> unit->m_fftbufnum = bufnum;
>> unit->m_bufsize = buf->samples;
>>
>> int numSamples = unit->mWorld->mFullRate.mBufLength;
>> float dataHopSize = IN0(1);
>> unit->m_numPeriods = unit->m_periodsRemain = (int)((unit->m_bufsize *
>> dataHopSize) / numSamples) - 1;
>>
>>
>> SCComplexBuf *p = ToComplexApx(buf);
>> buf->coord = coord_Complex;
>> OUT0(0) = IN0(0);
>> SETCALC(FFTTrigger_next);
>> }
>>
>> void FFTTrigger_next(FFTTrigger *unit, int inNumSamples)
>> {
>> if (unit->m_periodsRemain > 0) {
>> ZOUT0(0) = -1.f;
>> unit->m_periodsRemain--;
>> } else {
>> ZOUT0(0) = unit->m_fftbufnum;
>> unit->m_fftsndbuf->coord = coord_Complex;
>> unit->m_pos = 0;
>> unit->m_periodsRemain = unit->m_numPeriods;
>> }
>>
>>
>> }
>>
>> Josh
>>
>>
>> On Nov 7, 2007, at 6:21 PM, James Harkins wrote:
>>
>>
>> On Nov 7, 2007, at 4:10 PM, Dan Stowell wrote:
>>
>> CeciNestPasUnFFT
>>
>> AcceptsFinestFun? Oh wait, I'm mixing threads now.
>> hjh
>>
>>
>> : H. James Harkins
>> : jamshark70 at dewdrop-world.net
>> : http://www.dewdrop-world.net
>> .::!:.:.......:.::........:..!.::.::...:..:...:.:.:.:..:
>>
>> "Come said the Muse,
>> Sing me a song no poet has yet chanted,
>> Sing me the universal."  -- Whitman
>> _______________________________________________
>> Sc-devel mailing list
>> Sc-devel at create.ucsb.edu
>> http://www.create.ucsb.edu/mailman/listinfo/sc-devel
>>
>>
>>
>>
>> ******************************************
>>
>> /* Joshua D. Parmenter
>>
>> http://www.realizedsound.net/josh/
>>
>>
>>
>>
>> "Every composer ? at all times and in all cases ? gives his own
>> interpretation of how modern society is structured: whether  
>> actively or
>> passively, consciously or unconsciously, he makes choices in this  
>> regard. He
>> may be conservative or he may subject himself to continual renewal;  
>> or he
>> may strive for a revolutionary, historical or social palingenesis."  
>> - Luigi
>> Nono*/
>>
>> _______________________________________________
>> Sc-devel mailing list
>> Sc-devel at create.ucsb.edu
>> http://www.create.ucsb.edu/mailman/listinfo/sc-devel
>>
>>
>
>
> -- 
> http://www.mcld.co.uk
>
> _______________________________________________
> Sc-devel mailing list
> Sc-devel at create.ucsb.edu
> http://www.create.ucsb.edu/mailman/listinfo/sc-devel

******************************************
/* Joshua D. Parmenter
http://www.realizedsound.net/josh/

“Every composer – at all times and in all cases – gives his own  
interpretation of how modern society is structured: whether actively  
or passively, consciously or unconsciously, he makes choices in this  
regard. He may be conservative or he may subject himself to continual  
renewal; or he may strive for a revolutionary, historical or social  
palingenesis." - Luigi Nono
*/




More information about the Sc-devel mailing list