Program that sends tone to your beepers

@Jookia Jookia authored on 21 Jun 2022
.clang-format .clang-format: Create 1 year ago
LICENSE Initial commit 1 year ago
README.md README.md: Create 1 year ago
evtone.c evtone: Use sizeof(event) instead of sizeof(struct input_event) 1 year ago
meson.build meson.build: Set C warnings and standard 1 year ago
README.md

What's this?

evtone is a command-line program that plays tones on any beeper device on Linux, such as your PC speaker or the pwm-beeper module.

Unlike 'beep' or similar tools, evtone only supports outputting SND_TONE events to devices you'll find in /dev/input. No attempt to play tones through the connected terminal is supported.

How do I use it?

Copy and pasted from evtone --help:

Usage: evtone [OPTION...] TONE [TONE...]
TONE is of the format HZ:MILLISECONDS
Up to 256 TONEs may be specified at once.

  -d, --dry-run              Print what the program will do
  -D, --device=FILE          /dev/input device to use to play tones
                             If not supplied the device will be guessed
  -?, --help                 Give this help list
      --usage                Give a short usage message
  -V, --version              Print program version

Mandatory or optional arguments to long options are also mandatory or optional
for any corresponding short options.

Examples:
  "evtone 440:1500" plays a tone of 440Hz for 1500 milliseconds.
  "evtone 440:1500 300:10" plays a 440Hz tone for 1500 milliseconds
    followed by a 300Hz tone for 10 milliseconds
  "evtone -d 440:1500 300:10" will print what the program will do
    instead of actually doing it
  "evtone -D /dev/input/event2 440:1000" will play a 440Hz tone for
    1000 milliseconds using the /dev/input/event2 device

System requirements

You need the following to build and run this software:

  • Linux kernel
  • glibc
  • GCC (for building only)
  • Meson (for building only)

To build and run with Meson use these commands:

$ meson setup build
$ cd build
$ ninja
$ ./evtone

If you really dislike Meson, you can build with just GCC like this:

$ gcc evtone.c -o evtone
$ ./evtone

TODO

There's always new stuff to add to software. Some future ideas for evtone:

  • Support for SND_BELL if drivers that don't support SND_TONE exist
  • Add a bash script to play some tune
  • Find bugs (I'm sure they're there!)

License

evtone is licensed under the MIT license.