Pure Data added to VCV Prototype

After a successful fundraiser (Fundraiser: Pure Data for VCV Prototype) to add Pure Data support to VCV Prototype, Clemens Wegener and Max Neupert (@max2) from CHAIR have released the first version of their libpd Prototype engine which makes this possible.

To get started with Pure Data, download it and read one of these tutorials made by Pure Data users or watch tutorials on YouTube.

To make a Pure Data patch in VCV Prototype, right-click on the Prototype panel, choose “Set Pure Data application”, and locate your installed Pure Data application. (e.g. C:/Program Files/Pd/bin/pd.exe on Windows, /usr/bin/pd-gui on Linux, /Applications/Pd-0.50-2.app on Mac). Then right-click on the Prototype panel again, choose “New script”, and save to any location with a .pd extension. Pure Data will automatically launch with the template patch. When you save your Pure Data patch, VCV Prototype will automatically reload it.

Tutorials and videos for using Pure Data with VCV Prototype will soon be available, but it is now ready to try using VCV Prototype v1.3.0, available from its VCV Library entry.

29 Likes

Awesome! Although my experience with Pd limited only by few hours I tried using Automatonism and it works.

2 Likes

Small correction: One should always associate the pd-gui binary to open Pd files, not the pd binary. This way when opening a few files it won’t launch a new instance of Pd each time but open it in the Pd that’s already opened.

On Linux that’s /usr/bin/pd-gui or, if you manually installed a newer version (recommended if your distro doesn’t serve an up to date version in the repositories): /usr/local/bin/pd-gui

See my note-to-self here:

2 Likes
here is a working reverb with 5 parameters [stereo only]
2 Likes

great!!

Great!

Some examples in “Documents\Rack\plugins-v1\VCV-Prototype\examples” to try out - thanks. I’m going to try to get some arduino data in and out through this …

  1. Arduino Firmata GitHub - firmata/protocol: Documentation of the Firmata protocol.
  2. Pd Firmata pduino — Pd Community Site
  3. I use Deskpins to keep the puredata window on top
2 Likes

@max2 Thanks for this gem, or rather, GEM ! One question: I fear the pd-gui executable is a Linux-only feature, or am I wrong about this?

Yes, that looks like Linux only. The pd executable on Linux is fine if you only launch one script, but as @max2 says, the pd-gui will avoid opening multiple instances if you try to open two PD patches at once.


All VCV Prototype users: How do you like the workflow of creating/editing scripts and Pure Data patches? Any obstacles when getting started due to how Prototype works?

1 Like

https://forum.pdpatchrepo.info/topic/3666/bbcut here you can download a pure data patche for automatic break beat rearrange

Did you get any progress with Arduino data in and out? I’m also trying to do with “comport.” To use Pd externals in VCV Prototype seems to need to build VCV Prototype from source, isn’t it? I built from the source, but I got just error log says “error… couldn’t create”

If you have any tips, please let me know. thanks.

I didn’t get very far with that, After i installed pduino v0.6 in pure data via the “find externals” menu item, i played around with the pduino examples in pure data for a while. It was easy to get it to read a pot on the arduino uno analog in.

But I didn’t really get it working in vcv Prototype - someone with more brains may be able to, I constantly stumble on Pd basics. So, I can’t answer your questions on that.

It works better for me to make a USB midi class compliant device to get the same functionaliy.

I just noticed there is Rack 2 and was wondering what this means for the Prototype module. Is it alive? If not, is it going to be revived? Is there something we should / can do? Please forgive the ignorance, we weren’t following what going on.

1 Like

Just checked, doesn’t look like it’s there yet. But it probably will be. I hope it will, just made a Prototype/PD granular sample player a few weeks back, that I would like to use at some point :slight_smile:

But still some modules to go, before I can adapt to V2.

1 Like

I’m also wondering if there are plans for Prototype to make it to V2…?! @Jens.Peter.Nielsen @Vortico any chance you could toss out a quick response if/when for this one??

I have no clue of when - I’m not affiliated with VCV in any way.

But having read this I have no doubt we will get VCV Prototype in Rack2 eventually. It was a “selling point” of Rack 2, that VCV would see to that all v1.1.6 opensource plugins were ported (if the porting was straight forward). When? when!

The latest commit to VCV prototype was 1 month ago - please be patient.

1 Like

Apologies - I thought since you posted much of the official update news you were on team with Andrew/VCV! I’m a newbie to the forums

Definitely very willing to be patient, just was very curious since having PD/etc would be a major addition along with the new arsenal!

Hope everyone involved with VCV knows how over the moon appreciative we all are for this major release of Rack 2. It’s legitimately opening up mew frontiers in sound design and recording (for lil’ ‘ol me, at least!)

1 Like

I was looking for Prototype also. Looks like Andrew created a v2 branch a few weeks ago. If somebody’s feeling adventurous they can try compiling. I might try it on my Linux box soon to see if it works, but it’s not a proper release build environment.

I tried (Windows 11 & Msys64-MinGW64)

git clone --branch v2 https://github.com/VCVRack/VCV-Prototype

And did the makefile changes suggested by @Steve_Russell

But I got errors in make dep

In file included from libpd_wrapper/z_libpd.c:23:
./pure-data/src/s_stuff.h:153:53: note: expected 't_audiosettings *' {aka 'struct _audiosettings *'} but argument is of type 'int'
  153 | EXTERN void sys_set_audio_settings(t_audiosettings *as);
      |                                    ~~~~~~~~~~~~~~~~~^~
libpd_wrapper/z_libpd.c:163:3: error: too many arguments to function 'sys_set_audio_settings'
  163 |   sys_set_audio_settings(1, indev, 1, inch,
      |   ^~~~~~~~~~~~~~~~~~~~~~
In file included from libpd_wrapper/z_libpd.c:23:
./pure-data/src/s_stuff.h:153:13: note: declared here
  153 | EXTERN void sys_set_audio_settings(t_audiosettings *as);
      |             ^~~~~~~~~~~~~~~~~~~~~~
make[1]: *** [<builtin>: libpd_wrapper/z_libpd.o] Error 1
make[1]: Leaving directory '/home/jpn99/github/Rack2/Rack/plugins/VCV-Prototype/dep/libpd'
make: *** [Makefile:242: dep/lib/libpd.a] Error 2
2 Likes

No idea what I’m doing, but here it goes:

I had the same error.

In the Makefile referenced above I commented out:

cd dep/libpd && git checkout 5772a612527f06597d44d195843307ad0e3578fe

And changed the variables vult/faust/supercollider to zero:

VULT ?= 0
FAUST ?= 0
SUPERCOLLIDER ?= 0

In Prototype.cpp I added:

#include <string>
#include <codecvt>
#include <locale>

And changed:

std::wstring commandW = string::toWstring(command);

to

std::wstring commandW = std::wstring_convert<std::codecvt_utf8<wchar_t>>().from_bytes(command);

It compiled and installed, but loading scripts results in: “No engine for …<lua/js/pd> extension”. Creating a new script results in: "File extension “.pd/js/lua not recognized.”

Managed to (mostly) build it as well, on Linux (couple minor tweaks and Faust still fails to compile).

However I also see a No engine for ..pd extension << notice there is an extra . here. The code that generates this message:

	// Create script engine from path extension
		std::string extension = system::getExtension(path);
		scriptEngine = createScriptEngine(extension);
		if (!scriptEngine) {
			message = string::f("No engine for .%s extension", extension.c_str());
			return;
		}
		scriptEngine->module = this;

So it seems that Rack2’s system::getExtension() retains the . on extension. You then have to prepend it for each of the engines.

What I needed to do was the following changes:

Make sure GH links use https only (needed for submodules in Vult, didn’t feel like completely replacing my ssh keys just yet):

echo -e '[url "https://github.com/"]\n  insteadOf = "git://github.com/"' >> ~/.gitconfig

And then these changes to VCV-Prototype:

diff --git a/Makefile b/Makefile
index c1e56bb..6ff4fa6 100644
--- a/Makefile
+++ b/Makefile
@@ -19,7 +19,7 @@ PYTHON ?= 0
 SUPERCOLLIDER ?= 1
 VULT ?= 1
 LIBPD ?= 1
-FAUST ?= 1
+FAUST ?= 0
 
 # Vult depends on both LuaJIT and QuickJS
 ifeq ($(VULT), 1)
@@ -195,7 +195,7 @@ SOURCES += src/VultEngine.cpp
 vult := dep/vult/vultc.h
 vult := dep/vult/vultc.h
 $(vult):
        cd dep && mkdir -p vult
-       cd dep/vult && $(WGET) "https://github.com/modlfo/vult/releases/download/v0.4.12/vultc.h"
+       cd dep/vult && $(WGET) "https://github.com/vult-dsp/vult/releases/download/v0.4.12/vultc.h"
        $(SHA256) $(vult) 3e80f6d30defe7df2804568f0314dbb33e6bf69d53d18a804c8b8132cf5ad146
 FLAGS += -Idep/vult
 DEPS += $(vult)
@@ -223,7 +223,7 @@ endif
 
 $(libpd):
        cd dep && git clone "https://github.com/libpd/libpd.git" --recursive
-       cd dep/libpd && git checkout 5772a612527f06597d44d195843307ad0e3578fe
+       cd dep/libpd && git checkout 49a12f048c4e4b6089e185d5946dcd51e05becd3
        
 ifdef ARCH_MAC
        # libpd's Makefile is handmade, and it doesn't honor CFLAGS and LDFLAGS environments.
diff --git a/src/LibPDEngine.cpp b/src/LibPDEngine.cpp
index 7be549f..1786ce2 100644
--- a/src/LibPDEngine.cpp
+++ b/src/LibPDEngine.cpp
@@ -331,5 +331,5 @@ void LibPDEngine::sendInitialStates(const ProcessBlock* block) {
 
 __attribute__((constructor(1000)))
 static void constructor() {
-       addScriptEngine<LibPDEngine>("pd");
+       addScriptEngine<LibPDEngine>(".pd");
 }
diff --git a/src/Prototype.cpp b/src/Prototype.cpp
index 71c0673..ab2f2c2 100644
--- a/src/Prototype.cpp
+++ b/src/Prototype.cpp
@@ -594,7 +594,7 @@ struct Prototype : Module {
                if (path == "")
                        return "";
                // HACK check if extension is .pd
-               if (system::getExtension(path) == "pd")
+               if (system::getExtension(path) == ".pd")
                        return settingsPdEditorPath;
                return settingsEditorPath;
        }

Haven’t tested the other scripting engines yet, but Pd works for me now.