sah~ 0 - Sample and Hold with "0" as trigger
Dear all,
I have a seemingly very simple question I simply can't figure out:
I want to use [sah~ 0], the left input is anything, let's say a [cycle~ 1.1].
I want to read the value of the cycle~ whenever the phasor reaches "0".
It does not seem to work like that for some reason.
Can someone tell me how to fix it?
I came up with a work-around - but that one seems to malfuntion if the speed of the phasor is high.
Thank you in advance!
All the best
Frank
Hi
I can't check your patch here, but are you using [delta~], as in [phasor~ 22] --> [delta~] --> [sah~ 0] inlet right?
[delta~] will report less than zero at the instant that the phasor ramp descends back to zero, triggering the [sah~ 0], like a zero-crossing detector.
HTH
Brendan
. . . and inside gen~, it'll do it as FAST as you like ;)
The reason your version might be unreliable at high frequency triggers is the old sigvs thing I guess. [sah~ 0] (without [delta~]) won't catch every instance of a zero value.
Thanks Brendan, that seems to work,
is it really accurate and will always work with the delta~- or can it also get too fast and lead to dropouts?
how would one do it in gen,
i'm not really sure how that would work.
Thanks a lot!
All the best
Frank
Hi
yes, it is highly accurate, dependent upon your signal vector size (in Audio Settings). inside gen~ calculations are sample accurate, eg 44100 times per second. But entering/leaving the gen~ domain is accurate on a per-vector basis, eg 44100/64samples.
Doing this in gen~ uses exactly the same objects/algorithm as in MSP - although this is not always the case
Brendan
ps
I have temporarily abandoned Windows and MacOS, so no more Max examples from me I'm afraid.
Brendan
and a little light reading, for us all:
Brendan
Brendan, thanks a lot for your advice, that was very helpful and an opportunity to try to appraoch gen~ :)
Frank