I want to generate a beep sound with a specific frequency and length (for different sound signals) using the system beeper (and only the speakers if beeper is not available
open("/dev/tty", O_RDONLY); instead /dev/console will work with sound OK
for terminal consoles without requiring superuser privileges.
But virtual consoles in X session will fail with sound then, even for superuser.