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 |
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: |
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! |
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. |
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! |
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. |