Pisound connect to puredata

Hi, I try to start puredata and pisound at boot. It start the puredata but the pisound doesn’t. On the puredata console “Audio Off”. If I execute the .sh manually the pisound start perfectly… “Audio On”
This is the .sh code#!/bin/bash
sleep 2.5
echo " start lucibox"
/usr/bin/pd -rt -alsa -audioadddev pisound -channels 2 -r 44100 /home/patch/lucibox/machines/1/moon_loopstation.pd

what did I do wrong?
Sur

Hi, the easiest way to get your patch to autostart is to simply put your patch in a subfolder in /usr/local/puredata-patches/, use main.pd filename for the main entry file, or provide a ‘blokas.yml’ file for the patch, see Pure Data patch with parameters in the Pisound App for example.

Then run patchbox, go to module, select puredata and it will ask which patch to auto-start on startup, select the one you’ve prepared.

The Patchbox OS image is configured to use the Jack audio backend, you use ALSA in your script, it might conflict. Also you should use 48000, 96000 or 192000 for sampling rate with Pisound. The PD always starts with “DSP” off, in our script, we provide a special argument that enables it, see here (-send ";pd dsp 1").

Hi Giedrius,

This is the last code:
#!/bin/bash
sleep 2.5
echo " start lucibox"
/usr/bin/pd -rt -alsa -audioadddev pisound -channels 2 -r 48000 -send “;pd dsp 1” /home/patch/lucibox/machines/1/moon_loopstation.pd

And I got this message on console

Can you help me?
Sur

Patchbox OS uses Jack as the audio backend, so you can’t use PD with ALSA. Jack is better at sharing audio resources between multiple applications, while ALSA wants exclusive access and you usually get ‘device or resource is busy’ errors. Try this:

#!/bin/sh
. /usr/local/pisound/scripts/common/start_puredata.sh
start_puredata "/home/patch/lucibox/machines/1/moon_loopstation.pd"

This is the basic script that’s called in the end when starting PD patch using the button, or through the puredata module in patchbox or via the app.

I’d still recommend using the Pure Data module in patchbox->module menu to get your patch to start automatically on system startup.

  1. First I need to install qjackctl, right?? https://blokas.io/pisound/docs/FAQs/
  2. About main.pd start automatically on system startup. So I only have to make mai.pd and inside main.pd point it to /home/patch/lucibox/machines/1/moon_loopstation.pd ,right? Sorry, a noob here :slight_smile:

If you’re using Patchbox OS you have Jack already.

Copy your entire patch into /usr/local/puredata-patches/lucibox, rename the file you want to run /usr/local/puredata-patches/lucibox/machines/1/moon_loopstation.pd to /usr/local/puredata-patches/lucibox/machines/1/main.pd so it is seen.

Hi Giedrius,
Yeah the jack works now! thank you.

  1. I place the patches to /usr/local/puredata-patches/lucibox/machines/1/main.pd and setting as start file on boot (see attchment) but it doesn’t automatically start after booting.
  2. I would like to disable login and password on booting. How do you do that?
    Thanks
    Sur
  1. It may start before GUI / Display is up, then it rounds in background only. See ps -ef output and look for ‘pd’ or ‘puredata’ process to see if it’s running. If it’s not starting, run update from patchbox utility to get the latest version of this utility.

  2. Use the ‘boot’ submenu in patchbox utility to change boot target, or use sudo raspi-config to do the same thing.

Hi Giedrius,

  1. update from patchbox utility: done
  2. since the update there are 4 options: desktop, desktop autologin, console, console autologin
  3. the automatic booting still doesn’t work yet
  4. if I use desktop autologin I got: No session for pid 1339, No session for pid 1318, No session for pid 1336, etc

Sur

I haven’t seen the ‘No session for pid’ errors myself, any information related to Raspberry Pi and this error may be useful in resolving it.

I’ve just released update to patchbox (version 1.1.4), now the log output of the started module will be possible to inspect by running:

sudo journalctl -u patchbox-init

Please update, try to run your patch, and check the output, see if there’s any errors trying to launch it. You may post the contents here too.

I got this. I use blokas.yml instead of main.pd

– Logs begin at Thu 2020-06-04 13:43:08 BST, end at Thu 2020-06-04 13:44:43 BST. –
Jun 04 13:43:23 patchbox systemd[1]: Starting Patchbox Init…
Jun 04 13:43:31 patchbox patchbox[602]: State: active_module /usr/local/patchbox-modules/puredata/ -> /usr/local/patchbox-modules/puredata/ (skip)
Jun 04 13:43:31 patchbox patchbox[602]: Environment: PATCHBOX_MODULE_ACTIVE /usr/local/patchbox-modules/puredata/ -> /usr/local/patchbox-modules/puredata/ (sk
Jun 04 13:43:31 patchbox patchbox[602]: Manager: puredata.module activated
Jun 04 13:43:31 patchbox patchbox[602]: Manager: puredata.module launch mode is list
Jun 04 13:43:31 patchbox patchbox[602]: Manager: puredata.module launch argument is /usr/local/puredata-patches/lucibox/machines/1/moon_loopstation.pd
Jun 04 13:43:31 patchbox patchbox[602]: Manager: puredata.module launched
Jun 04 13:43:31 patchbox systemd[1]: Started Patchbox Init.
Jun 04 13:43:31 patchbox patchbox[602]: No display found, specifying -nogui
Jun 04 13:43:31 patchbox patchbox[602]: /usr/local/puredata-patches/lucibox/machines/1/moon_loopstation.pd
Jun 04 13:43:31 patchbox sudo[1062]: root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/usr/bin/sh -c echo 1 > /sys/kernel/pisound/led
Jun 04 13:43:31 patchbox sudo[1062]: pam_unix(sudo:session): session opened for user root by (uid=0)
Jun 04 13:43:31 patchbox sudo[1062]: pam_unix(sudo:session): session closed for user root
Jun 04 13:43:31 patchbox patchbox[602]: 2020-06-04.13:43:31: Killing all Pure Data instances!
Jun 04 13:43:31 patchbox patchbox[602]: 2020-06-04.13:43:31: Launching Pure Data.
Jun 04 13:43:31 patchbox patchbox[602]: 2020-06-04.13:43:31: Pure Data started!
Jun 04 13:43:31 patchbox sudo[1086]: root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/usr/bin/sh -c echo 1 > /sys/kernel/pisound/led
Jun 04 13:43:31 patchbox sudo[1086]: pam_unix(sudo:session): session opened for user root by (uid=0)
Jun 04 13:43:31 patchbox sudo[1086]: pam_unix(sudo:session): session closed for user root
Jun 04 13:43:31 patchbox patchbox[602]: opened alsa client 133 in:1 out:1
Jun 04 13:43:32 patchbox sudo[1140]: root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/usr/bin/sh -c echo 1 > /sys/kernel/pisound/led
Jun 04 13:43:32 patchbox sudo[1140]: pam_unix(sudo:session): session opened for user root by (uid=0)
Jun 04 13:43:32 patchbox sudo[1140]: pam_unix(sudo:session): session closed for user root
Jun 04 13:43:32 patchbox sudo[1156]: root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/usr/bin/sh -c echo 1 > /sys/kernel/pisound/led
Jun 04 13:43:32 patchbox sudo[1156]: pam_unix(sudo:session): session opened for user root by (uid=0)
Jun 04 13:43:32 patchbox sudo[1156]: pam_unix(sudo:session): session closed for user root
Jun 04 13:43:32 patchbox patchbox[602]: setting up abl_link~
Jun 04 13:43:32 patchbox patchbox[602]: Created new Link instance with tempo 134.000000.
Jun 04 13:43:32 patchbox patchbox[602]: verbose(2): comport - PD external for unix/windows
Jun 04 13:43:32 patchbox patchbox[602]: LGPL 1998-2012, Winfried Ritsch and others (see LICENSE.txt)
Jun 04 13:43:32 patchbox patchbox[602]: Institute for Electronic Music - Graz
Jun 04 13:43:32 patchbox patchbox[602]: [comport] ** WARNING ** port #5 does not exist! (max == 0)
Jun 04 13:43:32 patchbox patchbox[602]: error: [comport] opening serial port 5 failed!
Jun 04 13:43:32 patchbox patchbox[602]: verbose(4): … you might be able to track this down from the Find menu.

It seems the patch was started and the module killed it again

It actually does this just before starting the new Pure Data instance. It seems to start ok. There may be more output, you should be able to scroll using down arrow, or hit ‘end’ to go to the very last lines outputted.

In autostart mode, PD starts before Desktop is loaded, so it starts in no GUI mode.

This is the whole list:
patch@patchbox:~ $ sudo journalctl -u patchbox-init
– Logs begin at Thu 2019-02-14 10:12:00 GMT, end at Thu 2020-06-04 19:11:36 BST
Jun 04 15:17:16 patchbox systemd[1]: Starting Patchbox Init…
Jun 04 15:17:21 patchbox patchbox[664]: State: active_module /usr/local/patchbox
Jun 04 15:17:21 patchbox patchbox[664]: Environment: PATCHBOX_MODULE_ACTIVE /usr
Jun 04 15:17:21 patchbox patchbox[664]: Manager: puredata.module activated
Jun 04 15:17:21 patchbox patchbox[664]: Manager: puredata.module launch mode is
Jun 04 15:17:21 patchbox patchbox[664]: Manager: puredata.module launch argument
Jun 04 15:17:21 patchbox patchbox[664]: Manager: puredata.module launched
Jun 04 15:17:21 patchbox systemd[1]: Started Patchbox Init.
Jun 04 15:17:22 patchbox patchbox[664]: No display found, specifying -nogui
Jun 04 15:17:22 patchbox patchbox[664]: /usr/local/puredata-patches/lucibox/mach
Jun 04 15:17:22 patchbox sudo[1103]: root : TTY=unknown ; PWD=/ ; USER=root
Jun 04 15:17:22 patchbox sudo[1103]: pam_unix(sudo:session): session opened for
Jun 04 15:17:22 patchbox sudo[1103]: pam_unix(sudo:session): session closed for
Jun 04 15:17:22 patchbox patchbox[664]: 2020-06-04.15:17:22: Killing all Pure Da
Jun 04 15:17:22 patchbox patchbox[664]: 2020-06-04.15:17:22: Launching Pure Data
Jun 04 15:17:22 patchbox patchbox[664]: 2020-06-04.15:17:22: Pure Data started!
Jun 04 15:17:22 patchbox sudo[1152]: root : TTY=unknown ; PWD=/ ; USER=root
Jun 04 15:17:22 patchbox sudo[1152]: pam_unix(sudo:session): session opened for
Jun 04 15:17:22 patchbox sudo[1152]: pam_unix(sudo:session): session closed for
Jun 04 15:17:22 patchbox patchbox[664]: opened alsa client 132 in:1 out:1
Jun 04 15:17:22 patchbox sudo[1224]: root : TTY=unknown ; PWD=/ ; USER=root
Jun 04 15:17:23 patchbox sudo[1224]: pam_unix(sudo:session): session opened for
Jun 04 15:17:23 patchbox sudo[1224]: pam_unix(sudo:session): session closed for
Jun 04 15:17:23 patchbox sudo[1242]: root : TTY=unknown ; PWD=/ ; USER=root
Jun 04 15:17:23 patchbox sudo[1242]: pam_unix(sudo:session): session opened for
Jun 04 15:17:23 patchbox sudo[1242]: pam_unix(sudo:session): session closed for
Jun 04 15:17:23 patchbox patchbox[664]: setting up abl_link~
Jun 04 15:17:23 patchbox patchbox[664]: Created new Link instance with tempo 134
Jun 04 15:17:23 patchbox patchbox[664]: verbose(2): comport - PD external for un
Jun 04 15:17:23 patchbox patchbox[664]: LGPL 1998-2012, Winfried Ritsch and oth
Jun 04 15:17:23 patchbox patchbox[664]: Institute for Electronic Music - Graz
Jun 04 15:17:23 patchbox patchbox[664]: [comport] ** WARNING ** port #5 does not
Jun 04 15:17:23 patchbox patchbox[664]: error: [comport] opening serial port 5 f
Jun 04 15:17:23 patchbox patchbox[664]: verbose(4): … you might be able to tra
Jun 04 15:17:24 patchbox patchbox[664]: [comport] opened serial line device 0 (/
Jun 04 15:17:28 patchbox patchbox[664]: invalid sender address pisound-ctl
Jun 04 15:17:28 patchbox patchbox[664]: invalid destination address pisound-ctl
Jun 04 19:11:15 patchbox patchbox[664]: watchdog: signaling pd…
Jun 04 19:11:17 patchbox patchbox[664]: watchdog: signaling pd…
Jun 04 19:11:19 patchbox patchbox[664]: watchdog: signaling pd…
lines 19-41/41 (END)
Jun 04 15:17:22 patchbox sudo[1152]: pam_unix(sudo:session): session opened for user root by (uid=0)
Jun 04 15:17:22 patchbox sudo[1152]: pam_unix(sudo:session): session closed for user root
Jun 04 15:17:22 patchbox patchbox[664]: opened alsa client 132 in:1 out:1
Jun 04 15:17:22 patchbox sudo[1224]: root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/usr/bin/sh -c echo 1 > /sys/kernel/pisound/led
Jun 04 15:17:23 patchbox sudo[1224]: pam_unix(sudo:session): session opened for user root by (uid=0)
Jun 04 15:17:23 patchbox sudo[1224]: pam_unix(sudo:session): session closed for user root
Jun 04 15:17:23 patchbox sudo[1242]: root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/usr/bin/sh -c echo 1 > /sys/kernel/pisound/led
Jun 04 15:17:23 patchbox sudo[1242]: pam_unix(sudo:session): session opened for user root by (uid=0)
Jun 04 15:17:23 patchbox sudo[1242]: pam_unix(sudo:session): session closed for user root
Jun 04 15:17:23 patchbox patchbox[664]: setting up abl_link~
Jun 04 15:17:23 patchbox patchbox[664]: Created new Link instance with tempo 134.000000.
Jun 04 15:17:23 patchbox patchbox[664]: verbose(2): comport - PD external for unix/windows
Jun 04 15:17:23 patchbox patchbox[664]: LGPL 1998-2012, Winfried Ritsch and others (see LICENSE.txt)
Jun 04 15:17:23 patchbox patchbox[664]: Institute for Electronic Music - Graz
Jun 04 15:17:23 patchbox patchbox[664]: [comport] ** WARNING ** port #5 does not exist! (max == 0)
Jun 04 15:17:23 patchbox patchbox[664]: error: [comport] opening serial port 5 failed!
Jun 04 15:17:23 patchbox patchbox[664]: verbose(4): … you might be able to track this down from the Find menu.
Jun 04 15:17:24 patchbox patchbox[664]: [comport] opened serial line device 0 (/dev/ttyAMA0)
Jun 04 15:17:28 patchbox patchbox[664]: invalid sender address pisound-ctl
Jun 04 15:17:28 patchbox patchbox[664]: invalid destination address pisound-ctl
Jun 04 19:11:15 patchbox patchbox[664]: watchdog: signaling pd…
Jun 04 19:11:17 patchbox patchbox[664]: watchdog: signaling pd…
Jun 04 19:11:19 patchbox patchbox[664]: watchdog: signaling pd…
~
~
~
~
~
~
~
~
~
~
~
~

Looks like the PD patch is loaded and running with some non critical errors / warnings.

Is that the reason that the patch doesn’t open?
Tomorrow I will do a test to open an empty pd patch. I will let you know.

What do you mean by ‘patch doesn’t open’ - it’s running in the background, with GUI disabled, since if it’s started on startup, it happens before desktop is ready.

ah…got it :slight_smile: what can I do to run it in the foreground?

In that case you should deactivate the patchbox module, and use XDG autostart instead, here’s a tutorial.

Basically you have to create a ‘.desktop’ file that contains the command or script to execute, and it must be placed in a special location on the system. These applications should get started automatically once the graphical environment is opened.

Thank you!
I will do this. Do you what the reasons of this issue?