The AudioPint is designed to be ready to use immediately once plugged in. To do this, the AudioPint OS install can be modified to launch PureJoy/PureData automatically.
This guide assumes that you have downloaded and installed our OS image for the AudioPint.
PureData needs to be started with certain arguments in order for PureJoy to run properly. You can simply type the commands into the prompt to run PureJoy, or you can put all the commands into one script. To do this, you must make the flash drive writeable by typing
sudo sh ~/make_writeable.sh
Then, in the /home/audiopint/purejoy directory, type in
sudo nano run_audiopint4ch_OSS
This will open nano, the text editor, which allows you to write scripts. (This is also the line you should type if you want to edit the script later. Also, any other text editor will also work.) Nano will open a new file titled 'run_audiopint4ch_OSS.' In nano, type in these PureData arguments all on one line:
pd -lib zexy -lib joystick -oss -r 44100 -audiodev 1,2,3,4 -inchannels 2,2,2,2 -outchannels 2,2,2,2 -audiobuf 6 -nomidi purejoy_audiopint4ch_OSS.pd
Press ctrl+x, and confirm that you want to save the changes by pressing Y. Now you should have a working script to run PureData!
You can check to see if your script works by typing
sudo sh run_audiopint4ch_OSS.
Starting PureData on the AudioPint automatically does not require the PureData GUI. Without the GUI, the hardware does not have to work as much to keep everything running. To do this, copy the run_audiopint4ch_OSS file to a new file titled run_audiopint4ch_OSS_nogui by typing
sudo cp run_audiopint4ch_OSS run_audiopint4ch_OSS_nogui.
Open the new file with nano. In the text editor, add ”- nogui” right after “pd” in the script, so it looks like this:
pd -nogui -lib zexy -lib joystick -oss -r 44100 -audiodev 1,2,3,4 -inchannels 2,2,2,2 -outchannels 2,2,2,2 -audiobuf 6 -nomidi purejoy_audiopint4ch_OSS.pd
Now that we have a file of commands that can start PureData, we can create an initialization script that will run when the system boots. This initialization script needs to be placed in the /etc/init.d directory. Change directories by typing
cd /etc/init.d
Create a new script by typing
sudo nano pd
Within Nano, enter these lines of code:
#! /bin/sh
# make sure the PD binary exists
PD_BIN=/usr/local/bin/pd
test -x $PD_BIN || exit 5
#required if you use LADSPA plugins in your patch
export LADSPA_HOME=/usr/lib/ladspa
export LADSPA_PATH=/usr/lib/ladspa
case "$1" in
start)
echo -n "Starting PD\n"
cd /home/audiopint/purejoy
su audiopint run_audiopint4ch_OSS_nogui &
;;
stop)
echo -n "Shutting down PD\n"
killall pd
;;
restart)
echo -n "Restarting PD\n"
$0 stop
$0 start
;;
*)
echo "Usage $0 {start|stop|restart}
exit 1
;;
esac
exit 0
# end
Then save the file. Permissions on the file need to be changed if they are not identical to the other files in /etc/init.d . To see what the permissions are on the file, type
ls -all
Generally, init.d files should have these permissions listed:
-rwxr-xr-x
The pd file might have these permissions listed:
-rw-r–r–
If so, edit the permissions by typing:
chmod ugo+x pd
Typing ls -all again should reveal that pd has the same permissions as the other files. Test to see if the script works by typing
sudo ./pd start
Since we have the initialization script ready, we can update the init state directory (analogous to a startup directory) to make the script run. Do this by typing
sudo update-rc.d -f pd start 99 2 3 4 5 .
(Don't forget the period at the end of the line.)
This should update the directories titled /etc/rc?.d , where ? is replaced by 2, 3, 4, and 5. Check to see if the rc2.d directory is updated.
cd /etc/rc2.d ls
There should be a file named S99pd located in the directory if you've updated correctly.
If you're finished editing the scripts, make the image read-only by typing
sudo sh ~/make_readonly.sh
Check that Puredata starts when you switch from the run level 1 to the run level 2, effectively booting from a command-line interface to the gui. (The numbers 1 and 2 correspond to the numbers in rc1.d and rc2.d. Notice that we did not update rc1.d.) Do this by first making the image read-only:
sudo sh ~/make_readonly.sh
Then switch to run level 1 by typing
sudo telinit 1
Once you've got a prompt, switch back to run level 2 by typing
telinit 2
PureData should start automatically! Check that it is running in the background by typing
ps aux | grep pd
If PureData is running, you should be able to see the commands in the run_audiopint4ch_OSS_nogui script.