@chiddekel commented on Tue Dec 05 2017
Run on OS: Fedora 27
Kernel Linux: 4.13.16-302.fc27.x86_64
Step zero: yum install beep
First, runsudo modprobe pcspkr and then beep should work.
Additional uncomment the /etc/modprobe.d/beep.conf line at:
# alias platform:pcspkr pcspkr
to
alias platform:pcspkr pcspkr
For automatic load pcspkr module
Run application beep e.g - /usr/bin/beep -f 2000 -l 1000
The beep in this case equal to n = 2000 Hz and duration 1000 ms
This is tiny, small C source includes, of beep application.
https://goo.gl/E3kfPy
The portion of this code can be re-write to C# and use in Console.beep implementation for Linux platform.
For clarification, Console.Beep() works fine on Unix. It's Console.Beep(int, int) that throws PlatformNotSupportedException, due to lack of a good cross-platform mechanism for implementing it and it's relative value.
The implementation of platform Linux, Darwin, NT is simple if else statement or case switch.
The code run after e.g If (platform == Linux) { } and the detect it is restricted only by this way:
The sounds are caused by the BIOS (Basic Input/Output System) by the OS (Operating System), by the DE (Desktop Environment).
You're welcome to submit a PR to be evaluated. I do not believe this is something folks at Microsoft will invest in any time soon.
In short - it's not hard to implement.
All pice is in place.
Linux Developer or distro maintainer of eg, Fedora, Debian etc, etc
Must check two-step:
pcspkr un-blacklist PC Speaker, PC Beep, or Beep unmute for example by alsa. Console.Beep(int,int) on UNIX is indeed stubbed out.
Source code for /usr/bin/beep is at http://security.debian.org/debian-security/pool/updates/main/b/beep/beep_1.3.orig.tar.gz.
Question for corefx folks:
Is shelling out to
/usr/bin/beepacceptable or would you prefer that ๐ is re-implemented.
< Deleted screenshot of GPL licensed code >
@stephentoub thoughts? I'd prefer to port the code, as long as it's the same for all distro, since shelling out is not free (is another dependency, and is clumsy)
I'd prefer to port the code, as long as it's the same for all distro, since shelling out is not free (is another dependency, and is clumsy)
I agree. However:
a) What's the license on that code? Porting something GPL for example would not be acceptable.
b) How much code is it? The snippet shown above is calling methods (e.g. do_beep) where the src isn't shown.
It seems like an implementation should be possible, at least on Linux, with relatively little code, but if the cited source is GPL or a similar license, someone who's not looked at the code will need to provide the implementation.
Hi,
has anybody start the work on this?
@paule96 I don't think so, you are welcome to offer a PR but note the comment above that it must be a clean implementation without consulting code under GPL or similar license.
I will try my best maybe :) But I don't have any know how about programming nativ stuff on Linux ๐ have anybody a good starting tutorial for this stuff? ๐
On unix you open the console /dev/tty0, /dev/vc/0, /dev/console and write to it. However, as far as I know this requires root permissions. So writing directly to it will be a problem.
beep usually has its user id set to root.
But root for sound "sounds" wrong. ๐คทโโ๏ธ
I have googled and found a sound function in C. (https://www.programmingsimplified.com/c/dos.h/sound) But I don't have any know how about C. So I don't know if this is the right way....
The function you have found is using dos.h, that doesn't seem like right place to look.
Link was unavailable - here is re paste Debian git repo. http://git.deb.at/w/pkg/beep.git
here is re paste Debian git repo
That code is GPL.
Yes code is GPL - re writed code based on beep Debian source code ๐- should be include the rule of interoperable in copyright law, adding part code of framework or library under GPL licence.
should be include the rule of interoperable in copyright law adding portion of code under GPL licence.
Sorry, I'm not quite understanding, but we _cannot_ base code in this repo on anything that is GPL.
You can, new portion of code will be under GPL licence, and licence can be add to this specific portion of code, so will be include only to beep re-implementation.
No, that is not how this repo / product operates.
@richlander or @leecow can comment further.
Just sharing what I know about this beeping/linux terminal stuff, in case you find it useful:
Just saw this issue. I don't think I saw it originally. I am closing this given how old this issue is, and the fact that the primary code being considered is GPL.
Anyone should feel to open a new issue if they have a new proposal for tackling this topic.
Most helpful comment
No, that is not how this repo / product operates.
@richlander or @leecow can comment further.