In Pd of course, anyone?
-
looking for velvet noise generator
-
@porres it's just to give the user more control.. what if the user wants to reset the time period for triggering an impulse?
I included a version in my own library as velvet~ where it's driven by an external phasor (as well as controls for temporal and impulse bias), and just getting the precession to add with[rzero~ 1] | [wrap~]
-
here's my 'ELSE' version. No phase output, no phase reset, signal input and able to set seed
I still wanna check the algorithm, I don't really get it
-
@porres I leave the explaining to @seb-harmonik.ar, but I'm wondering if further optimizations may be possible:
-
Do we really have to scale the white noise going into [samphold~]? I don't think so.
-
Couldn't we use just one noise generator for both random variables? I mean, they are sampled at different times, so shouldn't this guarantee an uncorrelated outcome anyway? Not sure about that ...
-
-
ok, I see that you're going for period transitions in the [phasor~], well, this can be drastically simplified with [else/pimp~]! Let me think
-
So, what we need is just an impulse randomly placed within period, this could be done by modulating the phase of [pimp~] quite easily!
-
nah... it does output impulses more frequently...
-
what I don't get is why you need to add to a multiplication of the frequency and the sample rate period, can you explain that @seb-harmonik.ar ?
-
New ELSE version
Just a single noise source, no [expr~] and no copysign, which might be expensive and also the way I'm doing it now has "real zeros". I was very annoyned that the other version had a bunch of "-0" (minus zeros) values!
-
@porres Ah, now I see the problem ... (so I'll try to explain anyway)
By multiplying the frequency with 1/SR you get the phase increment of the phasor. Since there is exactly one sample in each cycle where the sum of the current phase and the increment gets bigger (or equal to) 1, you get the impulse. Now all you have to do is to randomize the phase to get the impulse at a random position.
I'll have to take a look at your new version ... (Still I don't think the noise scaling and [+~ 0.5] are necessary.)
Edit: Just noticed that you have ">" instead of ">=" in the [op~].
-
new version, seems more elegant to just use [pimp~] and use it to trigger a random number generator
-
This post is deleted!
-
This post is deleted!
-
Ok, a much simpler approach now, I believe.
Never liked using the samplerate to add an increment, and wrap~ and everything, so what we need is just being able to catch the transition above 1 and make it an impulse out of it, so [op~ >= 1] into [status~] solves that!
-
damn, I have so many tools in ELSE that generates impulses that even myself can forget what is the best to use sometimes. It turns out I just need [above~] for this... and [chance~] also needs seeding
-
@porres said:
Never liked using the samplerate to add an increment, and wrap~ and everything, so what we need is just being able to catch the transition above 1 and make it an impulse out of it, so [op~ >= 1] into [status~] solves that!
Well, it may not be nice, but it was my attempt to solve the problem of missing periods (see further up in the thread). If you have a phasor cycle of, say, 0.1 - 0.3 - 0.5 - 0.7 - 0.9 - 0.1 - etc., then adding small random values to it won't give you any transition above 1.
Edit: ... and the critical case of a cycle 0 - 0.2 - 0.4 - 0.6 - 0.8 - 0 - etc. may illustrate why you need >= instead of > in the [op~].
-
FWIW I think in SuperCollider this would all be just
Dust2.ar(density).sign
where density is the average number of pulses per second. (Edited fromDust.ar
-- Dust is positive only; Dust2 is positive or negative.)hjh
-
@ddw_music Shall I ban @ddw_music for blatant promotion of SuperCollider on this forum....?
Just joking....
David. -
@ddw_music I mentioned about dust, I have ported both to ELSE, but the density parameter is kina bogus and doesn't behave like the algorithm we're working on here, and I like the way velvet~ works better by the way, it's less random.
And beware of getting banned!!!
-
@manuels said:
Well, it may not be nice, but it was my attempt to solve the problem of missing periods (see further up in the thread). If you have a phasor cycle of, say, 0.1 - 0.3 - 0.5 - 0.7 - 0.9 - 0.1 - etc., then adding small random values to it won't give you any transition above 1.
Edit: ... and the critical case of a cycle 0 - 0.2 - 0.4 - 0.6 - 0.8 - 0 - etc. may illustrate why you need >= instead of > in the [op~].
I know you needed it for the vanilla implementation, but I thought I could have a simpler and more elegant solution with the ELSE objects
-
this doesn't add any new concepts and in case of a samphold~ value of 0, it will not cross 0 - so it's certainly missing a few impulses as stated by @manuels ... but besides that, i wonder if i'm missing anything with this simple approach?
(in this case with ELSE's zerocross~ for upward-crossing detection - but a vanilla option would also be possible with 3 more objects iirc)
EDIT: patch: velvet~.pd
EDIT2: ... and a noise value of 0 will not have a sign to copy in this case viax/abs(x)
, but result in a factor of 0 - so it will obviously prevent an impulse output. and if you know about the efficiency of(x+1)/2
vs.x*0.5+0.5
, let me know.
EDIT3: i guess that the/~ 2
is not a good idea here ... i saw in the past thatpow~
is quite a bit faster with integer arguments - but i also saw that*~
is faster than/~
. and although i don't know much about the details going on there, i assume that float division won't profit much from an integer divisor ... anyway, this is getting a bit off-topic.