Pure Data implementation experiment (original post)
Started by bbishop




3 posts in this topic
bbishop

33 posts 7 threads Joined: May 2021
24-05-21, 19:33 -
#1
Hey! First of all, thank you for the work you’ve done on this fork! It ran great with only a little configuration. 

This is going to be a bit of a long post so sorry about that...

I’m building two samplerboxs, one for my brother, and one for myself, using 3B+, a hifiberry clone, and (eventually, haven’t gotten there yet) oled displays, with the idea of integrating an arduino for hardware midi controls. I’m just finishing up a midi expansion console for my analog synth, so I already have working code for that (...with an lcd touch display as an xy pad, and 21 pots, 12 of which are nrpn messages... way more complicated than I planned... the samplerbox controls shouldn’t be as complicated)

Please keep in mind that I’m not really a programmer and I have’t really used linux since I was a teenager  Blush but I get along pretty well with enough examples in front of me!

So I have (maybe) a bit crazy of an idea of running a pure data patch alongside samplerbox.

Pure Data, for those that don’t know, is an open-source Max/MSP-like visual programming language for artists and musicians, made by Miller Puckette, the original creator of Max. You can build digital synthesizers, audio effects, and a thousand other things in it. Pure data running on raspberry Pi is currently being used on a few boutique commercial instruments, like the critter and guitari ‘Organelle’, and I believe a few eurorack modular synth modules. 

It can be a little confusing to get started in, but fortunately I found Martin Brinkmann’s website, who has made a large repository of instruments and patches, including a set of modular units for easily putting together instruments (the ‘virtual(virtual)devices’ file), lots of fun and a much easier way to get started in pd!

http://www.martin-brinkmann.de/pd-patches.html

It’s important to add to the patch

[loadbang]
|
[del 1000]
|
[;
dsp 1(

That’s a pure data object that says “loadbang” (which loads a function at startup)

Connected to
 
a pure data object that says “del 1000” (1 second delay)

Connected to

a pure data message that says

“;
dsp 1” (turns audio on)

I can include a picture of what this looks like later... and maybe the patch I’m currently trying to run (fm synth, but it’s really just a placeholder)

My basic idea is to have a digital synth alongside samplerbox, sort of as a paraphonic voice, so that I can do things like create pads and swell sounds behind sampled piano, but it could also be used for custom delays, reverb, modulation, or say something as out there as using samplerbox as the audio source for granular synthesis. 

Honestly I don’t know if the Pi 3B+ will have enough cpu head room for both, if not it might be something I try again when you’ve finished the Pi 4 update... top says it’s using more cpu than the samplerbox.py script, but total cpu is still below 40%

Basically how things should work is by connecting samplerbox’s audio out to pure data’s audio in using Jack audio connection kit, and then out to ALSA (I think? or maybe again to jack and then alsa? It was late last night when I got to jack). 

so far I’ve managed to install pure data and jack, and add a script that boots my patch at startup (using various tutorials online), but I have yet to figure out how to configure jack via command line, and I guess I’ll also need to stop samplerbox from connecting to alsa... (so far I haven’t been able to actually test my patch on the build because I’m having trouble getting audio out, but it’s definitely running, I can see pd in top)

I’ll walk you all through the steps I’ve gone through so far
Pure data and Jack both just installed with apt-get

apt-get update 
apt-get install puredata
apt-get install jackd

 (make sure it has that d, had a hard time finding the proper name in the documentation, but it was also 3 am last night so I’m probably to blame   Big Grin without it you end up installing some CD ripping software)

I then discovered that there’s a bit of an issue with pure data recognizing my midi keyboard (it lists it as an audio device??), some other people had this issue and fixed it by installing aconnectgui (booting it without GUI just with the command ‘aconnect’), and connecting pure data to the new virtual midi port

I then made a script (following the instructions on https://guitarextended.wordpress.com/201...pberry-pi/ ),

But included:

jackd

aconnect

and modified the pd line to something like (sorry, I don’t have it in front of me, and I tried a dozen combinations):

pd -nogui -jack -audiodev 1 -alsamidi -mididev 20 -open /your/patchlocation/puredatapatch.pd &

(Not sure that midi port number (20) is stable... could have sworn it was 1 at one point... if not I might need to figure out some kind of script or if function to identify the port and put that into the pd line...)


Currently can’t connect to alsa audio because it’s already busy with samplerbox

so if anybody has any experience with jack, or configuring pure data, or is just interested in trying this experiment out with me I’d love to hear your thoughts!


Sorry again for the huge first post  Big Grin
This post was last modified: 19-08-21, 23:12 by bbishop.


Messages In This Thread
Pure Data implementation experiment (original post) - by bbishop - 24-05-21, 19:33