In Pd of course, anyone?
-
looking for velvet noise generator
-
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. -
@ben.wes Beat me to it...
David. -
@ben.wes just fyi, * is more efficient than /
I believe pow is less efficient than either but haven't checked -
@seb-harmonik.ar said:
* is more efficient than /
yep, that's certainly true, thanks! - had measured this in the past as well (and commented above). i was just naively thinking that it might make a difference whether the argument is an int or float (which is the case for pow ... [pow 2] is faster than [pow 2.01] for example). but this thought doesn't make any sense here.
-
I think some of these have the same issue as my original implementation - if the generated random phase is less than a sample increment and the phase wraps around it will never be bumped to above 1.
e.g. at 1/4 sample rate samples would be 0, 0.25, 0.5, and 0.75. if generated random value is >=0 and < 0.25 no value will go above 1
edit: @ben.wes not sure but everything in pd is a float
edit2: similarly we have to think about cases where random phase is between 1-(sample increment) and 1. Because it could bump the generated values to always be above 1 in cases where the phase wrap around of phasor~ doesn't start at 0. (in which case there would be no transition either) -
@seb-harmonik.ar said:
if the generated random phase is less than a sample increment and the phase wraps around, it will never be bumped to above 1
certainly true in my case, yes - there are missing impulses:
-
@ben.wes As I understand velvet there have to be missing impulses as it should be more sparsely populated than white noise. It's a question of how sparse maybe, but certainly that the sparseness cannot be regular and produce a psychoacoustic audible tone......
.... maybe....
David. -
an audible tone would come from period regularity. As I see it it must have an impulse at each period indeed. Haven't tested my patch like that, could you do that too @ben.wes?
-
@whale-av the version in the paper that this is based on has one impulse every period, randomly distributed somewhere within it.
-
@porres in my version I added controls for period regularity and polarity bias.
Setting period regularity to '0' constrains the random phase range and polarity bias controls the offset of the noise that chooses the polarity (copysign)
so if you set the regularity to 0 and polarity bias to 1 you get a (aliased) regular pulse train -
@seb-harmonik.ar said:
@porres in my version I added controls for period regularity and polarity bias.
Setting period regularity to '0' constrains the random phase range and polarity bias controls the offset of the noise that chooses the polarity (copysign)
so if you set the regularity to 0 and polarity bias to 1 you get a (aliased) regular pulse trainI did not get any of this sorry... what is any of it good for? can you try and ellaborate?
-
you mean like you can choose how much of it is positive or negative?
that'd be easy with the probability parameter of [chance~] but I don't see any benefit in that.
-
as far as i can see, all versions here potentially drop impulses? feels like this shouldn't be hard to solve - but i don't see how, i admit. and i probably also should check the previous versions in more detail to really understand them!
another simple approach is this, where i'm trying to detect the significant wrapping for each cycle. this also leads to some dropped impulses - but it also adds some ...
patch: velvet~.pd