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

BlackWhiteX
  • 21
  • 1
  • 3
  • 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? – Steve Robillard Nov 29 '14 at 00:44
  • Sorry, the link to the other question is actually the word "here"... It's my fault, I didn't make it very clear... – BlackWhiteX Nov 30 '14 at 02: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 – BlackWhiteX Nov 30 '14 at 02: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... – BlackWhiteX Nov 30 '14 at 03:24

3 Answers3

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

Chetan Bhargava
  • 1,262
  • 3
  • 15
  • 29
  • 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? – BlackWhiteX Nov 30 '14 at 03:03
  • @BlackWhiteX I have updated my answer by formatting code and making it clear. – Chetan Bhargava Nov 30 '14 at 08: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 – BlackWhiteX Dec 02 '14 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

Piotr Kula
  • 17,307
  • 6
  • 65
  • 104
0

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

Will
  • 380
  • 4
  • 17