LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 03-05-2008, 10:24 PM   #1
Romanus81
Member
 
Registered: Feb 2008
Posts: 201

Rep: Reputation: 31
Would it be possible for my PC to play music while it boots?


Just wondering. I thought it would be a cool feature to get a small chip-tune sounding song (think early video games) when my PC boots. How would I go about doing that?
Is there any way I can edit the order in which everything boots so that the first thing it does is start mpd, anything mpd needs to run, and start a song?
 
Old 03-05-2008, 10:30 PM   #2
Jeebizz
Senior Member
 
Registered: May 2004
Distribution: Slackware15.0 64-Bit Desktop, Debian 11 non-free Toshiba Satellite Notebook
Posts: 4,186

Rep: Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378
Theoretically maybe something could be done through the BIOS when it boots up, and have it output to the PC-Speaker only. It would probably too complicated and maybe not even feasible to output direct to the sound card itself, because each soundcard is different, and holding instructions for every single soundcard on a BIOS just doesn't seem like a good idea. Still, even if it were done, you most likely would have to wait until the song is finished before the rest of the boot process is started. When a computer starts up, it goes throw each piece of hardware at a time: Checking for CPU, memory, keyboard, etc. It would probably just end up in really long booting times.

I don't see any real feasible way of doing this at all.

[edit]

I think this thread should be in General. Nothing really to do with Slackware.

Last edited by Jeebizz; 03-05-2008 at 10:32 PM.
 
Old 03-05-2008, 10:33 PM   #3
Romanus81
Member
 
Registered: Feb 2008
Posts: 201

Original Poster
Rep: Reputation: 31
how about at the log-in prompt? Would it be possible to run a command right before asking for a log-in?
And I when I use mpd after typing in the command to play the song there is a second delay while it starts the song before I get another command prompt waiting for a command. So I don't think it will wait until the song is done.

Last edited by Romanus81; 03-05-2008 at 10:39 PM.
 
Old 03-05-2008, 10:37 PM   #4
Jeebizz
Senior Member
 
Registered: May 2004
Distribution: Slackware15.0 64-Bit Desktop, Debian 11 non-free Toshiba Satellite Notebook
Posts: 4,186

Rep: Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378
Possibly. At that point the drivers for the soundcard would have been loaded, its just a matter of having a script executed at that point, probably after a user has logged in though.
 
Old 03-05-2008, 10:41 PM   #5
Romanus81
Member
 
Registered: Feb 2008
Posts: 201

Original Poster
Rep: Reputation: 31
hm, so there is no way to add commands to the boot script before the log in? What if I wanted it to execute a clear command or something like that, so that the login prompt appears at the top of the screen, instead of under the boot texts. would that be possible?
 
Old 03-05-2008, 10:47 PM   #6
Jeebizz
Senior Member
 
Registered: May 2004
Distribution: Slackware15.0 64-Bit Desktop, Debian 11 non-free Toshiba Satellite Notebook
Posts: 4,186

Rep: Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378
You can add scripts before the login, thats how a lot of things get loaded before a user even logs in, say like a printer server, the volume settings, permissions, etc. You can execute a simple clear command. If you are booting in user runlevel 3, edit the rc.S file, and issue a simple 'clear' command somewhere near the end of that file.
 
Old 03-05-2008, 10:55 PM   #7
T3slider
Senior Member
 
Registered: Jul 2007
Distribution: Slackware64-14.1
Posts: 2,367

Rep: Reputation: 843Reputation: 843Reputation: 843Reputation: 843Reputation: 843Reputation: 843Reputation: 843
rc.local would probably be a better file to edit.
 
Old 03-05-2008, 11:02 PM   #8
drumz
Member
 
Registered: Apr 2005
Location: Oklahoma, USA
Distribution: Slackware
Posts: 904

Rep: Reputation: 693Reputation: 693Reputation: 693Reputation: 693Reputation: 693Reputation: 693
Can't help with the music, but I can with the clear command. I modified /etc/issue so at the login prompt the screen is first cleared. Using nano it looks like this:
Code:
^[[H^[[2J

Welcome to \s \r (\l)
^[[01;34mSlackware 12^[[00m
but the "^[" are special characters; you can't just type them in like that (sadly, I forgot how I input them). The stuff around "Slackware 12" makes the text blue, and then resets the color to white. If you're willing to create the file in a hex editor here it is:
Code:
0000:0000 | 1b 5b 48 1b 5b 32 4a 0a 0a 57 65 6c 63 6f 6d 65 | .[H.[2J..Welcome
0000:0010 | 20 74 6f 20 5c 73 20 5c 72 20 28 5c 6c 29 0a 1b |  to \s \r (\l)..
0000:0020 | 5b 30 31 3b 33 34 6d 53 6c 61 63 6b 77 61 72 65 | [01;34mSlackware
0000:0030 | 20 31 32 1b 5b 30 30 6d 0a 0a                   |  12.[00m..

Last edited by drumz; 03-05-2008 at 11:04 PM.
 
Old 03-05-2008, 11:56 PM   #9
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928

Rep: Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612
Putting a command in rc.local would be easy enough and non-intrusive. You could have something running a little while before that, but it would require hacking the init scripts and would slow things down. rc.locala is the last thing run just before login, so it wouldn't slow things down. Playing something at that point would be a handy way of letting you know its' time to login if you are off in another room (making coffee?) while your computer starts up.
 
Old 03-06-2008, 08:50 AM   #10
nekkutta
LQ Newbie
 
Registered: Feb 2008
Distribution: Slackware 12
Posts: 22

Rep: Reputation: 15
I have tried this and it didn't work on my copy of 10.2, why not I have no clue, it is bash correct but oddly it doesn't work.

Code:
#!/bin/sh
#
# /etc/rc.d/rc.local:  Local system initialization script.
#
# Put any local setup commands in here:

# Start APC UPS daemon:
if [ -x /etc/rc.d/rc.apcupsd ]; then
  . /etc/rc.d/rc.apcupsd start
fi

# Play Power on noise:

echo "Playing power on noise"

. /usr/bin/amp -q /usr/share/apcupsd/please_login.mp3 & >/dev/null
I've tried with the '.' and without the '.' and I've tried with and without the '>/dev/null' I've tried amp and mpg321 (yes, I even set output to alsa) to no avail.

an odd side note is that the echo command right before doesn't show up either, but acpupsd starts... so it isn't like rc.local isn't being run.

Maybe some one could shine some light on this.

nekkutta

Last edited by nekkutta; 03-06-2008 at 08:52 AM. Reason: add'l info
 
Old 03-06-2008, 09:55 AM   #11
ludist
Member
 
Registered: Nov 2005
Location: Greece
Distribution: Slackware
Posts: 172

Rep: Reputation: 21
Try this

Code:
su SomeUser -c "lame --quiet --decode YourFile.mp3 - | aplay &"
Mind the "-"

Allthough I see no reason to have problems with

Code:
su SomeUser -c "mpg321 -q YourFile.mp3 &"

Last edited by ludist; 03-06-2008 at 10:00 AM.
 
Old 03-07-2008, 11:00 AM   #12
nekkutta
LQ Newbie
 
Registered: Feb 2008
Distribution: Slackware 12
Posts: 22

Rep: Reputation: 15
thanks for the help, tried your suggestion and it still didn't work, so I really started looking at what was happening, moved the amp command before my UPS script and it worked fine, for some reason the UPS script had an exit 0 at the end of it. grrr.... so I commented it out and it works perfectly now

nekkutta
 
Old 03-07-2008, 06:36 PM   #13
shadowsnipes
Senior Member
 
Registered: Sep 2005
Distribution: Slackware
Posts: 1,443

Rep: Reputation: 73
I've been doing this sort of thing for years. I keep all my custom System sounds at /opt/SysSounds. To play a quick diddy at the end of boot up I call up an audio player in /etc/rc.d/rc.local (as already has been mentioned). However, I also add a line to restore the sound device volume settings just before doing this. I do this because I've seen rc.alsa not do its job correctly before. So, I always add a alsactl restore or a aumix -L just to make sure the volume is up. It doesn't slow down the boot really, so there's not any real cost.

This is a simplified version, but you can also check for errors before attempting to play the sound, and you can also check to see if the alsa settings are up instead of just restoring them (possibly a second time). If you omit a quiet option (-q for amp) then you might want to catch output in /dev/null as shown previously.

Code:
/usr/sbin/alsactl restore

if [ -r /opt/SysSounds/firstblood.mp3 ]
then
     /usr/bin/amp -q /opt/SysSounds/firstblood.mp3 &
fi
I also have a sound played when my user logs out of a shell. Just add an executable script like this to your home directory

.bash_logout
Code:
echo "See ya later!"
if [ -r /opt/SysSounds/byebye.mp3 ]
then
     /usr/bin/amp -q /opt/SysSounds/byebye.mp3 &
fi
By the way, in case anyone is wondering what mp3's those are, I made them from some of the sounds samples in Worms Armageddon. Those particular two are from the "Soul man" voice.

As far as modifying init scripts for listening to music during the boot: You can pretty much do this as soon as your sound device is configured, but unless you have some slow start up times for things like MySQL, Apache, Samba, etc then it isn't really worth it. One thing that might be useful is to start a music daemon that you can control from the command line. Supposedly audacious's headless mode is supposed to do this, but in my experience you cannot start it until after X is started. You could just use the find command and amp to play a bunch of music daemon style, but it wouldn't give you the control that something like xmms/audacious's headless mode has.

Another related application that can involve modifying init scripts is having a music mode for your computer. I have also done this for a very long time and it works great. I created special boot variables that makes the computer boot into single user mode and skips a lot of unnecessary stuff and then starts herrie (an ncurses audio/playlist player) in chroot mode. Once you quit herrie the login prompt shows. A quick telinit and you can be back at the normal runlevel, or you can give the three finger salute to shutdown. It's quite simple and allows me to listen to music on my computer from boot to music in only a few seconds.

I've been meaning to start a thread on this but just haven't done so yet. I'll have to get on that...I guess part of the reason I haven't is that I have not seen much interest for it. Most people just use a dedicated mp3 player nowadays.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to play music on redhat praveenjayak Linux - Newbie 1 01-09-2008 02:19 PM
Can't play music ronepowell MEPIS 10 06-04-2007 08:58 AM
play music m_talebi_z Ubuntu 10 06-17-2006 04:06 AM
cant play music king kong killa Fedora 2 06-11-2004 09:36 PM
my music won't play JamDunc Linux - Newbie 4 08-03-2003 07:30 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 08:59 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration