I find it hard to believe that such a simple thing is eluding me. I just have to be looking in the wrong place.
I want to make the speakers on my PC go beep or beeeep.
Currently writing a project in C but I'm pretty flexible on source language.
Running ubuntu 12.04.
Any pointers, even those that make me go "Doh"! greatly appreciated.
Nev
On 23/07/13 17:52, nev young wrote:
I want to make the speakers on my PC go beep or beeeep.
Currently writing a project in C but I'm pretty flexible on source language.
Owd Skool perhaps, but for a console app, perhaps
printf("\a");
would work?
This http://wiki.bash-hackers.org/commands/builtin/printf says "A" is the alert character, AKA Bell, or beep I think. Alternatively, someway of echoing the relevant ascii character. I think it's equivalent to ctrl-G.
Failing that, I'm sure there's some way of controlling the speaker, but I bet it involves various libraries etc.
On a whim, I typed in "beep" and got told that it wasn't installed. I installed it, it's supposed to work, but I get nothing.
Info on beep here http://manpages.ubuntu.com/manpages/hardy/man1/beep.1.html
Further research http://superuser.com/questions/22767/enable-system-beep-in-ubuntu
I found that then last comment "mplayer -ao alsa ..." worked for me.
HTH
Steve
On Tue, 23 Jul 2013 17:52:37 +0100 nev young nev@nevilley.org.uk wrote:
I find it hard to believe that such a simple thing is eluding me. I just have to be looking in the wrong place.
I want to make the speakers on my PC go beep or beeeep.
Currently writing a project in C but I'm pretty flexible on source language.
According to a book I have here, it says 'many C compilers provide a 'sound' function and then lists this :-
#include <dos.h> (it was written with Windows in mind obviously!) void sound(unsigned frequency); void nosound(void);
It then goes on to list a program to produce a siren sound but I won't trouble you with that ;-)
On 23/07/13 17:52, nev young wrote:
Any pointers, even those that make me go "Doh"! greatly appreciated.
The command-line sound tool sox will deafen you if you ask it nicely.
If you really want to use the old beepy beepy PC speaker (do many systems still have them?), look at the snd-pcsp driver.
Heed its warnings, though, else you may be beepily surprised.
Regards,
On 23/07/13 19:26, MJ Ray wrote:
On 23/07/13 17:52, nev young wrote:
Any pointers, even those that make me go "Doh"! greatly appreciated.
The command-line sound tool sox will deafen you if you ask it nicely.
The winner !
sox, using the synth option, led me to play. Ok so far, I have to plug an amp & speaker into the on-board speaker socket as I haven't got it to beep down the HDMI (yet) but it gets me through to the next phase of my project.
btw. beep is stubbornly silent. as is
void sound(unsigned frequency);
Thanks to all who offered support.
Nev
On Wed, 24 Jul 2013 08:46:53 +0100 nev young nev@nevilley.org.uk wrote:
btw. beep is stubbornly silent. as is
void sound(unsigned frequency);
The speaker isn't turned off in the BIOS is it?
On 24 Jul 09:38, Chris Walker wrote:
On Wed, 24 Jul 2013 08:46:53 +0100 nev young nev@nevilley.org.uk wrote:
btw. beep is stubbornly silent. as is
void sound(unsigned frequency);
The speaker isn't turned off in the BIOS is it?
Both of those will try to use the pcspkr, you may need to load the module...
sudo modprobe pcspkr
On 24/07/13 09:41, Brett Parker wrote:
On 24 Jul 09:38, Chris Walker wrote:
On Wed, 24 Jul 2013 08:46:53 +0100 nev young nev@nevilley.org.uk wrote:
btw. beep is stubbornly silent. as is
void sound(unsigned frequency);
The speaker isn't turned off in the BIOS is it?
Both of those will try to use the pcspkr, you may need to load the module...
sudo modprobe pcspkr
More than that, the pcspkr driver module is frequently blacklisted in *buntu. Apparently people don't want pc speaker beeps any more. I found this out whilst I was googling for a solution. Lots of info on pcspkr driver being blacklisted and what to do to remove it if you google it.
HTH
Steve
On 24/07/13 10:16, steve-ALUG@hst.me.uk wrote:
More than that, the pcspkr driver module is frequently blacklisted in *buntu. Apparently people don't want pc speaker beeps any more. I found this out whilst I was googling for a solution. Lots of info on pcspkr driver being blacklisted and what to do to remove it if you google it.
I just turn the bleeps off - can turn them on again at will - assuming I can unforget where to do it...
Mint rules OK
On 24/07/13 09:41, Brett Parker wrote:
Both of those will try to use the pcspkr, you may need to load the module...
sudo modprobe pcspkr
Hasn't snd-pcsp replaced that now? Or am I being too modern for once? ;-)
Regards,
On 24/07/13 09:38, Chris Walker wrote:
On Wed, 24 Jul 2013 08:46:53 +0100 nev young nev@nevilley.org.uk wrote:
btw. beep is stubbornly silent. as is
void sound(unsigned frequency);
The speaker isn't turned off in the BIOS is it?
No it isn't but I'm not trying to use the PC speaker. I am trying to use the speakers in the monitor by sending sound down the HDMI lead.
As I have stated I can get sound out of the inbuilt sound chip on the motherboard and, for now, that'll do.
Nev
On Wed, 24 Jul 2013 18:54:31 +0100 nev young nev@nevilley.org.uk wrote:
On 24/07/13 09:38, Chris Walker wrote:
On Wed, 24 Jul 2013 08:46:53 +0100 nev young nev@nevilley.org.uk wrote:
btw. beep is stubbornly silent. as is
void sound(unsigned frequency);
The speaker isn't turned off in the BIOS is it?
No it isn't but I'm not trying to use the PC speaker. I am trying to use the speakers in the monitor by sending sound down the HDMI lead.
As I have stated I can get sound out of the inbuilt sound chip on the motherboard and, for now, that'll do.
As I have not need yet for HDMI sound, I've never investigated it but a quick google for 'hdmi sound not working linux' produces this :- ========== you have to edit your grub config. open /etc/default/grub with your preferred text editor and look for GRUB_CMDLINE_LINUX_DEFAULT and add radeon.audio=1 to the end of it.
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
becomes
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash radeon.audio=1"
now save the file and run update-grub ==========
Would this happen to be on a Pi as I might well run into the same problem later and it would be useful to know if it is?
On 25/07/13 14:17, Chris Walker wrote:
On Wed, 24 Jul 2013 18:54:31 +0100 nev young nev@nevilley.org.uk wrote:
On 24/07/13 09:38, Chris Walker wrote:
On Wed, 24 Jul 2013 08:46:53 +0100 nev young nev@nevilley.org.uk wrote:
btw. beep is stubbornly silent. as is
void sound(unsigned frequency);
The speaker isn't turned off in the BIOS is it?
No it isn't but I'm not trying to use the PC speaker. I am trying to use the speakers in the monitor by sending sound down the HDMI lead.
As I have stated I can get sound out of the inbuilt sound chip on the motherboard and, for now, that'll do.
As I have not need yet for HDMI sound, I've never investigated it but a quick google for 'hdmi sound not working linux' produces this :- ========== you have to edit your grub config. open /etc/default/grub with your preferred text editor and look for GRUB_CMDLINE_LINUX_DEFAULT and add radeon.audio=1 to the end of it.
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
becomes
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash radeon.audio=1"
now save the file and run update-grub
Would this happen to be on a Pi as I might well run into the same problem later and it would be useful to know if it is?
no no nooooooooooo you misunderstand my ramblings.
The sound works fine.
I listen to music and watch videos etc etc.
It is just *my program* that is being stubbornly quiet.
It's not a PI. It's a home built thing with a 6core AMD Phenom running at 3.3GHz. 16G mem and about 5.5Tb of disk. There are two sound cards (chips) in the machine. One on the motherboard and one on the video card (which connects to the monitor via HDMI cable). They both work very well.
Maybe if I said what the project is. (it is silly and trivial and that's why I was getting frustrated).
I've recently joined the ranks of ham radio enthusiasts but really need to improve my morse (listening). Plan is capture all keystrokes while I'm using the PC, filter out the crap and sound the morse for each key as it's pressed. So I could be writing a program, a document, an email, a facebook status etc. etc. and every time I press a key I will hear the morse sound out so I (hopefully) will learn and improve.
So far: capture keystrokes - done filter out the crap - done convert to morse - done make it go dah di di dit dit dit di dah dah dit - not there yet.
I really though it would be the simplest bit to do !
Nev
On 25/07/13 18:34, nev young wrote:
I really though it would be the simplest bit to do !
Remember that when learning Morse, receiving (and translating the beeps into letters/numbers/w.h.y? should be managed first.)
Even when I was an army cadet in the Signals Section and my memory was somewhat keener than it is now, I learnt to send at about 14 w.p.m, but when I tried receiving, I managed 0 w.p.m.