Autostart pd patch in Patchbox OS

Hi!
I’m trying to launch a pd patch on startup in Patchbox in console mode, without Pisound
(I use HifiBerry dac for the moment).

I tried running a script that launches the pd patch from rc.local but nothing is happening.
The script works, because when I run the script manually, I can hear the patch working, but it is not launched automatically.

I also tried the puredata module from the patchbox menu, but nothing happens there either, but then I suppose it needs Pisound with the button.

What’s the right way to simply launch a patch on startup?

Thanks

I’ve fixed some issues recently with patch starting through Pure Data module, see if there’s any updates, and if there was, try Pure Data module in patchbox again.

If there’s any issues, please post the log of patchbox-init.service, it can be accessed using this command:

sudo journalctl -u patchbox-init
1 Like

Great, puredata module works after an update, thank you very much!
I have another question:
How can I auto launch a patch from usb stick without pisound? (pi 4)

1 Like

An udev rule could be a good idea for that, you could make one to automatically search for the patch of an inserted USB storage device, and launch it. See the start_puredata.sh script, it contains the code for searching for a patch in USB storage, you could adapt it to your needs and make it to be executed every time a USB device is attached.

Nice, now I got something to work with, thanks again!

Hey, I know this topic is like five years old, but maybe someone will end up looking for a solution (like me…). I figured out a very simple way of loading a patch from a USB drive by modifying the launch.sh script in the Pure Data module. I have no idea what I’m doing, and it’s probably really wrong — but it works. So, I thought I’d share it.

The script looks for a file called mother.pd, which then opens other Pure Data patches. Again: it’s a dirty solution — but dirty is good enough for me at the moment…

Here it is:

#!/bin/sh

# Copyright (C) 2017-2018 Vilniaus Blokas UAB, https://blokas.io/pisound
# All rights reserved.
#
# This software may be modified and distributed under the terms
# of the BSD license.  See the LICENSE file for details.
#

. /usr/local/pisound/scripts/common/start_puredata.sh

# Always use mother.pd from USB
PATCH_NAME="mother.pd"
PATCH=$(find /media /mnt /run/media -type f -name "$PATCH_NAME" 2>/dev/null | head -n 1)

if [ -z "$PATCH" ]; then
    echo "Error: mother.pd not found on any connected USB drive."
    exit 1
fi

shift

echo
echo "$PATCH"
echo "$@"

(
    # Connect the osc2midi bridge to the MIDI Inputs and to Pure Data.
    sleep 4
    /usr/local/pisound-ctl/connect_osc2midi.sh "pisound-ctl"
    aconnect "pisound-ctl" "Pure Data"
    aconnect -d "Pure Data:1" "pisound-ctl"
) &

start_puredata "$PATCH" "$@"
1 Like