Take the 2-minute tour ×
Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. It's 100% free, no registration required.

I am running RPi headless and would like it to play a sound (like when a Mac boots) so I know it is booting and how far it got. I can play music/wav files now, What is the best way to have something play a sound file when RPi boots?

Note, it doesn't have to be very early on, it would be fine if RPi boots, does everything it needs to do and then when it is ready for someone to login the sound plays.

Update 1: I am using Raspbian “wheezy”

share|improve this question
    
You'll need to create your own init script. But the process of doing this depends on what distro you are using. Which is it? –  Jivings Nov 18 '12 at 19:06
    
FYI, I didn't get notified of that update because it's not a comment reply. –  Jivings Nov 18 '12 at 23:15
add comment

1 Answer 1

up vote 6 down vote accepted

Essentially all you have to do to create a start-up script is the following:

Create a file here and make it executable:

sudo nano /etc/init.d/start-sound && chmod +x $_

Add it to the default runlevel:

sudo update-rc.d start-sound defaults

All your script really needs to do is call aplay on an audio file. Something like this:

# /etc/init.d/start-sound

echo "Playing startup sound"
aplay /path/to/file.mp3 2>&1 >/dev/null &
share|improve this answer
    
Maybe this should be a new question, but after installing alsa-util on Raspbmc, I get ALSA lib confmisc.c:768:(parse_card) cannot find card '0' when I run aplay /home/pi/beep-3.mp3 where beep-3.mp3 is an mp3 file of a beep sound. –  HeatfanJohn Nov 19 '12 at 1:56
1  
@HeatfanJohn Try sudo modprobe snd_bcm2835. If that doesn't work then ask a new question :) –  Jivings Nov 19 '12 at 8:29
    
That fixed my problem. Thanks for your help! Looks like this question was my problem. Thanks again. –  HeatfanJohn Nov 19 '12 at 15:02
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.