genitive -- sharing a tool for importing genexpr scripts

jvkr's icon

As I was writing quite a bit of genexpr script recently using an external editor, I created myself a tool that makes it easier getting that script inside max from the editor. Maybe it is helpful for others too.

This tool consists basically of a max patch named genitive as well as an abstraction. These are all the required elements: https://jvkr.nl/public_downloads/max/genitive_240425.zip

And this is a video explaining how it all works:

Shakeeb Alireza's icon

@JVKR

Nice. Thanks for sharing your solution. It is pain to work with code in Max and generally better to use an external editor, but even obtaining the external editor programmatically from a Max patch requires some additional effort.

I'm curious about your mechanism to auto-reload the patch. You comment on it in your jx.gdspimport.js file :

Finally, reloading the parent patch is required (a reload message does not suffice)

Is this a manual reload or did you manage to auto-reload it in your solution? Your video gives the impression that it does. Or perhaps I'm mistaken.

I find this particularly interesting because I haven't found a way to force Max to auto-reload a patch from within Max. This would be particularly useful for my py2max library, which provides for offline generation of Max/MSP patcher (.maxpat) files.

Paolo Piaser's icon

Very very nice package!! Thank you so much for this!

jvkr's icon

@paolo my pleasure!

@shakeeb

Thanks for your interest. The patch indeed reloads automatically. It is using the option to send the name of a max patch into a pcontrol object.

Max Patch
Copy patch and select New From Clipboard in Max.

Shakeeb Alireza's icon

@JVKR

Thanks, very nice idea and implementation!

Graham Wakefield's icon

Cool!

There was a thread of discussion on the Discord gen~ subchannel a few months ago, and a similar but slightly different solution came up, using a Node.js script IIRC. Basically it injects the genexpr code into the first codebox it finds in a gendsp file.

One thing to note that might be useful for genitive: if you modify a gendsp file, gen~ will automatically reload it. So there's no need to reload the whole patcher!

Also if you happen to use VS Code as editor, somebody wrote a genexpr language config for it here: https://github.com/larme/GenExprForVSCode

jvkr's icon

Thanks for the pointers @Graham. Good to know about VS Code. Concerning the automatic reloading, that doesn't seem to happen here, but I'll look into it.