< Back to IRCAM Forum

Pattern Library - automatic eval of set-pval


In my patches I am using a series of set-pval function from the Patterns library. Every Time I open a patch, or the incoming data changes I have to (re)evaluate each set-pval individually in order to get/change the data sent to get-pval. Is there a way to automatize this process? (In other words, when I reopen a patch or change the incoming data, I would like to have automatic (re)evaluation of the set-pval function (or even a series of it.)

All the best!

Hi aliser. Please provide a ‘minimal test case’.

Dear Anders,
In order to recive the data on the output get-pval I have first to evaluate set-pval. (Otherways the variable is unbound".)
If I change the data at the value input of set-pval, without evaluating it again, the get-pval outputs the old (previous) data.
In other words, for every opening or change of the input data to the set-pval
I have to (re)evaluate set-pval.
Hence my question: is it possible to automatically trigger the evaluation of the set-pval by a change of the input data, and/or by opening a patch?

Here the example patch:pval check.omp (2.5 KB)

Hi Aliser.

I’m not sure i completely get what your needs are, esp. why you choose to store values using the pval (‘pattern-value’) mechanism. ‘pval’ - together with set/get-pval - is a rather specialized system, to allow to embed values to be evaluated later inside fixed structures (ie. nested inside a pattern structure). Perhaps if you send us a patch where you actually use this someone could suggest a solution?

‘pval’ is implemented using closures in a null lexical environment. I could reimplement this as a class, and set up methods for all the standard OM book-keeping (omng-save etc.) which would take care of handling the values between invocations. Hmm…

I dont think there’s any *load-hook* functionality upon loading patches in OM6, however something like this could well be useful. Hmm…

Dear Anders,
Thank you for your reply!
As matter affects I use set-pval (and corresponding get-val) for remote messaging (like in Max) in order to send values to control patches I have built. This enables me to see the results of manipulating of the incoming data displayed in a control subpatches. (If I connect a subpatch by a cord, the changes cannot be displayed inside a subpatch. The other way to get the results of manipulation of data of multileveled / multilayered processes in a subpatch is by subpatching each level of the process, so that the basic patch is the deepest subpatch. It is tiresome to reopen all the subpathes every time I want to reach certain level of a process. Using remote messaging (set-pval ->get-pval) enables me to control each level / depth of the process while not exceeding the the first level of subpatching. In other words, so I can control and manipulate different layers of a multilayered process in a single patch.
Yet, the only problem is that every time I open a patch for a new session, or change the incoming value, I have to reevaluate set-pval in order to get “remote messaging” working.
I am aware that the real remote messaging (like in Max) is not quite applicable in OM, but I was wondering if it would be possible to trigger the evaluation automatically by: a) opening a patch and / or b) changing the incoming value.
I hope I made my question more clear.
Here I am sending an example patch.pval check.omp (137.4 KB)
Thank you once more!

All the best!


The ‘pval’ mechanism is meant for something else, to delay evaluation within structures (ie. patterns). In your case I beleive you instead should look at global variables:


which will provide the qualities you want, interaction within subpatches, and store/save between sessions.

Check this example patch: