LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-27-2006, 06:55 PM   #1
petebatt
LQ Newbie
 
Registered: May 2005
Posts: 4

Rep: Reputation: 0
Linux Sound Device


Hello,

I recently wrote an application using Perl/Tk and it has an alert built into it.

The alert is the "\a" character and for some reason, it does not pipe through the speakers but on some internal speaker located in the main tower.

Does anyone know how I could send it through the speakers, so it could be really loud?

Sorry if this is a bad description, not sure how else to explain

Thanks!

-pb
 
Old 04-28-2006, 07:14 AM   #2
maroonbaboon
Senior Member
 
Registered: Aug 2003
Location: Sydney
Distribution: debian
Posts: 1,495

Rep: Reputation: 48
I think I get what you mean

Maybe I am imagining things (and I don't want to open the PC to check) but I thought that for most hardware you could plug the PC speaker wires into the sound card, so that the standard 'beep' came out hi-fi.

For a software solution can you change the code to play a sound instead of 'printing' the '\a'? If you have the right format I believe you can just cat it into the sound device.

But perhaps the ultimate solution is to install the beeper daemon:

http://www.carcosa.net/jason/software/beep/

 
Old 04-28-2006, 12:24 PM   #3
petebatt
LQ Newbie
 
Registered: May 2005
Posts: 4

Original Poster
Rep: Reputation: 0
Hello,

The speakers are wired into the sound card but the beep still does not come out hi-fi. I'm not sure of a way to play sounds out of a script. I'll have to look and see. I do like that beeper daemon though!

Thanks!
 
Old 04-28-2006, 08:13 PM   #4
maroonbaboon
Senior Member
 
Registered: Aug 2003
Location: Sydney
Distribution: debian
Posts: 1,495

Rep: Reputation: 48
Hi again. I guess 'PC Speaker' is a bit ambiguous, but I meant the little tinny speaker cone/magnet thingy typically stuck inside the PC case, and plugged into the motherboard with a couple of wires. I seem to recall you could instead connect the sound card to the m/b at the same place and toss out the little internal speaker altogether.

If the m/b has built-in sound maybe you do the same with a BIOS setting?

To play a sound from perl you would do a system call to emulate running a command from the console. If you get the sound in Sun Audio Format (usually .au suffix) and the sound device is /dev/audio then

$ cat sound.au > /dev/audio

will play the sound.
 
Old 04-29-2006, 03:24 PM   #5
petebatt
LQ Newbie
 
Registered: May 2005
Posts: 4

Original Poster
Rep: Reputation: 0
Hello,

I've only used system calls to launch other applications from within the scripts I've written.

Assuming the speakers are plugged in the sound card, more generally would the system call be:

system($ cat <filename> > /<path>)...something like that?

I'll look at this a little more in depth tomorrow AM, thanks!

PS Would the file need to be .au?

Thank you!
 
Old 04-29-2006, 08:44 PM   #6
maroonbaboon
Senior Member
 
Registered: Aug 2003
Location: Sydney
Distribution: debian
Posts: 1,495

Rep: Reputation: 48
More like

system("cat <filename> > /<path>")

(argument should be a string I think).

I found some .au files on my system with

$ find /usr/share -name '*.au' -print

and they work as suggested with /dev/audio. If you have some other format like .wav or .mp3 you will probably need some utility to convert.
 
  


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
Mplayer sound error: "Could not open/initialize audio device -> no sound" GTBlackwell Linux - Software 9 06-11-2008 02:23 PM
no sound from cd player, good sound from audio device test fmickel Linux - Hardware 5 06-04-2004 12:46 PM
Linux shutdown disabling sound device in BIOS Shay Linux - General 3 03-29-2004 05:45 PM
Linux shutdown disables sound device in BIOS. Shay Linux - Hardware 0 09-15-2003 11:53 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:25 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