THIS SOFTWARE COMES AS-IS. ALTHOUGH THE AUTHOR DOES ITS BEST TO MAKE THIS PROGRAM SAFE TO USE, MISTAKE HAPPENS. USE IT AT YOUR OWN RISK.
THE AUTHOR DOES NOT TAKE ANY RESPONSIBILITY FOR WHAT THIS SOFTWARE DOES TO YOUR PC. BACKUP FREQUENTLY.
Ctronome is a very-very simple programmable metronome for Linux console, with /dev/dsp (OSS) and PulseAudio output support*. BPM ranges from 30 to 250, tacts like 3/4, 7/8 etc. are possible. It plays external WAV files, so one could use custom sound samples.
Aim is to keep it as simple as it can be with the least dependencies.
Note: Other sound systems might provide utilities for OSS compatiblity.
- C compiler (gcc, clang, etc.)
- CMake 3.19 or later
- Git (required at compile time to get the version number from Git repo)
- Linux Kernel with OSS* support
- For PulseAudio support: libpulse-dev package (header files)
*OSS support can be provided with other tools such as PulseAudio OSS emulator
git clone https://github.com/bivanbi/ctronome.git
cd ctronome
cmake --preset default
cmake --build --preset default
sudo cmake --install build
Configure build for the default installation prefix of /usr/local
:
cmake --preset default
To override the installation prefix, either edit CMakePresets.json, or specify it on the command line, for example:
cmake --preset default -DCMAKE_INSTALL_PREFIX=/opt
The reason it needs to be configured before compiling, is because the ctronome binary needs to know where the WAV files will be installed.
cmake --build --preset default
A single binary will be compiled into the build/bin
directory.
Binary will be installed in <installation prefix>/bin
, WAV files will be installed into <installation prefix>/share/ctronome
.
Default installation prefix is /usr/local
. See Confiure CMake project to change the installation prefix.
cmake --install build
Notes:
- Root privileges may be required to install files into the default installation prefix. Use sudo if necessary, e.g.:
sudo cmake --install build
- At the time of writing this document, CMake v3.22 did not support the
--preset
option for theinstall
command. Hence, the default build directorybuild
is specified instead. - Overriding the installation prefix with the
--prefix
option causesctronome
and its WAV files to be installed into a location wherectronome
will not be able to find them. In this case, wav file locations need to be specified when runningctronome
with the-w1
and-w2
options.
Simply remove the following files / directories:
sudo rm -rfv <installation prefix>/bin/ctronome <installation prefix>/share/ctronome
Where <installation prefix>
is the installation prefix used during the installation.
Example removal from default installation prefix of /usr/local
:
sudo rm -rfv /usr/local/bin/ctronome /usr/local/share/ctronome
For BPM, you can specify the base note. E.g. 60/4 means: 60 1/4 notes per minute -> length of 1/4 note is 1 second.
For BPT you can also define the base note. E.g. 4/4 means: 4 1/4 notes per tact -> length of a tact is 4 seconds.
ctronome -b <bpm> -t <bpt> -c <count> -w1 <wav1> -w2 <wav2> -d <dsp_device> -p <program> -h -v
-b <bpm> beat per minute default: 60/4, range: 30-250/1-20
-t <bpt> beat per tact default: 1/4, range: 1-50/1-50
-p <filename> program file
-c <count> play tact/program <count> times then exit
-w1 <filename> wav to use for accented (first) beat of tact
default: /usr/share/ctronome/metronome1.wav
-w2 <filename> wav to use for other beat of tact
default: /usr/share/ctronome/metronome2.wav
-o <driver> audio output driver, drivers: dsp, pulseaudio, default: autodetect
-d <device> dsp device, default /dev/dsp
-h display help screen
-debug display debug messages
Usage Examples:
# 60 BPM, no accents
ctronome
# 90 BPM, accent every second beat
ctronome -b 90 -t 2
# 120 BPM, accent every 4th beat
ctronome -b 120 -t 4
# Using 60 BPM / 4 notes per tact as basis, then re-calculate it to 7 notes per tact, accent ever 7th beat
ctronome -b 60/4 -t 7/7
If the base note for BPM is not specified, it defaults to the base note
of the tact and vica verse. If neither BPM nor BPT base note is set, it defaults to DEFAULT_BASE_NOTE
set
in defaults.h
See prog_example.txt to learn how to program ctronome.
Ctronome requires two 16 bit per sample WAV format, mono or stereo, and preferably at least 44100Hz sample rate. The two WAV file formats must be the same! Please note that if your sound system does not support the exact format provided by the WAV files, it will try its best to play it anyway, but the result will be unpredictable. Debug mode will tell you the details.
Currently supported sound systems are OSS and PulseAudio. OSS support can be provided through compatibility utilities.
Note: PulseAudio is now natively supported if Ctronome is compiled with it.
PulseAudio has an OSS compatibility module that can be installed to provide
OSS support. For example on Ubuntu systems, the package is called pulseaudio-utils
.
sudo apt-get install pulseaudio-utils
padsp ctronome <ctronome options>
A simple shell script can also be created, lets call it ctronome-padsp
:
#!/usr/bin/env sh
padsp ctronome $@
An ALSA utility similar to PulseAudio's wrapper exists called aoss
.
For example on Ubuntu system, the package is called alsa-oss
.
sudo apt-get install alsa-oss
aoss ctronome <ctronome options>
A simple shell script can also be created, lets call it ctronome-aoss
:
#!/usr/bin/env sh
aoss ctronome $@
Please open an Issue at GitHub
-
dsp code is based on gTick by Alex Roberts [email protected], and also the OSS Programmers Guide
-
Patch to eliminate warnings with Gcc4, and included WAV samples digitally remastered to be more pronounced and precise by Martin Tarenskeen.
-
Patch to fix amd64 platform bug by Dmitry Kazarov
-
Help from my friends: Zola & Arpy.