Feature suggestion: JSFX support

As I’m sure most people here know, JSFX is a high-level, runtime-compiled, open source language for rapid audio and MIDI plugin development that is built in to Reaper. There is also an official plugin version that allows JSFX programs to be used in hosts without native support, but it’s VST2 only and hasn’t been updated since 2016.

There is, however, an open source JSFX hosting library available. The official distribution only includes VST3 and AU plugins but it seems like a good starting point for an LV2 JSFX host, or better yet direct support for JS code.

Why would this be worth the trouble?

First, there is a very active JSFX development community that goes back nearly 20 years, with thousands of (often very high quality) JS plugins already available, good documentation, plenty of tutorials and an active development forum. The Tukan Studios plugins alone are a good case for adding some kind of JSFX support.

Second, and more important IMO, it seems ideally suited for developing custom effects and isntruments directly on the Zynthian hardware. It’s low level enough to develop pretty sophisticated plugins but high level enough that coding directly on the Zynthian’s display with only a wireless keyboard is realistic (unlike Puredata). While it’s possible to make JSFX plugins with complex GUIs, its main focus is minimalist interfaces and that would translate well to Zynthian’s UI.

It just generally seems like it would be a really handy tool to have available on the platform relative to the difficulty of adapting the existing library, even if it’s just an LV2 port of the VST3 plugin that the library includes (but then I’m not a programmer so I could be underestimating how difficult that would be).

EDIT
Imagine this scenario: It’s two hours before your show and you think of some simple but esoteric tool that isn’t available but would be perfect for an improvised section in the middle of your set. You walk to a restaurant down the street from the venue, order dinner, connect the little Bluetooth keyboard you keep in your bag with your Zynthian, and while you wait for your meal you write a proof of concept JSFX version of your idea. After you eat you get back to the venue with an hour to spare, which is enough time to test your code, implement a few changes and bugfixes, and get it to the point where you can use it during your set. Later that week, you clean up your code and add a few features over VNC from your laptop and it becomes a mainstay of your set.

4 Likes

Interesting. There are various approaches to building plugins. You can use JUCE or DPF if you are a reasonably adpet programmer or can just go full dev mode and use c/c++ and LV2 directly.

ysfx uses JUCE so in theory should be able to build as an LV2 plugin in which case it could be integrated into zynthian. Of course the devil is in the detail. Just because something can theoretically be integrated does not necessarily mean it makes sense to do so or that such an integration will be practical for users.

I started it off compiling - let’s see what it gives us…

Well, it requires more /tmp than we have so first we need to temorarily tweak our mount config.

[Edit] It built the VST and even included a LV2 object file but by default it does not build a LV2 plugin version. I don’t have time to persue this now.

1 Like

The big reason I think it would be a good addition (other than the huge existing library of free JSFX plugins) is that it is so well suited to coding quickly, directly on the zynthian. Even as a non-coder I tinker with it in Reaper sometimes (mostly tweaking existing stuff) and the code is terse enough that I rarely need to expand Reaper’s built-in editor beyond its default size, which is pretty comparable to the 5" standard Zynthian display.

It’s not going to replace something like Supercollider (a “real” programming language, of course) in terms of depth, but it’s really fast to work with and can absolutely produce results that compare well with commercial plugins.

Seems like a prefect sort of “Swiss army knife” addition to the Zynthian.

Incidentally, a lot of the (amazing sounding) Airwindows plugins have been ported to JSFX already, which could be an alternative to the LV2 consolidated plugin discussed here, if the control naming issue isn’t solvable.

But how it would work in practice is, of course, another matter. Hopefully you or someone else has time to take this further, if I had the experience to do it myself I would.

Okay - sleepless night so I got up and had another look at this…

  • In file ../cmake.plugin.txt I replaced FORMATS VST3 AU with FORMATS LV2.
  • I had to run DISPLAY=:1 cmake --build . because the build fails otherwise. Probably a test in the build process that requires X.
  • The build installs files into ~/.lv2. (I would expect to have to run an install for this to happen!)
  • Running DISPLAY=:1 jalv.gtk file:///plugins/ysfx fails with error: lilv_plugin_instantiate(): error: No plugin <file:///plugins/ysfx> in <file:///zynthian/zynthian-my-data/presets/lv2/ysfx.lv2/libysfx.so>.

So, it builds as a LV2 plugin but fails to run for some reason. That is as much as I can do for now.

6 Likes

good idea.
There is this one too .

I built a couple of embedded effects with this thing. I thought the zynthian DAC sounds a lot better.

Also note that we already have a scripting plugin for MIDI processing called, “Moony” that uses Lua scripts to manipulate MIDI traffic.

2 Likes

The big difference is that JSFX does real-time DSP and is a (runtime) compiled language, not script. Moony seems really useful for MIDI processing, but with a JSFX host you could develop full featured audio plugins, sequencers and softsynths from scratch inside the Zynthian environment without having to access a GUI like you do for Puredata.

The closest comparison would probably be Max4Live (because it can be tightly integrated with Reaper the way Max4Live is integrated with Live), except code based like Supercollider instead of node based like Max/MSP, PD, or VVVV.

Some examples:

A recent Reaper Blog video demoing a few JSFX synthesizers (timestamped to the killer physically modelling one that can get into Tassman territory even though it’s much simpler) Physical modelling in a dedicated hardware instrument is still pretty rare, so anything that brings more of it to Zynthian (and makes it more accessible to use as a performer) is big for me.

One of the best JSFX developers.

Their physically modelled string resonator with live audio input is really nice, goes beyond typical Karplus-Strong sounds.

Excellent real-time, adaptive noise reduction based on deconvolution.

Excellent Neve 1073 EQ model

A demonstration of porting an open source C++ VST reverb to JSFX.

I’m actually still a few weeks out from having the Pi 5 to finish my first Zynthian (v5.1 kit), although I’ve been following the project since version 3 and waiting for the Raspberry Pi platform to get powerful enough for it to meet my needs. Once I have that running I would be happy to help try getting it compiled if I can, although I’m deeper into electronics, electromechanical instruments and luthiery than software so I’m not sure I could contribute much on that front.

Edits for formatting.

4 Likes