Just so you know, Julius' code gives me this assert on the IDE:

ASSERT : please report this message and the failing DSP file to Faust
developers (file: wasm_code_container.hh, line: 60, version: 2.54.11,
options: -lang wasm-ib -cn
a08c5ceec105cc33e58fe2dfaaa8d2f0a80eaf39e4a593811bb636d3de7a14d3 -es 1 -mcd
16 -single -ftz 0 )

Here is a non-delay-based alternative (tested very briefly, but it seems to
work):

 import("stdfaust.lib");

PI = ma.PI;
TWOPI = 2.0 * ma.PI;

phasor(freq, phase) = ma.frac((loop ~ _) + phase / TWOPI)
with {
loop(y) = ma.frac(freq / ma.SR + y);
};

tri(ph) = abs(ma.frac(ph - .25) * 4.0 - 2.0) - 1.0;
ph0 = hslider("ph0", 0, -PI, PI, .001);
ph1 = hslider("ph1", -PI / 2.0, -PI, PI, .001);
f = hslider("freq[scale:log]", 1000, 20, 20480, .001);

// Oscillation by phase-mod
// process = os.oscp(0, os.phasor(TWOPI, 1000)) ,
// sin(TWOPI * phasor(0, os.phasor(TWOPI, 1000))) ,
// tri(phasor(0, os.phasor(TWOPI, 1000)));

process = os.oscp(f, ph0) ,
os.oscp(f, ph1) ,
sin(phasor(f, ph0) * TWOPI) ,
sin(phasor(f, ph1) * TWOPI) ,
tri(phasor(f, ph0)) ,
tri(phasor(f, ph1));

Dr Dario Sanfilippo
http://dariosanfilippo.com


On Sun, 26 Feb 2023 at 00:28, Julius Smith <julius.sm...@gmail.com> wrote:

> Ok, I see it.  The implementation of os.lf_sawpos_phase is impulse-based:
>
> lf_sawpos_phase(freq,phase) = phasor_imp(freq, (1-1'), phase);
>
> This means it is only sampled at time zero.  For continuous phase control,
> you want something delay based, e.g.,
>
> lf_triangle_phase (freq, phase) = os.lf_triangle(freq) @ (phase *
> ma.SR/freq);
>
> Here is my updated test program (no scope needed - I used faust2caqt):
>
> import("stdfaust.lib");
>
> lf_triangle_phase(freq, phase) = os.lf_triangle(freq) @ (phase *
> ma.SR/freq);
> lfo_freq = hslider("[1] Freq", 0.5, 0.001, 50, 0.01);
> lfo1 = lf_triangle_phase(lfo_freq, 0);
> lfo_phase = hslider("[2] Phase", 180, 0, 360, 1) / 360;
> lfo2 = lf_triangle_phase(lfo_freq, lfo_phase);
> process =  lfo1, lfo2 : hbargraph("[3] 0",-1,1), hbargraph("[4]
> Phase",-1,1);
>
> On Sat, Feb 25, 2023 at 2:03 PM Christopher Arndt <ch...@chrisarndt.de>
> wrote:
>
>> Am 24.02.23 um 21:50 schrieb Julius Smith:
>> > Hmmm, it looks to me like it should be working.
>> > I adapted your test program for use with faust2plot, and it's working
>> > for me:
>>
>> Yes, it works, if the phase is set initially. But what I want is to
>> change the phase of one LFO at run-time with a parameter and that
>> doesn't seem to work.
>>
>> Here are two images, which demonstrate this, I hope:
>>
>> 1) your code (lfophase.dsp) compiled with faust2jack and its output send
>> into a stereo oscilloscope. the two LFOs have different phase
>>
>> https://0x20.eu/nc/s/kWSwRE2oHD4rStt/preview
>>
>> 2) The code from my original post (lfophase2.dsp) compiled with
>> faust2jaqt again with its output into the scope. I have set the phase
>> two 91 after staring the program, but the output as seen in the scope
>> never changes and the two LFOs are still at the same phase.
>>
>> https://0x20.eu/nc/s/Y47eaLK8DGZZTbk/preview
>>
>>
>> Chris
>>
>>
>>
>> _______________________________________________
>> Faudiostream-users mailing list
>> Faudiostream-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/faudiostream-users
>>
>
>
> --
> "Anything that can be automated should be"
> _______________________________________________
> Faudiostream-users mailing list
> Faudiostream-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/faudiostream-users
>
_______________________________________________
Faudiostream-users mailing list
Faudiostream-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/faudiostream-users

Reply via email to