Lich CV input for CLOCK?

Hi,

I’m having trouble. I don’t understand how to use a CV input on a Lich knob as a simple on/off switch to generate a clock signal in PureData. My problem seems to be that every movement of the knob refreshes the data, which makes sense, but I can’t get a clock signal from it via trig signal from my seq…

Here’s a screenshot of the “taptempo” patch, which should work perfectly via a gate input.

If anyone has any ideas that could make this possible, that would be fantastic, thanks!

Do you mean CV or Gate? These are different things of course :wink:

The Lich template does it a bit differently: https://github.com/Befaco/Lich_Witch_Patches/blob/main/PD_template/Lich_PD_template.pd

But I would just do this:

2026-02-19_01-07

Because why do a counter when you can just time between bangs?

1 Like

Thanks !

Yep, I suppose your simplification of the patch is good, I just reproduced a tutorial found on the internet, I work empirically, but once my patches work I refine and optimize the patches later as my understanding grows.

In short, my problem is that the lich only has two buttons, and that I already use them, until now I used a knob to control a range of bpm values (example 60 bpm knob at minimum and 180 BPM knob at max), but in practice the precision is not great, and it is not super stable either depending on the temperature and electrical consumption, in short, I wanted to try to transform the knob into a signal “on/off” to make it a trig receiver, but because of the refresh of the knob, I ultimately only get the measurement of the refresh itself which reacts to the trig that I send in the CV rather than the measurement of the intervals of the trig impustions…

Ah now I understand, you can’t use the gate inputs because they are tied to the buttons.

I’m trying something like this and it seems to work ok:

Make sure that the knob is completely turned down and the CV attenuation completely up/open!

1 Like

Thanks for your help!

I just tested it, but it’s the same result. Once the signal exceeds 0.5, a 1 is indeed output, but it’s multiplied by each tiny movement of the voltage, which gives the timer the measurement of the potentiometer’s refresh rate…

I suppose what I’m looking for is a way to only get a 1 if a 0 has been emitted beforehand. That way, the program could only receive one 1 and wait for a 0 before allowing another 1… if that makes sense…

Try doing tap tempo with a Pure Data fader using a mouse, you’ll understand the problem immediately!

It’s been a while since I last programmed anything in Pure Data, but yes, you need some kind of boolean to keep track of when your threshold has been passed.

In pseudo code, it would be something like:
// init once
knob_value = 0.0
bool = false // (or 0 in PD)

// here is your loop when the knob_value is updated between 0.0 and 1.0
if (knob_value >= 0.5 AND !bool) OR (knob_value < 0.5 AND bool) // parenthesis for clarity
then
bool = NOT(bool)
bang! // (to send to your timer)
endif

1 Like

Hmm, I’m not able to get something functional yet, but we do have basic [expr] support now, so that should help with implementing some conditional logic.

1 Like

The inversion of the bool can be done with just a regular number, and you can implement a basic counter and add a modulo object (% 2) in the loop after the + 1 object, if that helps! Every bang to your number would go 0, then 1, then 0, then 1, etc.

1 Like

Hahaha, Mikro93 you speak to me in gibberish ! :sweat_smile:
I am years away from linear code unfortunately, but very clearly this is what is needed for this kind of function which on paper seems very simple, but very difficult to do with visual modules… Thank you very much in any case!

Thanks also Dreamer, I didn’t know that [expr] was supported, I tested it a while ago and it didn’t work…

Is it an update to be done for the OWL itself or is it Plugdata/Compiler that needs to be updated? :thinking:

It was added in the maintained version of the Heavy Compiler that ships with the plugdata toolchain.
It’s available in plugdata v0.9.2 but still gives warnings there, update to the latest v0.9.3 to get the best integration.

It is not present in the (by now very outdated) Heavy Compiler that is on the Rebel Tech online patch library.

1 Like

Thanks!

Indeed, I received an update to the Plugdata Toolchain a few days ago!

I’ll test it!
I know an experienced programmer who could probably help me create the [expr]; I’ll come back and post an update once the patch is finished and working!

1 Like

Hey,

This will do what you want:

image

My pseudo code was probably not entirely right (edit: I think it was? I’m so confused with the way PD handles its ins and outs and sequences… anyway), but I tested this in PD and it works as you want, I think :slight_smile:

1 Like

Ps; atm a limitation of the Heavy implementation of [expr] is that you can’t have multiple expression is a single box :wink:

1 Like

Gotchu! And the first expr $f1 >= 0.5 can be replaced by a simple >= 0.5

2 Likes

Thank you so much Mikro93!!!

It works in Pure Data, although it seems to send a bang when the 0 is hit, but oh well, you just have to divide the result by two.

However, when I compile the patch in PlugData, I get a compilation error message, but maybe my version is outdated, I’ll have to check… I’m on Ubuntu, I also tested it on Windows 10, but on Windows I can’t even compile a basic patch with PlugData 9.3… :sweat_smile:

Anyway, thank you very much everyone, it is very encouraging !

Can you share the error? v0.9.3 is the latest.

(ideally also share a minimal version of the patch)

1 Like

Here’s the compilation error message. I’m on version 9.2, and I haven’t taken the time to upgrade to 9.3 on my Linux system. I’m a Linux newbie and still struggling to understand the different ways to install software, so I’m proceeding cautiously…

Anyway, here’s the prompt:

Command: “/home/user/Documents/plugdata/Toolchain/bin/Heavy/Heavy” “/tmp/temp_91a07ee9.pd” -o “/tmp/Heavy-c342e384a5b20794576bb5” -nLiverTapTest -v -gOWL -p “/tmp” “/home/user/Documents/plugdata/Abstractions/else” “/home/user/Documents/plugdata/Abstractions/cyclone” “/home/user/Documents/plugdata/Abstractions/heavylib” “/home/user/Documents/plugdata/Abstractions” “/home/user/Documents/plugdata/Externals” “/home/user/Documents/plugdata/Extra/else” “/home/user/Documents/plugdata/Extra/Gem” “/home/user/Documents/plugdata/Extra”
→ Generating C
→ Generating GUI IR

  1. e[91mErrore[0m pd2hv: in “” @ (x:0, y:0): ‘PdExprObject’ object has no attribute ‘expressions’
    Total compile time: 25.40ms
    Compiling…
    Building patch LiverTapTest
    In file included from ./Source/PatchProgram.cpp:14:
    …/registerpatch.h:1:10: fatal error: HeavyOWL_LiverTapTest.hpp: No such file or directory
    1 | #include “HeavyOWL_LiverTapTest.hpp”
    | ^~~~~~~~~~~~~~~~~~~~~~~~~~~
    compilation terminated.
    make[1]: *** [compile.mk:169: …//PatchProgram.o] Error 1
    make: *** [Makefile:110: patch] Error 2

And here’s the PD patch file:
TAPTEMPO.pd (1.0 KB)

Ok the issue is with your expression being “multi-line” aka ending in ;
Remove this from both expressions and it should be fine.

There should also be no space between if and (. The compiler is a bit more pedantic about some of the syntax being exact.

I will look at implementing multi-line expressions in the future though!

2 Likes

Thanks!

It seems to work in the compiler!

I haven’t had time to test it with Lich yet, but I’ll come back and give you an update!

Thanks again to both of you, you guys are awesome!

2 Likes