Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

BEL

290 views
Skip to first unread message

Dieter Britz

unread,
Sep 28, 2021, 9:39:35 AM9/28/21
to
The ASCII character CHAR(7) is the bell, i.e. a beep sound.
When I print it, there is no sound. How come, and how do I
get that sound from a Fortran program?

--
Dieter Britz

gah4

unread,
Sep 28, 2021, 12:09:05 PM9/28/21
to
You could buy one of these:

https://en.wikipedia.org/wiki/Teletype_Model_33

which has an actual metal bell that rings when you send it achar(7).

Many electronic ASCII (or non-ASCII) terminals generate a beep sound,
emulating a bell. But more recently, most of us use terminal emulators,
most of which have the ability to beep, if the system has a way to beep.

I am writing this on an OS X system, which has Terminal.app, which
does beep when sent ASCII X'07'.

You might check to see if your audio is muted, or the level turned down low.

Arjen Markus

unread,
Sep 29, 2021, 10:36:42 AM9/29/21
to
On Tuesday, September 28, 2021 at 6:09:05 PM UTC+2, gah4 wrote:

>
> You might check to see if your audio is muted, or the level turned down low.

I tried this on a Windows machine in the standard command window (and the loudspeaker on - which I normally don't have). A program writing a single BEL character (achar(7)) to standard output does produce a bell sound. I tried with both gfortran and Intel Fortran oneAPI and the result was the same.

Regards,

Arjen

gah4

unread,
Sep 29, 2021, 11:26:10 PM9/29/21
to
On Tuesday, September 28, 2021 at 6:39:35 AM UTC-7, Dieter Britz wrote:
At one point in "The Andromeda Strain" movie (I didn't check the book),
there is a terminal with a bell that is supposed to ring. It turns out not to
ring, as it got a piece of paper stuck in it. (Yes a real mechanical bell.)

In the end that not hearing the bell turns out to be the right thing,
but they didn't know that at the time.

Dieter Britz

unread,
Sep 30, 2021, 3:59:03 AM9/30/21
to
Thanks. It doesn't work on my laptop. I tried ACHAR(7) and put on head
phones, but no beep, The alptop can make them, and I often get noises
to indicate errors of various sorts, but it seems, not from a Fortran
program with print. I'll have to live without it.

I want this for a program that warns me of imminent birthdays and
appointments when I turn on the console, to remind me to read what it
outputs on the screen.

--
Dieter Britz

Phillip Helbig (undress to reply)

unread,
Sep 30, 2021, 5:03:33 AM9/30/21
to
In article <sj3qo3$e9e$1...@dont-email.me>, Dieter Britz
This is not a Fortran issue:

$ creat bell.f90
print*, achar(7)
end
Exit
$ fortran bell
$ link bell
$ r bell

Works as designed.

I normally ring the bell with an OS-level script:

$ bell[0,32]= %x07
$ write sys$output bell
$exit

LC's No-Spam Newsreading account

unread,
Oct 21, 2021, 7:18:39 AM10/21/21
to
This is not a Fortran question, the actual generation of the sound
depends on your hardware and operating system.

On most Unix/Linux X11 terminal windows even the plain typing of a
control-G (equivalent to the program you mentioned) used to sound the
bell. However on "modern" PCs this is usually disabled.

One can however assign a system sound to the X11 bell, picking it up
from files stored under /usr/share/sounds and including something like
this in your .login (this works on my office OC with Suse)

pactl upload-sample /usr/share/sounds/... x11-bell
pactl load-module module-x11-bell sample=x11-bell

Have a quick network search on those commands. Variations are possible.
For instance on my new home PC with Ubuntu I had to add to the second
command

display=$DISPLAY

gah4

unread,
Oct 21, 2021, 3:54:31 PM10/21/21
to
On Thursday, October 21, 2021 at 4:18:39 AM UTC-7, LC's No-Spam Newsreading account wrote:
> On Tue, 28 Sep 2021, Dieter Britz wrote:
>
> > The ASCII character CHAR(7) is the bell, i.e. a beep sound.
> > When I print it, there is no sound. How come, and how do I
> > get that sound from a Fortran program?

> This is not a Fortran question, the actual generation of the sound
> depends on your hardware and operating system.

There might be some I/O libraries that block some control characters.
I believe that is rare now, but maybe not always.

When microprocessor controlled terminals were first introduced, they
often had many interesting features activated by control characters.
There were many fun tricks you could play one someone, and many
people did use those tricks.

But yes, the usual Fortran systems now pass control characters,
and it is up to the users (real or emulated) terminal to process them.


Gary Scott

unread,
Oct 22, 2021, 11:43:08 AM10/22/21
to
There isn't actually a terminal in most cases now, just a terminal
emulator that has in some cases been dumbed down over time.

gah4

unread,
Oct 22, 2021, 2:58:31 PM10/22/21
to
On Friday, October 22, 2021 at 8:43:08 AM UTC-7, Gary Scott wrote:

(snip, I wrote)
> > But yes, the usual Fortran systems now pass control characters,
> > and it is up to the users (real or emulated) terminal to process them.

> There isn't actually a terminal in most cases now, just a terminal
> emulator that has in some cases been dumbed down over time.

Yes, that is why I said real or emulated. Note in this picture:

https://upload.wikimedia.org/wikipedia/commons/1/1a/ASR-33_backside.jpg

of the Teletype model 33 from:

By Seth Morabito - Flickr: The Backside, CC BY-SA 2.0, https://commons.wikimedia.org/w/index.php?curid=19317785

you can see the actual metal bell, just below the slot where paper goes into the platen.

Also, some terminal emulators flash the screen when the BEL character is received.

LC's No-Spam Newsreading account

unread,
Oct 26, 2021, 5:16:14 PM10/26/21
to
On Fri, 22 Oct 2021, Gary Scott wrote:

>>> This is not a Fortran question, the actual generation of the sound
>>> depends on your hardware and operating system.

>> But yes, the usual Fortran systems now pass control characters,
>> and it is up to the users (real or emulated) terminal to process them.

> There isn't actually a terminal in most cases now, just a terminal
> emulator that has in some cases been dumbed down over time.

At least for Linux/X11 systems, at least the oldest terminal emulators
(xterm, urxvt) have not been dumbed down (I don'y use the newest ones).

It is the combination of X11 and hardware that often do not support
silly old audio bells (because they have multimedia support !!!) ... but
if one wishes it can be re-instated with some pactl commands, as said.
0 new messages