In the case of (1), WriteLn() etc. with a standard #$07 will work: if it doesn't, it's a distro problem.
MarkMLl
// Also see https://github.com/tinyalsa/tinyalsa and thread based at
// https://forum.lazarus.freepascal.org/index.php/topic,49502.msg358923.html#msg358923
// which could potentially be a guide to a pure-Pascal ALSA interface which
// communicated with the kernel without needing C-based libraries.
//
// Also http://bulba.untergrund.net/Ay_Emul29b26.src.7z which is a sound-chip
// emulator apparently written in Lazarus.
In the case of (2), there is no straightforward solution without importing a lot of extra libraries.
MarkMLl
Also wrong. Just do:
cat /Windows/C/wav/jingles/pop.wav | aplay
No extra libs needed. Wrap it into fpc.
This will only work if the system indeed contains the ALSA userspace utilities.
Alsa is part of the Linux Kernel since Version 2.6.
It is the default Linux sound system since now over 15 Years.
The userspace utilities are installed by default by a lot of system.
If not they are part of the distro.
No Linux distro without Alsa today.
Debian doesn't.
MarkMLl
Why does the sysutils come with a beep?
Even if this does not work?
Another nonsense.
...
Waiting for the next lie.
Just intalled Debian 10.6 in a virtual box.
The very small and basic CD Version with xcfe.
And if you don't like the word "lies" then do it like the White House:
call it "alternative facts"
:sound-name name
A themable named sound from the freedesktop.org sound naming specification from ‘$XDG_DATA_DIRS/sounds’, to play when the notification pops up. Similar to the icon name, only for sounds. An example would be ‘"message-new-instant"’.
Now try it without xfce.
I think it would be highly desirable to not use the full alsapas libraries to access this,
How about https://wiki.archlinux.org/index.php/Desktop_notifications ? I think it would rely on the user setting up the desktop environment to beep on receipt of a particular notification though, which would be beyond many.
MarkMLl
I suppose even Wini's suggestion of aplay could be used
Having said which, the "right way" is probably to use libnotify so that it works properly with the desktop's configuration stuff, and the associated daemon/backend seems to be widely adopted.
I think a lot depends on whether the community prefers to have Beep() be /strictly/ a PC-style beep, or prefer it to be the early-C21st equivalent configurable by thematicisation etc.
If Beep() took parameters specifying frequency and duration I'd definitely lean towards the former. It doesn't, so generally speaking I lean towards the latter.