2

I know that this question has already been answered, but the method described here is actually not working for me... o.O I read in some other forums that a different formatting is required, but I don't know which... If anyone could help me with this... I am running Raspbian's latest release as of 28/11/2014 Cheers

4
  • You should include a link to the other question, what do you mean by not working, what do the logs say if anything, is there any message in dmesg? Nov 29, 2014 at 0:44
  • Sorry, the link to the other question is actually the word "here"... It's my fault, I didn't make it very clear... Nov 30, 2014 at 2:27
  • When using the solution described in the link, as soon as i create the file and add the script in Nano, exit and save I get chmod: changing permissions of '/etc/init.d/start-sound': Operation not permitted Nov 30, 2014 at 2:55
  • Ok, in the end I managed to find the rest of the script by using the formatting of another startup-script. (##BEGIN INIT INFO part was actually missing). I am going to share the script here in some time, so everybody who is still trying to figure out how to create a Startup Sound can use it... Nov 30, 2014 at 3:24

3 Answers 3

2

You can create a startup sound using mplayer and a mp3 file.

Here is what you need:

  1. Install mplayer

    sudo apt-get install mplayer

  2. Make sound directory in /etc

    sudo mkdir /etc/sound

  3. Upload the sound file as mp3 to the sound directory

    sudo mv /tmp/soundfile.mp3 /etc/sound/sample.mp3

  4. Copy and paste below line on command promp

    sudo echo "mplayer /etc/sound/sample.mp3" >> /etc/rc.local

make sure to upload your mp3 file to your raspberry pi in /tmp/ directory

3
  • The file rc.local is actually containing something about my IP-Adress... I am not familiar with scripting, would you be able to show me what exactly to add in that file? Nov 30, 2014 at 3:03
  • @BlackWhiteX I have updated my answer by formatting code and making it clear. Nov 30, 2014 at 8:21
  • using your solution, when I type in sudo echo "mplayer /etc/sound/sample.mp3" >> /etc/rc.local I get -bash: /etc/rc.local: Permission denied Dec 2, 2014 at 19:52
1

Instead of aplay use omxplayer which can read MP3, AAC, WAVE and a few others.

# /etc/init.d/start-sound

echo "Playing startup sound"
omxplayer /path/to/file.mp3 2>&1 >/dev/null &

omxplayer is pre installed with the latest (for a while now) and also you can do the same to play video to a selected output device.

If you get permission error try putting sudo in front of omxplayer

0

Add the command to play the sound at the end of /etc/rc.local

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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