[PD-dev] Detecting phase cycle with tabfudge in d_osc.c.....

chun lee leechun at leechun.freeserve.co.uk
Tue Nov 9 17:48:59 CET 2004


Hi there:

Given the currently code for [phasor~] in d_osc.c that uses tabfudge to get
the fraction of the phase value. What would be the best method to detect the
end of each phase cycle?

What I meant is that I am thinking of making a simple [phasor~] like object
that sets itself to a random frequency at the end of each phase cycle. So
there is only one cycle on each randomized frequency.

I thought about:

1. using a if statement in the phasor_perfrom() or even in the dsp loop to
test the value of dphase to see if its over 1 (not sure about the detail yet
as the upper 32 bits of dphase is a constant).

2. using timing/delay, when a new frequency value is generated, work out the
time it will take to complete one cycle and set a delay accordingly to
generate the next value. But somehow I feel this might be less accurate.


Can anyone offer any advice and suggestion? I am sure there is a simple way
out there in triggering certain action at the end of each phase cycle.

Many thanks

CHUN 





More information about the Pd-dev mailing list