Not working anymore: single click to launch Pd patch from USB

Yes, I think /root/.pdsettings could be a symbolic link referring to /home/pi/.pdsettings, as long as the root user has access to that file.

ok thanks a lot! I guess I can make it accessible via CHMOD can’t I?

A little bit of chown goes a long way: If you set up the place where externals get installed to be owned by pi, then you can install them while you are logged, using pd graphically, and later run the same patches from the button (which runs them as root). Here’s my externals directory:

pi@mupi   ~
[742] : ls -ld /usr/local/lib/pd-externals/
drwxr-sr-x 5 pi pi 4096 Sep  9 15:06 /usr/local/lib/pd-externals//

pi@mupi   ~
[743] : ls -l /usr/local/lib/pd-externals/
total 524
drwxr-sr-x 2 pi pi   4096 Nov 15  2016 abl_link~/
-rw-r--r-- 1 pi pi   2967 Aug 31 22:19 abl_link~-help.pd
-rwxr-xr-x 1 pi pi 512652 Aug 31 22:21 abl_link~.pd_linux*
drwxr-sr-x 2 pi pi   4096 Jul 29  2016 freeverb~/
drwxr-sr-x 2 pi pi   4096 Nov 18  2015 ggee/
-rw-r--r-- 1 pi pi   2140 Jul 29  2016 output~.pd

Fear not, @anon86906493, as you can see I’ve got several externals installed there, and I can use them all from patches launched by the button.

The command for setting this up would be:

sudo chown -R pi:pi /usr/loca/lib/pd-externals

If sym-link or hard link /root/.pdsettings to /home/pi/.pdsettings, as @Giedrius suggests, then when you File > Preferences > Save All Settings from pd graphically, you’ll be saving the same settings that will be used when patches are launched from the button. This works well for getting the search paths right. Note that the button script explicitly sets some parameters on the command line - and those will override your preferences, so if you need to changed, change the script or remove them from the script and change in your preferences.

The command for setting this up would be:

sudo ln -s  /home/pi/.pdsettings /root/.pdsettings

Alternatively, you could edit single-click.sh script to launch pd as the pi user:

nohup sudo -u pi puredata ...
1 Like

Huge thanks! Of course I meant chown not chmod.

Yes the search paths were my concern! Everything else I’m totally fine with setting in the launch parameters inside the script.

So, even without root having a .pdsettings file, it will still search:

/usr/loca/lib/pd-externals/

Coupled with pd's somewhat bizarre search mechanism, externals that are a single thing will be found. So, for example, in my listing above

  • able_link~ is found as /usr/local/lib/pd-externals/abl_link~.pd_linux
  • freeverb~ is found as /usr/local/lib/pd-externals/freeverb~/freeverb~.pd_linux
  • hlshelf is not found since it is in /usr/local/lib/pd-externals/ggee/hlshelf.pd_linux

For the last case, either use the .pdsettings method, or, I just added the following bits to single_click.sh:

PURE_DATA_PATHS='-path /usr/local/lib/pd-externals/ggee'
...
nohup puredata $PURE_DATA_GUI $PURE_DATA_PATHS ...
1 Like

ok thanks! I’ll try that!

@mzero I did sort out all the stuff with MIDI controllers, this now works fine but I’m still not getting Pd to load externals when launching via the button script.
I did symlink the .pdsettings file to the root directory as you have suggested, but that didn’t do it.
I did also change the owner of the folder where the externals are located to pi:pi but that didn’t do it either.
I wonder what I’m doing wrong. Anything else I can try?

@anon86906493 - There are two things I’d try:

First, see if you can get pd to run as root while you are in a shell:

# logged in as your normal user, probably pi
& sudo bash -l       # start a login shell as root, the -l is important
root@mypi:/home/pi&  # your prompt may be different than mine...
root@mypi:/home/pi& purdata -verbose -nogui \
  -alsa -audioadddev pisound -audiobuf 10 -channels 2 -r 48000 \
  -alsamidi -mididev 1,2 \
  -send ";pd dsp 1" \
  foo.pd    # the file you are trying to laod

This will spew a large number of messages like:

tried /home/pi/patches/ek/freeverb~/freeverb~.l_arm and failed
tried /home/pi/patches/ek/freeverb~/freeverb~.pd_linux and failed
tried /home/pi/patches/ek/freeverb~/freeverb~/freeverb~.l_arm and failed
tried /home/pi/patches/ek/freeverb~/freeverb~/freeverb~.pd_linux and failed
tried /home/pi/patches/ek/freeverb~/freeverb~.pd and failed
tried /home/pi/patches/ek/freeverb~/freeverb~.pat and failed
tried /home/pi/patches/ek/freeverb~/freeverb~/freeverb~/freeverb~.pd and failed
tried /root/.local/lib/pd/extra/freeverb~/freeverb~.l_arm and failed
tried /root/.local/lib/pd/extra/freeverb~/freeverb~.pd_linux and failed
tried /root/.local/lib/pd/extra/freeverb~/freeverb~/freeverb~.l_arm and failed
tried /root/.local/lib/pd/extra/freeverb~/freeverb~/freeverb~.pd_linux and failed
tried /root/.local/lib/pd/extra/freeverb~/freeverb~.pd and failed
tried /root/.local/lib/pd/extra/freeverb~/freeverb~.pat and failed
tried /root/.local/lib/pd/extra/freeverb~/freeverb~/freeverb~/freeverb~.pd and failed
tried /root/pd-externals/freeverb~/freeverb~.l_arm and failed
tried /root/pd-externals/freeverb~/freeverb~.pd_linux and failed
tried /root/pd-externals/freeverb~/freeverb~/freeverb~.l_arm and failed
tried /root/pd-externals/freeverb~/freeverb~/freeverb~.pd_linux and failed
tried /root/pd-externals/freeverb~/freeverb~.pd and failed
tried /root/pd-externals/freeverb~/freeverb~.pat and failed
tried /root/pd-externals/freeverb~/freeverb~/freeverb~/freeverb~.pd and failed
tried /usr/local/lib/pd-externals/freeverb~/freeverb~.l_arm and failed
tried /usr/local/lib/pd-externals/freeverb~/freeverb~.pd_linux and succeeded

This is all just to load one external. Notice that it will try a number of different file extensions in each directory before looking and the next directory. Eventually the last line shows it found it. The key is that this output shows you the list of places it is looking. You should be able to tell if it is reading the linked .pdsettings file or not this way.

If the above works, and the only problem is when launching from the button, then you should add -verbose to the puredata line in /usr/local/etc/pisound/single_click.sh and after having it run, look at /tmp/pdout for the messages like above to see what it is doing.

1 Like

Thanks a lot for taking the time to help me on this! This is definitely getting me closer. It seems to read the .pdsettings file, since the places it looks are indeed the ones I have added to the search paths. Though for some reaso it’s ignoring the settings (like delay) I have set in the GUI.
Now that I think of it… it never had issues loading freeverb, but did not load cyclone. I’m using tanh~ to do some distortion, but from the terminal output it seems like it’s finding it allright:

tried /usr/lib/pd/extra/cyclone/tanh~.pd_linux and succeeded

I did add -verbose to the single_click.sh script, but cannot find pdout in /tmp, nor anywhere else. Also… there seems to be no info on where Pd stores the log anywhere, and doing a find didn’t produce any matching results either… are you sure that’s where it puts the log? Searching the web for “pdout” does not produce any results either…

in /usr/local/etc/pisound/single_click.sh look at the line the starts puredata. If it doesn’t make it end in:

puredata ...  >/tmp/pdlog 2>&1 &

That will make sure that the output is logged in /tmp - can’t remember now if I added that in mine or if it is standard.

As for other settings, the ones on the command line will override the ones in the .pdsettings file. I think several of the settings are set on the command line in the standard single_click.sh script. So either adjust them to match, or remove them if you want the .pdsettings file to override.

Lastly, pd makes it easy to mess up preferences because it - oddly - doesn’t save the preferences when you change them in the GUI unless you close the preferences dialogs and then choose the Save All Settings command, which I’m always forgetting to do. Silly pd! So, double check that the .pdsettings file also has what you want.

You probably added that yourself, because it wasn’t there, but now it works! Thanks a lot!
Now, it really looks like Pd doesn’t read the .pdsettings file when launched from the button script, while it does when launched as root normally.
It does look in /usr/lib/pd/extra because I guess that’s one of the standard places, and it finds freeverb, but only because the folder has the same name as the .pd_linux file (which is probably a standard behaviour as well).

Oh yes I know that, I was only mentioning the problem with the delay parameter as an additional sign that Pd is not reading the .pdsettings file when launched from the button.

yes learned that as well the hard way. But I’m sure I did do a “save all settings” several times when testing this and also double checked the file itself to see if the settings were there. Indeed the delay is set to 5ms and all the paths are there…
So I guess… the only thing I can do is to add all the paths to the externals in the single_click.sh script?

I have another idea, I’ll just copy the abstractions or binaries from the external that I have used to the USB stick, since Pd is automatically looking for them there. Problem solved! :slight_smile:

@mzero: I haven’t been using the Pisound in a while now (had to move, and just recently finished unpacking the last bits). I did update to the latest firmware (which I think is 1.05) and have seen that there were some changes to how the button scripts work, so I am wondering: did anything change in regards to the problems we had at the beginning with Pd or is everything still the same?

@anon86906493 There has been multiple problems discussed in this topic so not sure which one exactly you mean. :slight_smile: The thing with XAUTHORITY and DISPLAY is fixed.

The /root/.pdsettings didn’t have any changes, but I have tried making a symbolic link to /home/pi/.pdsettings and it worked as it should, as was suggested here [SOLVED] Not working anymore: single click to launch Pd patch from USB

Yeah I guess I was referring to the various issues I had encountered over the course of this thread, which IIRC were mainly the one that Pd would not run when launched from the button headless (which was previously fixed by running it with -noguy) and then the problem with Pd not lading the .pdsettings file. I had already tried the suggested symlink thing, but that hadn’t worked for me.
the last issue I remember having was with Pd picking up the MIDI controllers… but I can’t remember the exact issue, I guess that was mostly me not being able to set things up in aconnect.

All of those should have solutions. I’ll close this thread as it already contains multiple issues discussed, if you hit any of them again, please create new topics for each issue.