Phasor, but with audio rate ‘rate’?

Hi all,

I’m trying to make an audio rate signal that adds its previous value to a sample of another audio rate signal, and wraps within a certain range. Phasor.ar doesn’t work for this as it seems to read any ‘rate’ input as control rate. The below example works using Integrator.ar and Wrap.ar, but I’d prefer to avoid eventual loss of significance.

s.quit; Server.local.options.blockSize = 4; s.boot;

(
{
    var noise = WhiteNoise.ar;
    var integrate = Wrap.ar(Integrator.ar(noise / 5), -1, 1);
    [noise, integrate]
}.plot(0.002)
)

Any solution would be much appreciated.

You should be able to get the same behavior as Phasor using LFSaw, if you calculate the frequency parameter correctly. I believe freq should take audio rate input.
And in incidentally - feel free to file the “Phasor doesn’t support audio-rate rate param” as a bug / feature request on GitHub. I can’t see a good reason why it can’t do this.

Can you post an example of some code that has this problem. I think I’ve identified the problem in the code, but it would be good to have an example of some problematic code so I can confirm that.

Here’s an adaptation of the first example; ‘integrate’ and ‘phasor’ should look roughly the same.

s.quit; Server.local.options.blockSize = 4; s.boot;

(
{
    var noise = WhiteNoise.ar.range(-0.2, 0.4);
    var integrate = Wrap.ar(Integrator.ar(noise), -1, 1);
    var phasor = Phasor.ar(Impulse.kr(0), noise, -1);
    [noise, integrate, phasor]
}.plot(0.001)
)

Would a more musical example be of use?

Does the following do roughly what you expect:

(
(
{
    var noise = WhiteNoise.ar.range(-0.2, 0.4);
    var integrate = Wrap.ar(Integrator.ar(noise), -1, 1);
    var phasor = Phasor.ar(Impulse.ar(0), noise, -1);
    [noise, integrate, phasor]
}.plot(0.001)
)

If so, I think I know what is causing this. Somebody transposed two functions in the UGen code.

Wow. It does. It took me way too long to see the difference. And this is a perfect workaround until a fix is merged. Thanks!