This is a simple project for sending Nokia’s RTTTL (RingTone Text Transfer Language) to a buzzer in a Raspberry Pi.
This code will compile a single binary that will send the frequencies to the buzzer.
-
Raspberry Pi Model B
-
Passive Buzzer 5v. (Computer Speaker)
-
Cables.
It’s important that your buzzer is a passive one, if it beeps when you feed it with 3.3V then it is not a passive one and this project will not work properly.
-
https://dietpi.com/ (Debian 11)
First must install the dev packages:
$ sudo apt -y install gcc g++ make automake git
Then install WiringPi dev files:
$ git clone https://github.com/WiringPi/WiringPi.git
$ cd WiringPi
$ ./build
Make sure to add your user to the gpio
group.
$ sudo usermod -aG gpio <username>
You can select a song in song.h. There is a bunch of sample songs
too inside docs/songs
. (Got from https://picaxe.com/rtttl-ringtones-for-tune-command/). This song will play if you
do not give any arguments to the program.
Once you configured your PIN and SONG you can compile with:
$ make build
It will generate a new binary named tune
.
This binary can be executed and will play the SONG.
Maybe can be used on login? or startup sound?.
A binary is included in this repo if you want to avoid compilation.
Now you can play using the command ./tune
.
Example:
$ cat docs/songs/mix1/adams.txt | xargs ./tune