Persistent startup sound for Lucid, may work in some others

How to do things, solutions, recipes, tutorials
Post Reply
Message
Author
User avatar
TLM
Posts: 183
Joined: Tue 09 Mar 2010, 05:14
Location: Central United States

Persistent startup sound for Lucid, may work in some others

#1 Post by TLM »

I have always wanted to have a startup sound in puppy. I have a script that will play a sound when you boot up Lucid, and it should work in several other puppies as well. I was aware that Lucid puppy barks on first run, as well as when you launch the Personalize Settings application. I traced down this down to the file countrywizard.qs which is located in /usr/sbin.

First, i made a copy of the file countrywizard.qs. Then, using a text editor, i stripped out everything except the part that plays the sound. I renamed the modified file startup-sound.qs and placed it in my /root/Startup folder.

NOTE: This script will also work when placed into the /etc/init.d directory.

The modified file is as follows:

Code: Select all

#!/bin/sh

#if [ "`grep 'alias snd\-card\-0' /etc/modprobe.d/alsa.conf`" != "" ];then #101017
    aplay /usr/share/audio/startup.au &
     #wavplay /usr/share/audio/startup.wav &
    RETAPLAY=$?
    PIDAPLAY=$!
#   fi

 
 fi
 
exit 0
It is also necessary to make sure the script points to your desired sound. In my case, i used pawdio converter to make two sounds; startup.wav and startup.au. I placed these sounds in the /usr/share/audio directory so the script would find them. I believe the wavplay line is commented out, so a .wav file is probably not necessary. The code most likely needs cleaned up a little, but it works as is. This script works in lucid 525 and 528. I have not tested it in others yet.
Last edited by TLM on Sun 01 Jul 2012, 16:23, edited 1 time in total.

shadower_sc
Posts: 136
Joined: Wed 21 Apr 2010, 23:03
Location: Texas

Awesome. :-)

#2 Post by shadower_sc »

That is a simple way to do it. I like it.

There are a couple of minor things that should be changed in your script.

It looks like the opening and closing if statements are commented out. That is fine. What looks odd is at the bottom of your script you have a closing "fi" statement without an opening "if" statement.

I am curious about the "Exit 0" statement at the bottom. I don't think it is needed, but I really don't know what it does. :-) Does it close the program that was opened to run the sound? Is it an extraneous part of the original script?

User avatar
TLM
Posts: 183
Joined: Tue 09 Mar 2010, 05:14
Location: Central United States

Re: Awesome. :-)

#3 Post by TLM »

shadower_sc wrote:That is a simple way to do it. I like it.

There are a couple of minor things that should be changed in your script.

It looks like the opening and closing if statements are commented out. That is fine. What looks odd is at the bottom of your script you have a closing "fi" statement without an opening "if" statement.

I am curious about the "Exit 0" statement at the bottom. I don't think it is needed, but I really don't know what it does. :-) Does it close the program that was opened to run the sound? Is it an extraneous part of the original script?
Sorry i cannot help there! I have not yet gotten into script writing. Like i mentioned in the original post, this is a hacked version of the countrywizard.qs script (the script in puppy that barks at startup. I just made a copy of it, hacked out everything but the audio parts, changed the lines to reflect the name of the sound i wanted it to play. I did leave the original countrywizard.qs script intact, just made a copy, hacked and renamed it, and got lucky and it worked! If you want to examine the original countrywizard.qs script, it is in /usr/sbin

User avatar
oldyeller
Posts: 889
Joined: Tue 15 Nov 2011, 14:26
Location: Alaska

#4 Post by oldyeller »

Hi TLM,

How did you do the sound in Patriot for it to play at startup and shutdown?

I have been wanting to do the samething

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#5 Post by Karl Godt »

oldyeller wrote:Hi TLM,

How did you do the sound in Patriot for it to play at startup and shutdown?

I have been wanting to do the samething
I would put the script snipplet into a file in the /etc/init.d directory named like 999_2barks.init so it starts after 10_alsa in Puppy 5 series .

User avatar
TLM
Posts: 183
Joined: Tue 09 Mar 2010, 05:14
Location: Central United States

#6 Post by TLM »

Karl Godt wrote:
oldyeller wrote:Hi TLM,

How did you do the sound in Patriot for it to play at startup and shutdown?

I have been wanting to do the samething
I would put the script snipplet into a file in the /etc/init.d directory named like 999_2barks.init so it starts after 10_alsa in Puppy 5 series .
Yes, the script will load the startup sound sooner if placed into directory /etc/init,d

I have done it this way in my two latest puplet releases, Diamond and PatriotOS. In fact, i believe a person could place one copy of the script in /etc/init.d, and another copy in /root/startup if one desired TWO sounds to play, one prior to desktop load and one after. They could even be different sounds. Lots of things you can do with this script. You can add an exec line of code to it to cause it to launch a program with a sound. This is how it works in PatriotOS for the shutdown sound. I placed the script in /usr/bin as follows:

Code: Select all

#!/bin/sh


#if [ "`grep 'alias snd\-card\-0' /etc/modprobe.d/alsa.conf`" != "" ];then #101017
    aplay /usr/share/audio/shutdown.au &
     #wavplay /usr/share/audio/shutdown.wav &
    RETAPLAY=$?
    PIDAPLAY=$!
#   fi
exec /usr/bin/ali-logout
 
 fi
 
exit 0
Note the exec line invokes ali-logout, which is the shutdown manager i use. Then it is simply a matter of linking all shutdown options in the menu to this script. When actuated, the sound plays and the exec line executes whatever you tell it to. You could just as easily make the exec line launch your browser or any other program. With sound! :D

User avatar
TLM
Posts: 183
Joined: Tue 09 Mar 2010, 05:14
Location: Central United States

#7 Post by TLM »

oldyeller wrote:Hi TLM,

How did you do the sound in Patriot for it to play at startup and shutdown?

I have been wanting to do the samething
Get the following files from my PatriotOS of Diamond puplet in the Puppy Derivatives section of this forum:

shutdown-sound.qs (located in /usr/bin)

AND

startup-sound.qs (located in /etc/init.d)

Place them into your puplet. Open the scripts with a text editor and note the lines that denote wav and au sounds. The default file path for the sounds is /usr/share/audio

You need to make very sure to place your sounds into /usr/share/audio and modify the two files above to point to your sounds. The scripts will not play the sounds if they cannot find them. You can use different directories if you wish, so long as the path to the sounds is modified in the scripts as well.

VERY IMPORTANT: for the shutdown-sound.qs, it is written to point to my shutdown program (ali-logout) You will need to modify the exec line in it to point to your shutdown option, which will vary depending on what windowmanager you are using. Hope this helps. Cheers all. :D

User avatar
oldyeller
Posts: 889
Joined: Tue 15 Nov 2011, 14:26
Location: Alaska

#8 Post by oldyeller »

To Karl Godt,

Thanks for the info

To TLM,

I will give it a go Thanks for the code and how to do it.

It sure is nice to be able to customize the sound

Thanks

User avatar
flyp22
Posts: 32
Joined: Wed 08 Jul 2015, 17:56
Location: Germany

Works a charm in Tahrpup 6.0.3

#9 Post by flyp22 »

I've used this code to get my startup sound running in Tahrpup 6.0.3 with the following setup:

* I reduced the code and found that this code was absolutely sufficient:

Code: Select all

    aplay /usr/share/audio/2barks.au &
#replace the path with the one to the audio file you wish to play
* I took an executable from /usr/sbin (I used the one called "quicksetup") and opened it as text (with geany).
* I replaced all the content with the code from this page and saved the file as "zstartup-sound" (the z is to make it start up after everything else has loaded)
* Now it should show up black in /usr/sbin. To make it green, i.e. executable, I right clicked and changed the user rights to executable and searchable (a+x)
* Now you should be able to click it and hear the sound you put in the code
* To put it into persistent auto start I used the "Startup Control" GUI which you find in the Menu under Setup - add a new app here i.e. zstartup-sound and you're done.
* reboot and test :)

I hope that helps some people. Enjoy :)
Acer TravelMate 220 [color=blue]Intel Celeron CPU 1333MHz[/color] 739 MB RAM
Tahrpup 6.0.2 frugal folder [color=blue]Linux Kernel: 4.0.4 (i686) PAE[/color] PUPMODE=12
Belkin Surf Micro Wireless Adapter [Realtek RTL8188CUS] driver: rtl8192cu

User avatar
flyp22
Posts: 32
Joined: Wed 08 Jul 2015, 17:56
Location: Germany

Shutdown sounds for Tahrpup 6.0.3

#10 Post by flyp22 »

For shutdown sounds its just as easy. Just add this code line at the beginning of the usr/bin/wmpoweroff and/or wmreboot script using your favourite text editor:

Code: Select all

   aplay /usr/share/audio/2barks.au &
#replace the path with the one to the audio file you wish to play
Don't place it too far down in the script or the sound may be cut off by the shutdown process.

Enjoy 8)
Acer TravelMate 220 [color=blue]Intel Celeron CPU 1333MHz[/color] 739 MB RAM
Tahrpup 6.0.2 frugal folder [color=blue]Linux Kernel: 4.0.4 (i686) PAE[/color] PUPMODE=12
Belkin Surf Micro Wireless Adapter [Realtek RTL8188CUS] driver: rtl8192cu

Post Reply