Faust patch not working on device

Hi,

I’m working on a patch in Faust that works locally on my laptop and can be sent and compiled to Witch with no errors, but does nothing on the device nor the website, there’s no sound in either.

I tried a test patch I did myself and works fine. Not sure what’s going on. Any ideas?

Here’s the code:

declare owl "[voct:input]";
declare options "[midi:on]";
import("stdfaust.lib");

btA = button("A[OWL:ButtonA]");

freq = hslider("freq[OWL:A]", 72, 20,127, 0.01) : ba.midikey2hz;
harmonics = hslider("harmonics[OWL:C]", 0.0, 0.0, 100.0, 0.001);
timbre = hslider("timbre[OWL:C]", 0.5, 0.0, 1.0, 0.001);
morph = hslider("morph[OWL:D]", 0.0, 0.0, 1, 0.001);
gain = hslider("gain[OWL:E]", 0.3, 0.0, 1.0, 0.001);

mapvalue(inmin,inmax, outmin, outmax, x) = (x-inmin)/(inmax-inmin) * (outmax-outmin) + outmin;

// variable saw that morphs between saw <> tri <> ramp
// width: [-1,1] -1=saw; 0=triangle; 1=ramp
varsaw(freq, width) =  trig : en.ar(atk, rel) : dcleak
with {
  clipwidth = max(-0.5, min(0.5, width));
  atk = (0.5 + clipwidth) / freq;
  rel = (0.5 - clipwidth) / freq;
  trig = os.lf_imptrain(freq);
  dcleak(x) = (abs(x) - 0.5) * 2;
};

// variable saw with notch: 0=tri <> 0.5=ramp <> 0.5<increasing-notch
varsawpulse(freq, width) = combo, tri : ba.if(width >= 0.5)
with{
    pul = os.lf_pulsetrain(freq, width : mapvalue(0.5, 1, 1, 0)) : ma.neg;
    tri = width, 1 : ba.if(width <= 0.5) : varsaw(freq);
    combo = pul, tri : ba.if(pul >= width);
};

// FIX: should be hard sync pulse
// pulsewave(freq, width) = os.lf_imptrain(freq) : en.ar(1/freq, 0) < width : abs - 0.5 : _ * 2;
pulsewave = os.pulsetrain;

pulwidth = timbre > 0.5, 1 - timbre, 0.5 : select2;
pulfreq = timbre > 0.5, freq, freq * (timbre : mapvalue(0.5, 1, 1, 16)) : select2;
vsaw = varsawpulse(freq, morph);
pul = pulsewave(pulfreq, pulwidth);
dcleak(x) = abs((x - 1) / 2);
out = (vsaw + dcleak(pul)) + pul;

process = out * gain <: _,_;

declare options "[midi:on]";

This makes your patch to control freq/gate/gain variables by MIDI, so parameters A & E are no longer controlled by knobs/CV in this patch.

1 Like

That was it. Thanks!

Right, so that metadata declaration is only used to enable hijacking those 3 variables, making your patch behave like a MIDI-controlled mono synth voice. When you don’t set it other MIDI related stuff is still working, i.e. you can set parameter/button values by MIDI. It’s done like that because a patch can either use variable controlled by OWL parameters or by MIDI events, but not both at once.

1 Like