How to patch y[n] = x[n]/samplerate + y[n-1] with x the input and y the output in Pure Data?
-
y[n] = x[n]/samplerate + y[n-1]
-
@Nobody what results do you think you should get? seems like you should get a kind of lowpassed triangle wave on the right side with that configuration.
-
I'm trying to make a mathematical integrator module (not a slew limiter), and indeed feeding a square wave should result in a triangle wave at the output. But sadly for some reason it's not working...
-
Now we are getting somewhere:
-
Is such a feedback loop as below forbidden in Pure Data? Can't get it to work...
-
Yes, it's forbidden. You can't loop signal objects like that. You have to use a [send~] / [receive~] pair to make the loop.
-
Thanks! Yes the loop is working now.
-
Is there a simple way to give a single pulse to startup the patch instead of the workaround in the red circle?
-
@Nobody said:
Is there a simple way to give a single pulse to startup the patch instead of the workaround in the red circle?
The best way I know is to create a two element array -- first value 1, second value 0 -- then tabplay~ to get the impulse.
[array define dirac] [loadbang] | [t b b] | | | [; dirac resize 2; dirac 0 1 0( <<-- message, not object | [tabplay~ dirac]
(From memory, maybe I got the array messages wrong)
hjh
-
Why isn't the patch below inverting the input signal?
-
@Nobody said:
Why isn't the patch below inverting the input signal?
If the -1 message isn't being transmitted, then *~ might not be multiplying by -1...?
Otherwise... what is it doing instead of inverting?
hjh
-
Thanks. I now have the following and it is working now.
-
Just put -1 as an argument, like this
[*~ -1]
-
Ah - that's even better.