how to generate a bang when signal reaches peak amplitude?
I need to generate a bang every time my MSP signal reaches it’s peak amplitude. I only need it to work for a triangle~ that oscillates from -1. to 1. The problem is that snapshot~ doesn’t seem to ever capture the 1. and I am not aware of something like sel that works with signals.
Try [delta~] which will output something positive when the [triangle~] is ascending and negative when descending, then check which using [< =~ 0] and finally detect the changes with [edge~].
what about ==~1. and then snapshot?
dont think you can use snapshot, as the signal might hit one and then pass by so quickly that snapshot may not necessarily see this
The real problem with looking for a signal equal to 1 is that the oscillator probably won’t hit 1. It might happen every now and again, but most often the 1 of the waveform would theoretically fall between samples, and hence if you examine the signal out of the object you won’t see a value of 1.
In the past this ‘issue’ came up quite a lot, so actually this made it to the Max FAQs as you can see here (5th question down):
delta~ based approaches for this task are generally much more appropriate, simpler and accurate then any methods based on detecting a particular value….
i need to output a bang each time a square wave changes from 0 to 1, or from 1 to 0. how might i do this??
thanks :) :) :)
i’m trying to find out based on the previous replies on this thread, but [< =~ 0] is really confusing me:?
the help file for it says:
"< =~ outputs a 1 when the left input is less than or equal to the right output and a 0 when it is less than the right input"
maybe i’m being dim, but doesn’t that mean it outputs two values with a less than zero input?
or just any help with my question in my previous post?
must be a typo in the help file– should read:
"< =~ outputs a 1 when the left input is less than or equal to the right output and a 0 when it is MORE than the right input"
in answer to your original question use >=~ 0.5 and edge~