beep icon indicating copy to clipboard operation
beep copied to clipboard

Support default audio device

Open federico-razzoli opened this issue 4 years ago • 1 comments
trafficstars

Since hardware vendors decided for us that we don't like the system bell, it would be great to have a way to beep via the default audio device.

If you want to keep beet simple for systems with a real bell, maybe you would consider having a separate binary that uses the system bell. If for some reason some options won't work with the default audio, it will still be fine for me.

federico-razzoli avatar Sep 29 '21 11:09 federico-razzoli

A few remarks:

  • beep is explicitly the user interface to the PC speaker, so audio devices are outside its focus.

  • This implementation of beep has not experienced maintenance for a few years (last commit was in February 2013), which is why I have forked it over at https://github.com/spkr-beep/beep where I do maintain it. https://github.com/spkr-beep/beep/blob/master/PACKAGING.md contains a link to the repology.org beep page and the overview graphic showing which Linux distributions have picked up the spkr-beep beep (look for beep versions 1.4 and newer).

  • Modern user interfaces like e.g. Gnome and Gnome Terminal often can generate beeps (through the audio system) for e.g. pressing backspace in a terminal window at the beginning of the line where there is no going "back", but choose to be silent by default.

  • Laptops and other integrated machines often route the PC speaker output through some audio mixer to the builtin audio speakers, but the mixer might default to zero volume (see https://github.com/spkr-beep/beep/issues/13).

  • If you just need a way to output square waves through the PCM audio devices, the play command from SoX can do just that:

    play -n synth 0.3 square 440
    # for a 0.3 second square wave at 440Hz.
    

For single beeps, writing a shell script wrapper for play which maps a beep like command line is easy, and I would not be opposed to carry that in https://github.com/spkr-beep/beep/tree/master/contrib (which, remember, is in my maintained fork of this project). However, for playing complete melodies which consist of a series of notes linked with -n on the beep command line, timing will start to become an issue if you start a new call of play for every note.

ndim avatar Sep 30 '21 12:09 ndim