Step 1: Get Raspian image.
Step 2: Burn image to an SD card.
Step 3: Transfer the fireplace WAV file to the raspberry pi.
- Set up your Pi with a keyboard and display, and download the file from the internet using a browser running on your Pi.
- Or, set up your Pi the completely headless way, log in to it, and then use wget to fetch the file. For example:
wget -O fireplace.wav http://soundbible.com/grab.php?id=1543&type=wav
- Or (for example, if the audio file you want requires log in to download--like this one from freesound.org which is the one I am actually using), use scp to transfer the sound file to your Pi.
Step 4: Play sound at boot up, by creating /etc/init.d/fireplace.sh file:
#!/bin/sh
while [ true ]; do aplay /home/pi/fireplace.wav; done;
Now make this file executable:
sudo chmod 755 /etc/init.d/fireplace.sh
Now add this script to all the defaut runlevels:
sudo update-rc.d fireplace.sh defaults
Reboot and you should be all set!
If you don't like the volume, you can log in to your Pi and then run the command line mixer:
alsa-mixer
The save your settings to a file using the alsactl ("also control") program:
mkdir ~/.config
alsactl --file ~/.config/asound.state store
Then you will want to load these settings before you loop your sound file at boot by editing your fireplace.sh script as follows:
#!/bin/sh
alsactl --file /home/pi/.config/asound.state restore
while [ true ]; do aplay /home/pi/fireplace.wav; done;
Next up: an amplified speaker to hear the sounds.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.