It seems that there isn't one in the standard library.

But the triangle wave in the standard library is made by integrating a
square wave. Analogously, you can construct a var saw by integrating
the pulsetrain oscillator, which is essentially a square wave with
duty cycle parameter.

import("stdfaust.lib");
varsawN(N,freq,duty) = os.pulsetrainN(N,freq,duty) : fi.pole(p) : *(gain) with {
        gain = 4.0*freq/ma.SR; // for aproximate unit peak amplitude
        p = 0.999;
};
varsaw = varsawN(2);
process = varsaw(220, hslider("duty cycle", 0.5, 0, 1, 0.01)) <: _,_;

This looks and sounds right around the middle, but unfortunately it
fades away to zero at either extreme (i.e. as it approaches saw
shape).

Not perfect, but it's a start.

Cheers,
James

On 9/14/21, Roger Pibernat <rogerpiber...@gmail.com> wrote:
> Hi,
>
> just starting with Faust, with quite a few years of SuperCollider behind my
> back but no math background whatsoever.
>
> Is there such a thing as a variable saw wave oscillator in Faust?  I'd like
> to be able to modulate between saw <> triangle <> ramp.  I cannot find it
> in the docs.
>
> I thought I could maybe feed an en.ar() into a phasor, but it doesn't seem
> to work (because an envelope is not a table?).
>
> How could it be done?
>
> cheers!
>
> Roger
>


_______________________________________________
Faudiostream-users mailing list
Faudiostream-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/faudiostream-users

Reply via email to