DaemonForums  

Go Back   DaemonForums > OpenBSD > OpenBSD General

OpenBSD General Other questions regarding OpenBSD which do not fit in any of the categories below.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 1st November 2017
GarryR's Avatar
GarryR GarryR is offline
Real Name: Garry Ricketson
Package Pilot
 
Join Date: Jul 2015
Location: Durango, Mx.
Posts: 202
Default Generate a tone or "beep"

I did a lot of searching, but can not figure out , How can I generate a tone, or
make a "beep" ?
There is no "beep" package for openbsd, but I did find :
https://man.openbsd.org/spkr.4
But am confused, seems like maybe I need some package, but not sure of the name or
what package would let me generate a tone, (beep), I do want to be able to change
the tone, to higher or lower pitches as well.
Thanks for any ideas or info.
__________________
My best friends are parrots
Reply With Quote
  #2   (View Single Post)  
Old 1st November 2017
Head_on_a_Stick's Avatar
Head_on_a_Stick Head_on_a_Stick is offline
Real Name: Matthew
Mostly Harmless
 
Join Date: Dec 2015
Location: London
Posts: 75
Default

This works for me (OpenBSD-current/ThinkPad X201):
Code:
doas tee /dev/speaker <<!
A
!
Replace A with whichever note is desired

Alternatively, a root shell could be used instead of the here document, for example:
Code:
doas ksh -c 'echo A > /dev/speaker'
This also works but only generates a single note:
Code:
echo -ne '\007'
__________________
Linux is for people who hate Windows. BSD is for people who love UNIX.
Reply With Quote
  #3   (View Single Post)  
Old 1st November 2017
IdOp's Avatar
IdOp IdOp is offline
Too dumb for a smartphone
 
Join Date: May 2008
Location: twisting on the daemon's fork(2)
Posts: 763
Default

A little more generic would be

% echo -ne \\a

You can change the console beep frequency with wsconsctl(8), (maybe duration too).

Under X you can change the bell pitch and duration with xset(1) and its 'b' parameter.
Reply With Quote
  #4   (View Single Post)  
Old 1st November 2017
GarryR's Avatar
GarryR GarryR is offline
Real Name: Garry Ricketson
Package Pilot
 
Join Date: Jul 2015
Location: Durango, Mx.
Posts: 202
Default

Thanks H_O_A_S,
For some reason it does not work for me, it works in that no errors are given, but no sound
is made. I do have audio, I can play music using mplayer.
But no tone generated with the command.
__________________
My best friends are parrots
Reply With Quote
  #5   (View Single Post)  
Old 1st November 2017
Head_on_a_Stick's Avatar
Head_on_a_Stick Head_on_a_Stick is offline
Real Name: Matthew
Mostly Harmless
 
Join Date: Dec 2015
Location: London
Posts: 75
Default

Does your motherboard have a speaker and is it enabled in your firmware ("BIOS") options?

Have you ever made it "beep" under other operating systems?
__________________
Linux is for people who hate Windows. BSD is for people who love UNIX.

Last edited by Head_on_a_Stick; 1st November 2017 at 10:00 PM. Reason: removed silly question.
Reply With Quote
  #6   (View Single Post)  
Old 1st November 2017
GarryR's Avatar
GarryR GarryR is offline
Real Name: Garry Ricketson
Package Pilot
 
Join Date: Jul 2015
Location: Durango, Mx.
Posts: 202
Default

No, actually I never tried before on other OS's, I am not sure on the bios, never have looked.
I did try on another PC, but the same, but I am not sure about the speaker and bios on that
one either. One of my laptops, has openbsd on it, and I know it can "beep", because on
that one it beeps when it gets shut-down.
I had to take the wife some where, and now it is feeding time for my babies (parrots).
But a little later I am going to see on the laptop.

I am thinking the same thing though, these 2 desktop PC's might not have any internal speaker, however the external speaker does work, just not for this.

I should have mentioned, on the music, it is a external speaker.
__________________
My best friends are parrots
Reply With Quote
  #7   (View Single Post)  
Old 2nd November 2017
GarryR's Avatar
GarryR GarryR is offline
Real Name: Garry Ricketson
Package Pilot
 
Join Date: Jul 2015
Location: Durango, Mx.
Posts: 202
Default

It did not work on the laptop either

And I am tired, maybe tomorrow
================ edited ===========
I just tried again, on the Desktop PC, first I booted with freedos, and it does "beep",
but not very loud. So any way I tried again,..and it does work, I could hear it
with "C" instead of "A", the C , and D, I can hear, but just barely. So I got my wife to
listen, she says she can hear all the tones, my hearing is not good at all, and some
tones, I just do not hear some tones, like the A, G,E and B, and F. But it does work.
Thanks,
The next step, would be how to get it to go to a external speaker, it has more volume,
is that possible ?
Thanks again.

Last edited by GarryR; 2nd November 2017 at 04:13 AM.
Reply With Quote
  #8   (View Single Post)  
Old 2nd November 2017
Head_on_a_Stick's Avatar
Head_on_a_Stick Head_on_a_Stick is offline
Real Name: Matthew
Mostly Harmless
 
Join Date: Dec 2015
Location: London
Posts: 75
Default

^ Ah yes, using an A was a rather silly choice on my part, I should have picked a lower note :/
Quote:
Originally Posted by GarryR View Post
how to get it to go to a external speaker, it has more volume,
is that possible ?
Well, if you want to use the external speaker then it's probably easier to just generate a .wav (or other sound file format) with audio/audacity for use with your favorite music playing software.
__________________
Linux is for people who hate Windows. BSD is for people who love UNIX.

Last edited by Head_on_a_Stick; 2nd November 2017 at 06:54 AM. Reason: corrected oport name
Reply With Quote
  #9   (View Single Post)  
Old 2nd November 2017
GarryR's Avatar
GarryR GarryR is offline
Real Name: Garry Ricketson
Package Pilot
 
Join Date: Jul 2015
Location: Durango, Mx.
Posts: 202
Default

Thanks , I tried Audacity and it is pretty nice, but it isn't quite what I was looking for,
however in the manual it said:
Quote:
If you need to batch-process audio or do
simple edits from the command line, using sox or ecasound driven by a
bash script will be much more powerful than audacity.
So I installed "sox",... and yes, that does what I want to do,..it even has a "play"
command.
For example :
Code:
play -n synth 1 sine A5
plays the A note/tone, at a pitch I can hear
on the external speaker.
Thanks for sharing
__________________
My best friends are parrots
Reply With Quote
Old 3rd November 2017
GarryR's Avatar
GarryR GarryR is offline
Real Name: Garry Ricketson
Package Pilot
 
Join Date: Jul 2015
Location: Durango, Mx.
Posts: 202
Default

This "sox" package/program is perfect for what I wanted to do.

I made a script, named it beep and now I have the "beep" command, and it beeps on the external speaker:
Code:
play -n synth .3 sine E5
--------------------------------

============================
Code:
$ beep

 File Size: 0         
  Encoding: n/a           
  Channels: 1 @ 32-bit   
Samplerate: 48000Hz      
Replaygain: off         
  Duration: unknown      

In:0.00% 00:00:00.34 [00:00:00.00] Out:14.4k [!=====|=====!] Hd:0.0 Clip:0    
Done.
That was not my main goal, but it also works great for a perl script I made to help my
granddaughter practice her multiplication tables, before it was silent, now with "sox" and the
play command I was able to add short "beep" tunes, and sounds, and the script call them,
plays the sound/tune , depending on if the answer is correct or not. Works great.
__________________
My best friends are parrots
Reply With Quote
Reply

Thread Tools
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Difference between"arp info overwritten" and " duplicate IP address " varag OpenBSD Security 1 6th April 2015 02:57 PM
How to replace "ectags" with "ctags"? fender0107401 OpenBSD Packages and Ports 5 16th April 2013 10:01 AM
Where should I put my config? "rc.conf" or "rc.conf.local"? fender0107401 OpenBSD General 2 2nd April 2012 02:53 AM
Fixed "xinit" after _7 _8, "how" here in case anyones' "X" breaks... using "nvidia" jb_daefo Guides 0 5th October 2009 09:31 PM
"Thanks" and "Edit Tags". diw Feedback and Suggestions 2 29th March 2009 12:06 AM


All times are GMT. The time now is 11:06 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick