Scheduling your audio actions
In this section, we'll be looking at different techniques of triggering a recording or a playback and optionally how to make it stop after a certain period of time.
Start on power up
The first method we'll cover is also the most blunt—how to start a recording or playback directly when powering up the Raspberry Pi. There isn't really a standardized way of auto-starting regular user applications on boot, so we'll have to improvise a bit to come up with our own way of doing what we want.
The Raspbian boot process is basically a collection of shell scripts being run one after the other, each script performing some important task. One of the last scripts to run is /etc/rc.local
, which is a good starting point for our custom autorun solution. Right now, the script doesn't do much, just prints out the IP address of the Pi.
You can try running the script any time using the following command:
pi@raspberrypi ~ $ /etc/rc.local
We could just jam our list of commands right in...