ModScript: Using scripts for a better and richer integration with MIDI controllers (beta soon!)

Good evening! I’m happy to announce some progress: I’ve fixed a few minor issues and ModScript is now compatible with Windows! Thanks to @Steve_Russell for reporting the issue

While doing so I went ahead and prepared plugin packages for Linux and Windows, I’m offering these in an almost beta stage for curious users and developers to test it! The following explains why I’m cautious about that.

:warning: Please read: By offering to run scripts from unknown and/or unverified sources, this plugin has a few security implications, much like VCV-Prototype had too. I give you my word that I will do my best to protect against that and that I won’t attempt to run cryptocurrency stuff remotely on your computer or anything harmful. The best security is still your understanding and alterness about this!

Download links, the file are hosted on my website (links and files updated to latest post) :

The source code of these builds is up-to-date, find it here.

Because it is such an early release, I don’t recommend at all to start serious work using ModScript although most of the API shouldn’t change too much. I also do not recommend trying to run complex Lua scripts including existing libraries etc., as I have found out myself that this is a bug/limitation in the build system currently. That being said, I would be very happy to know that is does work for the basic stuff demonstrated below! And if it doesn’t… well, sorry!

Instructions

Once you have installed the plugin, click File > New to get the default Rack patch, add Pleine Lune, select keyboard.lua in the right-click menu, select the Keyboard input as MIDI driver, check the script and see what happens! That script has a lot of comments to help writing your own, don’t hesitate to ask here and suggest additional help! Thanks.

During the development of scripts I find myself heavily relying on the display() function to print info and debug things. On Linux you can view it by running: tail -f ~/.Rack2/log.txt. The equivalent for Windows is to run this in Powershell: Get-Content log.txt -Wait (you have to cd to Documents/Rack2 first, this is where this log file is located)

Future

Things that are expected to change:

  • Module size and layout, 4 in/out isn’t enough, I’d like to make it a little wider and maybe a little screen. Also leds for midi device and script status.
  • Script files locations: for now they are in the plugins folder (Documents/Rack2/plugins/ModScript/scripts on Windows), I would like to have them directly in the Rack2 folder in a ModScript folder.
1 Like

Too bad your build is not glibc 2.31 compatible (Debian Stable).

The Maschine hardware (mk3 and Jam) will send and receive on the same MIDI channel & CC/note for each button or fader assignment. So you can have bidirectional communication of state for the faders and buttons, yes.

Thanks for the report!

I’ve worked on the build system so that it’s fully compatible with the official toolchain, it was a little harder than for usual plugins because of the dependency on Lua but it’s all good now!
ModScript now uses a more recent version of Lua though it doesn’t bring anything noticeable so far, I hope I can benefit from that improved and better maintained version for upcoming features!

For the sake of better compatibility, here are new builds that should be more compatible:

I have researched possible solutions for quickly bringing OSC support, some work is still needed but it should happen within the next week or so!

2 Likes

I wonder if that Is why VCV-Prototype has not been ported to V2? Sorry - I know this is off topic. Is there a topic that discusses Prototype vulnerabilities?

Well the modules load!

Now to have any clue how to use them :wink:

How’s it going on ModScript? Anybody out there able to make a macOS build for me to test?

Thanks for checking back here! OSC send and receive is tested and working, I just need to work out an API in the script and the ability to set the ports.
I assume most here will be interested to use it with TouchOSC?

I’ll keep in mind the need for a macOS build, as I should now be able to provide one.

3 Likes

Awesome! Excited to try it out.

Yes on TouchOSC for me, though I’ll be testing the MIDI functionality first.

1 Like

Agreed on TouchOSC. Will be using that and Mac.

1 Like

TouchOSC, OpenStageControl, monome norns and usb connected microcontroller boards.

https://openstagecontrol.ammd.net/

Esp32 Simple Osc Receiver

osc | monome/docs

GitHub - RuudMulder/SlipOscBridge: Bridge for connecting Slip to OSC (UDP)

GitHub - CNMAT/OSC: OSC: Arduino and Teensy implementation of OSC encoding

1 Like

I saw the git issue regarding socket connections from LuaJit (needed for OSC support). Bummer!

Other projects (1) out there have socket connections, but I guess that the source cross-platform compatibility demands and VCV build environment makes it difficult to come up with something that works here.

I hope you figure it out. If not - it will be a cool addon even if it “only” supports MIDI.

Reading the issue, it seems the issue is doing sockets from Lua, not sockets in general.

1 Like

I hope the edited post makes more sense.

1 Like

Thanks for checking back here again! This is good timing as I’m about to finish another project and get back to ModScript. In the meantime I worked on 2 more modules that I wish to announce shortly!

As I said before, OSC is now working, I just haven’t closed the issue yet. I realise I haven’t even pushed to the repo.

I ended up using 2 OSC libraries, one in the module code and one in the Lua scripting engine. This will make the code more portable and reduce potential vulnerabilities in the scripts; the downside is Lua scripts will only get OSC, no standard networking which might also be useful at some point.
Hopefully that clears any doubts!

In addition to TouchOSC I will definitely make tests using OpenStageControl!

3 Likes

Hey!

Look at that! OSC is here!
Scrolling the window from TouchOSC on my phone:

There are also now builds for Windows, Mac and Linux:
:floppy_disk: Release Nightly releases updated on each push · Simon-L/ModScript · GitHub

:warning: Sadly I cannot test the Mac builds because I don’t own or have access to a mac.

Edit: Apologies I’m taking that back real quick I forgot to add the OSC library files to Lua, it’s not hard to fix it manually though! I’ll update asap
Edit2: All good now! I will create and document some examples using OSC.

7 Likes

Hi Lumis,

I’m really excited to see if I can use Modscript in coordination with my Voxglitch Groovebox module in order to allow users to “script” advanced features and automations. Thank you for building such an interesting module!

1 Like

@FergusL Do you plan to share your plugin at the official VCV library?

1 Like

I am also interested in having a way to “script” my Meander module. But, it is hard for me to tell from this topic whether this is a viable path to go down.

1 Like

@clone45 @k-chaffin Thank you for your interest in this!

To put it in a developer way: any parameter that you declare in the ParamId enum will be available to the script using the index in the enum like __setParamValue(moduleId, indexInEnum, newValue)

It’s even possible to add parameters to a module without exposing them on the panel, of course the users couldn’t interact with it but ModScript could if you know the right parameter id! (Or any other module relying on parameters ids actually) And the state would be saved in the patch, of course!

It’s interesting that you are both interested in expanding existing modules using scripting as this is also what I ended up needing. I would like to have that in VCV Rack, something like a rack-wide messaging bus that modules could subscribe to and unlock special features.

“Oh, I’m a VCO and there’s a Voxglitch Groovebox in the patch?! Nice! Let me see how many samples it has loaded currently and I’ll automatically make as many polyphony voices!”

Anyway, back to ModScript, I recommend looking at what LuneHelper shows for various existing modules: some modules have special toggles and buttons that are not actually parameters, so they aren’t exposed to plugins like ModScript.

Also sorry about the long delays here, both in replies and updates to the code, as I’m working on other projects! I prefer not making any promises as to what and when but ModScript is certainly not abandoned!

2 Likes