Aug 15 2012 | 10:22 am

Hello all.

This is very simple...maybe silly question.

As far as I know, it's calculated by single sample in [gen~].

So is there anyway to retrieve 1.0(or any specific float number) from [phasor] in [gen~]?

Or maybe this is not possible in the first place?

Thank you in advanced

- Aug 15 2012 | 11:19 amtry this (use 0.99 instead of 1-- I don't think phasor is guaranteed to reach exactly 1)
- Aug 15 2012 | 3:55 pmdetecting an exact number in gen is not going to be very precise because of the nature of floating point numbers. Floating point numbers can't exactly represent real numbers, so it's unlikely that the number you're trying to detect will occur, especially if it's the result of a series of operations. Instead, you can detect a number by looking for that number + a range around that number that is very small but not inconsequential. For example, if I'm looking for 1.0, I might try detecting with:abs(in-1.0) < epswhere eps is the small range around the target number I'm looking for.
- Aug 15 2012 | 8:04 pmI think I'm correct in saying that phasor (or phasor~) will never truly reach 1. You can, however, either in gen~ or in MSP, use "delta" and "< 0" to look for the sample at which it wraps around toward 0, which is effectively the sample at which it "reaches 1". You can also use < or
- Aug 16 2012 | 8:26 amOK..I see.Thanks for all the tricks everyone.
- Aug 16 2012 | 8:29 amOne more question.Before gen~ I used [delta~] - [ Christopher suggested same method but in [gen~].Between MSP and gen version, which way is better or more precise?Thank you.
- Aug 16 2012 | 9:07 amI tired 3 different ways.The results are almost same..
- Aug 18 2012 | 3:15 amYes, using [delta] and [< 0] is the recommended way to do it. Also [change] is available; it works like delta but returns 1, 0 or -1 to represent the direction of change only (not the amount).Note that if the phasor frequency is negative you will get the boolean opposite (i.e. mostly 1's but a 0 when the phase wraps). If you want to support both positive and negative frequencies, you can try [phasor] -> [change] -> [change], though this will actually give two samples of click (one positive, one negative).
- Aug 21 2012 | 12:59 pmI see..Thanks a lot