I want to use console API of beep to produce a tone because it has lower latency than the evdev API but doing so is not permitted in a graphical shell.
Ctrl+Alt+F6 opens tty6 and after logging in I can run
beep -e /dev/tty6
In the graphical shell, tty7, you can't write to /dev/tty7 or any of the other tty files and running beep as root is prohibited.
https://github.com/spkr-beep/beep/issues/6#issuecomment-1264648890
The maintainer said here it's not a good idea for security reasons but I don't intend to use it that way for long.