otone is a small OpenWrt/Linux command line tool for playing beeps, alerts, chirps, and simple melodies through a router buzzer connected to GPIO sysfs.
It is useful for OpenWrt router diagnostics, audible boot/status alerts, GPIO buzzer testing, embedded Linux experiments, and tiny shell-script notifications.
- Written in C with minimal dependencies
- Works through
/sys/class/gpio/.../value - Auto-detects common buzzer GPIO paths
- Saves the detected buzzer path to
/etc/otone.conf - Supports fixed frequency beeps, silence, PWM volume, and chirp frequency sweeps
- Optional verbose diagnostics and simple timing statistics
- Includes a Mario melody script example in
sounds/mario.sh
SSH into the router and run:
opkg update
opkg install git git-http gcc make libc-dev
cd /tmp
git clone https://github.com/BlackF1re/otone.git
cd otone
make
install -D -m 0755 ./otone /usr/bin/otone
otone 2000 300If the repository is still available through the old GitHub redirect, this also works:
opkg update
opkg install git git-http gcc make libc-dev
cd /tmp
git clone https://github.com/BlackF1re/tone.git otone
cd otone
make
install -D -m 0755 ./otone /usr/bin/otone
otone 2000 300git clone https://github.com/BlackF1re/otone.git
cd otone
make
scp ./otone root@192.168.1.1:/usr/bin/otone
ssh root@192.168.1.1 'chmod +x /usr/bin/otone && otone 2000 300'gcc -O2 -Wall -Wextra -std=c99 -o otone otone.c -lmBuild with a fixed GPIO path to skip detection:
gcc -O2 -Wall -Wextra -std=c99 -DBUZZER_GPIO_PATH='"/sys/class/gpio/gpio10/value"' -o otone otone.c -lmotone <frequency_hz> <duration_ms> [options]Examples:
otone 2000 300
otone 0 1000
otone 2500 300 -p 50
otone 1000 800 -c 4000
otone 2000 300 -d /sys/class/gpio/gpio10/value
otone 2000 300 -vvOptions:
-d, --device PATH GPIO value file for the buzzer
-p, --pwm VALUE PWM volume from 0 to 100
-c, --chirp HZ Sweep from the start frequency to HZ
-v, --verbose Verbose output
-vv Verbose output with statistics
-h, --help Show help
The detected path is saved to:
/etc/otone.conf
Example config:
buzzer_path=/sys/class/gpio/gpio10/value
spin_threshold_us=100
default_volume=100
enabled=1
chmod +x sounds/mario.sh
sounds/mario.sh mario
sounds/mario.sh underworld
sounds/mario.sh bothNo sound:
ls -la /sys/class/gpio
cat /etc/otone.conf 2>/dev/null || true
otone 2000 300 -v
otone 2000 300 -d /sys/class/gpio/gpio10/valuePermission error:
ssh root@192.168.1.1
otone 2000 300Compiler missing:
opkg update
opkg install gcc make libc-devBSD 3-Clause. See LICENSE.