LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Linux Sound Device (https://www.linuxquestions.org/questions/linux-newbie-8/linux-sound-device-439506/)

petebatt 04-27-2006 06:55 PM

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

maroonbaboon 04-28-2006 07:14 AM

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/

:cool:

petebatt 04-28-2006 12:24 PM

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!

maroonbaboon 04-28-2006 08:13 PM

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.

petebatt 04-29-2006 03:24 PM

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!

maroonbaboon 04-29-2006 08:44 PM

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.


All times are GMT -5. The time now is 03:22 AM.