Pure Data (LibPd) to JACK client
Moderators: raboof, MattKingUSA, khz
-
- Established Member
- Posts: 51
- Joined: Sat Oct 03, 2020 1:10 pm
- Has thanked: 11 times
- Been thanked: 20 times
Pure Data (LibPd) to JACK client
New Repository: https://github.com/GModal/pd2jack
pd2jack is a shell application for running Pure Data patches as minimalist JACK clients, using LibPd. I.E., the patches run "headless" and without a GUI. However, parameters can be passed to the patch from the cmd line.
Up to 16 audio ports and/or 16 MIDI ports can be opened per instance. Ports are defined at startup with cmd arguments, not by the Pd patch.
Example invocation, with three parameters passed to the patch:
pd2jack -p ./pd/rev_ctrl.pd -n MyPatch -s -v 1 -a 2:2 -m 1:0 '1 90' '2 99' '3 0.7'
Currently the code only compiles in Linux (I'm sure the Makefile won't work elsewhere), but I'll try to update that over time.
pd2jack is a shell application for running Pure Data patches as minimalist JACK clients, using LibPd. I.E., the patches run "headless" and without a GUI. However, parameters can be passed to the patch from the cmd line.
Up to 16 audio ports and/or 16 MIDI ports can be opened per instance. Ports are defined at startup with cmd arguments, not by the Pd patch.
Example invocation, with three parameters passed to the patch:
pd2jack -p ./pd/rev_ctrl.pd -n MyPatch -s -v 1 -a 2:2 -m 1:0 '1 90' '2 99' '3 0.7'
Currently the code only compiles in Linux (I'm sure the Makefile won't work elsewhere), but I'll try to update that over time.
-
- Established Member
- Posts: 1516
- Joined: Sun Jan 27, 2019 2:25 pm
- Location: Italy
- Has thanked: 385 times
- Been thanked: 299 times
Re: Pure Data (LibPd) to JACK client
Wow, this is awesome!
The community of believers was of one heart and mind, and no one claimed that any of his possessions was his own, but they had everything in common. [Acts 4:32]
Please donate time (even bug reports) or money to libre software
Jam on openSUSE + GeekosDAW!
Please donate time (even bug reports) or money to libre software
Jam on openSUSE + GeekosDAW!
-
- Established Member
- Posts: 51
- Joined: Sat Oct 03, 2020 1:10 pm
- Has thanked: 11 times
- Been thanked: 20 times
Re: Pure Data (LibPd) to JACK client
Thank you!
If you have an opportunity to compile and test, please send feedback. It's early in the dev cycle...
-
- Established Member
- Posts: 1516
- Joined: Sun Jan 27, 2019 2:25 pm
- Location: Italy
- Has thanked: 385 times
- Been thanked: 299 times
Re: Pure Data (LibPd) to JACK client
If you start releasing numbered releases (e.g. 0.1.0) I can make an openSUSE package for it, so that it potentially gets some users. I will test and report back
The community of believers was of one heart and mind, and no one claimed that any of his possessions was his own, but they had everything in common. [Acts 4:32]
Please donate time (even bug reports) or money to libre software
Jam on openSUSE + GeekosDAW!
Please donate time (even bug reports) or money to libre software
Jam on openSUSE + GeekosDAW!
-
- Established Member
- Posts: 51
- Joined: Sat Oct 03, 2020 1:10 pm
- Has thanked: 11 times
- Been thanked: 20 times
Re: Pure Data (LibPd) to JACK client
Cool - thanks!
As of today, I think I've got the project to link statically, and that was a limitation to an official release, since the LibPd dynamic library isn't part of many distro repositories (it's not in Ubuntu, for sure).
I wouldn't do something sketchy like including the libpd.so lib file; it's not mine to distribute, and could cause conflicts later (especially if they do package LibPd).
-
- Established Member
- Posts: 51
- Joined: Sat Oct 03, 2020 1:10 pm
- Has thanked: 11 times
- Been thanked: 20 times
Re: Pure Data (LibPd) to JACK client
The pd2jack project now has an official release, v0.1.0 (!)
https://github.com/GModal/pd2jack
Issues:
- MIDI Sysex msgs larger than 512 are not sent correctly, and will probably send garbage.
- MIDI RT Song Position & Song Select are not implemented (from the encapsulated patch -> output - they should input correctly).
The project now links statically, and doesn't need the LibPd library (libpd.so) installed.
A linux executable (made with Ubuntu 20.04.2 LTS) is available on the release page/link:
https://github.com/GModal/pd2jack/releases/tag/v0.1.0
I would still recommend cloning and compiling, but that involves installing & compiling LibPd (and Pure Data) first.
I will work on these issues.
Thanks!!
DG
https://github.com/GModal/pd2jack
Issues:
- MIDI Sysex msgs larger than 512 are not sent correctly, and will probably send garbage.
- MIDI RT Song Position & Song Select are not implemented (from the encapsulated patch -> output - they should input correctly).
The project now links statically, and doesn't need the LibPd library (libpd.so) installed.
A linux executable (made with Ubuntu 20.04.2 LTS) is available on the release page/link:
https://github.com/GModal/pd2jack/releases/tag/v0.1.0
I would still recommend cloning and compiling, but that involves installing & compiling LibPd (and Pure Data) first.
I will work on these issues.
Thanks!!
DG
-
- Established Member
- Posts: 1516
- Joined: Sun Jan 27, 2019 2:25 pm
- Location: Italy
- Has thanked: 385 times
- Been thanked: 299 times
Re: Pure Data (LibPd) to JACK client
OK, I am trying to get a build into openSUSE.
My feedback as a packager:
1) If you want to link libpd statically, you should provide libpd as a git submodule and then build and link that from make - having packagers do it is too complicated on virtualized build environments
2) In the Makefile, the "lib" in $(LIBPD_DIR)/lib should not be hardcoded. In openSUSE for example library directories are architecture-dependent, for the library directory for 64-bit machines (the majority) is /usr/lib64 . For this reason, better if the user can provide a LIBDIR variable to make
3) The default target should look for libpd.a in the user library directory first (e.g. /usr/lib64, then /usr/local/lib64), and then in the same directory
4) Better if you rename LIBPD_DIR to PREFIX, as it's more standardized.
I hope these changes are not too much. I am a developer too and having been a packager for almost two years now has made me realize that setting up these thing as a coder is boring but necessary if you want people to actually use the program
My feedback as a packager:
1) If you want to link libpd statically, you should provide libpd as a git submodule and then build and link that from make - having packagers do it is too complicated on virtualized build environments
2) In the Makefile, the "lib" in $(LIBPD_DIR)/lib should not be hardcoded. In openSUSE for example library directories are architecture-dependent, for the library directory for 64-bit machines (the majority) is /usr/lib64 . For this reason, better if the user can provide a LIBDIR variable to make
3) The default target should look for libpd.a in the user library directory first (e.g. /usr/lib64, then /usr/local/lib64), and then in the same directory
4) Better if you rename LIBPD_DIR to PREFIX, as it's more standardized.
I hope these changes are not too much. I am a developer too and having been a packager for almost two years now has made me realize that setting up these thing as a coder is boring but necessary if you want people to actually use the program
The community of believers was of one heart and mind, and no one claimed that any of his possessions was his own, but they had everything in common. [Acts 4:32]
Please donate time (even bug reports) or money to libre software
Jam on openSUSE + GeekosDAW!
Please donate time (even bug reports) or money to libre software
Jam on openSUSE + GeekosDAW!
-
- Established Member
- Posts: 51
- Joined: Sat Oct 03, 2020 1:10 pm
- Has thanked: 11 times
- Been thanked: 20 times
Re: Pure Data (LibPd) to JACK client
Thank you -- those are great suggestions. I'll work on that asap.Basslint wrote: ↑Tue Jun 08, 2021 6:04 am OK, I am trying to get a build into openSUSE.
My feedback as a packager:
......
I hope these changes are not too much. I am a developer too and having been a packager for almost two years now has made me realize that setting up these thing as a coder is boring but necessary if you want people to actually use the program
I'd toyed with the idea of adding libpd as a submodule, and ultimately that's a good route (unless and until packaging the LibPd library binary is an option). I will need to invoke the Makefile in the libpd submodule with the static option, but I'll figure that out...
I'm actually a little relieved this wasn't submitted yet. I'm close to finishing a re-write of almost all the LibPd -> JACK MIDI code, and it's much simplified, and more complete. The MIDI coding, btw, is 99% of the challenge -- audio ports were easy.
-
- Established Member
- Posts: 51
- Joined: Sat Oct 03, 2020 1:10 pm
- Has thanked: 11 times
- Been thanked: 20 times
Re: Pure Data (LibPd) to JACK client
Hmmm, if libpd is a git submodule, then the libraries need not be installed. They're built in the ./libpd/libs folder, and a relative path should be a simple reference for any distro.
-
- Established Member
- Posts: 1516
- Joined: Sun Jan 27, 2019 2:25 pm
- Location: Italy
- Has thanked: 385 times
- Been thanked: 299 times
Re: Pure Data (LibPd) to JACK client
Sure, paths relative to the build directory are universal. Please tag me as soon as you are finished, work at your own pace, no rush
The community of believers was of one heart and mind, and no one claimed that any of his possessions was his own, but they had everything in common. [Acts 4:32]
Please donate time (even bug reports) or money to libre software
Jam on openSUSE + GeekosDAW!
Please donate time (even bug reports) or money to libre software
Jam on openSUSE + GeekosDAW!
-
- Established Member
- Posts: 51
- Joined: Sat Oct 03, 2020 1:10 pm
- Has thanked: 11 times
- Been thanked: 20 times
Re: Pure Data (LibPd) to JACK client
Thanks - will do.
I've tested this with Makefile changes and a libpd subdir, and it works well. I'll add a branch, the submodule to github, and test some more before merging...
-
- Established Member
- Posts: 51
- Joined: Sat Oct 03, 2020 1:10 pm
- Has thanked: 11 times
- Been thanked: 20 times
Re: Pure Data (LibPd) to JACK client
A new release for pd2jack today (v0.1.6).
https://github.com/GModal/pd2jack
https://github.com/GModal/pd2jack
- This version has improved MIDI support (all RT message supported). Nearly all of the MIDI code was rewritten (and simplified).
- LibPd is now a submodule, and the build process streamlined.
- A Linux binary (zipped w/docs & Pd examples) is available with the release (Building from source is still recommended).
-
- Established Member
- Posts: 51
- Joined: Sat Oct 03, 2020 1:10 pm
- Has thanked: 11 times
- Been thanked: 20 times
Re: Pure Data (LibPd) to JACK client
Another new release for pd2jack (v0.1.9):
https://github.com/GModal/pd2jack
New with v0.1.9, enabling interactive mode (-i) interprets a "live stream" of parameter pairs (in the console), which are passed on as "param" messages to the Pd patch. These work like the startup "parameter pairs," except for:
NOTE: this has some cool implications -- a separate GUI application can act as a front-end, and "pipe" data into pd2jack.
So ANY GUI api could be used...just convert any input to parameter pairs and print them to the console. This isn't a crazy as it sounds -- two applications connected with a pipe are separate processes, and if the numeric char strings aren't actually printed to the console (the are not, with pipe), the CPU load is pretty small.
Here's a example of how it's invoked:
./revUI | pd2jack -i -p rev_i.pd
(where revUI is the GUI, and pd2jack is running the "rev_i.pd" patch in interactive mode.)
Simple video demo:
https://www.youtube.com/watch?v=p6WiFfAxf8U
There are other options for IPC with Pd (netsend, netreceive & some custom objects) and piping the console might feel like a hack, but it is simple and quick. An additional method (sockets?) might be added to pd2jack in the future...(yeah, I'm thinking maybe a plugin interface).
It's also been suggested this mode might be useful for people with disabilities. I've also successfully piped the output of pd2jack to a speech synthesis module, sending text via Pure Data's [print] object, as well as any info output in "verbose" mode. It's likely that would work with a regular "headless" install of Pure Data, of course.
Interactive Mode Special Commands (w/ "@" prefix)
Interactive mode also includes a set of special cmds, for controlling some internal operations. Each of these cmds is preceeded with an "at" symbol (@), to differentiate the cmds from the parameter stream. Here's a list:
I expect more cmds will be added in the future.
https://github.com/GModal/pd2jack
New with v0.1.9, enabling interactive mode (-i) interprets a "live stream" of parameter pairs (in the console), which are passed on as "param" messages to the Pd patch. These work like the startup "parameter pairs," except for:
- No quotes are required
- Passed in real time during run
- Each pair is terminated with a newline
Code: Select all
1 89
1 88
1 87
1 86
3 2180
3 2200
3 2221
3 2241
3 2261
4 19
So ANY GUI api could be used...just convert any input to parameter pairs and print them to the console. This isn't a crazy as it sounds -- two applications connected with a pipe are separate processes, and if the numeric char strings aren't actually printed to the console (the are not, with pipe), the CPU load is pretty small.
Here's a example of how it's invoked:
./revUI | pd2jack -i -p rev_i.pd
(where revUI is the GUI, and pd2jack is running the "rev_i.pd" patch in interactive mode.)
Simple video demo:
https://www.youtube.com/watch?v=p6WiFfAxf8U
There are other options for IPC with Pd (netsend, netreceive & some custom objects) and piping the console might feel like a hack, but it is simple and quick. An additional method (sockets?) might be added to pd2jack in the future...(yeah, I'm thinking maybe a plugin interface).
It's also been suggested this mode might be useful for people with disabilities. I've also successfully piped the output of pd2jack to a speech synthesis module, sending text via Pure Data's [print] object, as well as any info output in "verbose" mode. It's likely that would work with a regular "headless" install of Pure Data, of course.
Interactive Mode Special Commands (w/ "@" prefix)
Interactive mode also includes a set of special cmds, for controlling some internal operations. Each of these cmds is preceeded with an "at" symbol (@), to differentiate the cmds from the parameter stream. Here's a list:
- @openPatch <name> : load a different patch into the LibPd space (closes current patch first).
- @closePatch : closes the current patch
- @reopenPatch : reopens the last valid patch (patch can be closed or already open)
- @im_sleepTime <int> : sleep time (ms, 5-500) between data fetches for interactive mode.
I expect more cmds will be added in the future.