Faust with Lich - Help with V/oct or just help debugging

Hi all,

Looking for help on my faust code getting v/oct working.
This works great on the faust web IDE minus the sample2hertz. I clearly do not understand what is going on here, I basically just copy/pasted the v/oct code from the “The Language” document.

declare owl "[voct:input]";


tune = hslider("Tune[OWL:A]", 0, -2, 2, 0.01);
res = hslider("Main Brightness[OWL:C]",0,0,1,0.0001);
drv = hslider("Carrier Drive[OWL:D]",0.01,0.01,1,0.0001);
fold = hslider("Carrier Cutoff[OWL:B]",1,.5,25,0.001);
freq = sample2hertz(tune);

mst = os.sawtooth(freq);
modcarrier = mst : ef.transpose(40,3,12)*drv+mst*(1-drv/2) : fi.lowpass(4,fold*freq/1.64);
osc = os.CZsinePulseP(modcarrier,res);

stereo_osc = osc  <: ef.stereo_width(0.35);
process = stereo_osc : _*0.8 , _*0.8;\

apparently something here has 7 inputs, I have no clue. It’s a coin toss on whether I don’t understand or missed something straightforward

The problem that prevents your patch from compiling is that the sample2hertz function takes 2 parameters

You can see that only the first one is provided in the example from a parameter:

    process = sample2hertz(tune) : os.oscs;

The second one comes from the first audio input thanks to FAUST’s support for currying

Effectively you can think of

freq = sample2hertz(tune);

being equivalent to

freq = sample2hertz(tune, _);

or even more explicitly

freq(sample) = sample2hertz(tune, sample);

So the way you use it makes it a function that accepts 1 input parameter and generates 1 output. And when you split it like that you add more inputs. I hope that gives you some understanding about restructuring your code, probably by rewriting modcarrier and osc sunctions to pass parameters correctly.

1 Like

Thanks, I should have given the .lib file itself a look. This information is incredibly helpful but I am a ways out from being able to understand it enough to go back and re-write the code, I’m gonna have to go read up for a bit first.

So I decided to just switch sample2hertz to volt2hertz to get around the two input problem. This does nothing to actually further my understanding of the system but oh well I suppose.

I will return to learning that on my own, but now I’m faced with another error that calls out libraries. code I’m trying to run:


tune = hslider("Tune[OWL:A]", 0, -2, 2, 0.01);
res = hslider("Main Brightness[OWL:C]",0,0,1,0.0001);
drv = hslider("Carrier Drive[OWL:D]",0.01,0.01,1,0.0001);
wfold = hslider("Carrier Cutoff[OWL:B]",1,.5,25,0.001);

freq = volts2hertz(tune);
mst = os.sawtooth(freq);
modcarrier = mst : ef.transpose(40,3,12)*drv+mst*(1-drv/2) : fi.lowpass(4,wfold*freq/1.64);
osc = os.CZsinePulseP(modcarrier,res);

stereo_osc = osc  <: ef.stereo_width(0.35);
process = osc <: _*0.8 , _*0.8;

And here is the error I am receiving. I can change the error by importing filters.lib directly, but the next error will be exactly the same save for a different lib file in line 1, whether or not that lib is imported.

ERROR : BoxIdent[si] is defined here : filters.lib:39
make[1]: *** [faust.mk:13: /tmp/owl/owl-build-Jz3fYk/Source/FaustPatch.hpp] Error 1
make: *** [Makefile:124: faust] Error 2
ERROR: Patch build failed.

My code works great in the faust web IDE when I remove volts2hertz, but at the same time volts2hertz doesn’t seem to be the problem here.

Any help would be appreciated!

Yeah, so currently OWL server uses an older version of FAUST and that’s why you can run into some bugs that have been resolved later and thus aren’t present in FAUST IDE or if you just build the same patch on your PC offline.

I think that you definitely run into an issue that got fixed with this commit: include signals.lib in oscillators.lib fixing CZ oscillators · grame-cncm/faustlibraries@2815f71 · GitHub

What can most likely fix your code is uploading a recent version of oscillators.lib along with your patch

Good to know! Do you know how I can upload the .lib file, or do I need to format it differently?

At the moment it will not allow me to upload a file with the .lib extension, so is there a way around this or would I have to go to more manual methods of compiling and uploading patches

Ah yeah, the list of available extensions is limited, so you would have to call it oscillators.dsp instead. Then you could do something like os = library("oscillators.dsp");.

This compiled, now to check if it does what I expected. One thing to note; you can’t use os here as you aren’t allowed to re-define it. I just called it oslib and replaced os everywhere used.

Also, thanks so much for the help!

Alright, going back to sample2hertz, I think I still have a fundamental misunderstanding about how something is working. I feel like I don’t understand how many inputs there really are at the beginning of the process and I don’t know what happens to those inputs.

I have been working on a deeper understanding of how faust works in this regard, and I need to look deeper into how the lich & owl lib work, if there’s a good repository of info on that besides the github examples I’d appreciate it.

So here is my new code trying to get sample2hertz to work. I’ve written it in a bunch of different ways but I always get the same result.


oslib = library("oscillators.dsp");
tune = hslider("Tune[OWL:A]", 0, -2, 2, 0.01);
res = hslider("Main Brightness[OWL:C]",0,0,1,0.01);
drv = hslider("Carrier Drive[OWL:D]",0.01,0.01,1,0.01);
wfold = hslider("Carrier Cutoff[OWL:B]",1,.5,25,0.01);

modcarrier(x) = oslib.sawtooth(x) : ef.transpose(40,3,12)*drv+_*(1-drv/2) : fi.lowpass(4,wfold * x /1.64);
osc = oslib.CZsinePulseP(_,res);
stereo_osc = _  <: ef.stereo_width(0.35);

process = _ : sample2hertz(tune) : modcarrier(_) : osc : stereo_osc : _*0.8, _*0.8;

edit: forgot v/oct declare here.