An open API service indexing awesome lists of open source software.

https://github.com/ninjascl/rpitune

🎹 Rasperry Pi Buzzer Tunes with RTTTL
https://github.com/ninjascl/rpitune

Last synced: 2 months ago
JSON representation

🎹 Rasperry Pi Buzzer Tunes with RTTTL

Awesome Lists containing this project

README

          

# Raspberry Pi Music Tunes with RTTTL

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.

## Hardware

- 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.

## Software

- http://wiringpi.com/
- https://dietpi.com/ (Debian 11)

## Deps

First must install the dev packages:

```sh
$ sudo apt -y install gcc g++ make automake git
```

Then install _WiringPi_ dev files:

```sh
$ git clone https://github.com/WiringPi/WiringPi.git
$ cd WiringPi
$ ./build
```

Make sure to add your user to the `gpio` group.

```sh
$ sudo usermod -aG gpio
```

## Schematics

You can connect the buzzer to the GPIO 4 (positive) and the other to the ground. Or change it in _pin.h_.

image:https://user-images.githubusercontent.com/292738/186971780-e5cdf7a5-927c-4838-ba56-de2199d0b36a.png[https://www.circuitbasics.com/how-to-use-buzzers-with-raspberry-pi/]

## Song

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.

## Compilation

Once you configured your _PIN_ and _SONG_ you can compile with:

```sh
$ 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.

## Play

Now you can play using the command `./tune`.

Example:

```sh
$ cat docs/songs/mix1/adams.txt | xargs ./tune
```

## Similar Projects

If you want more complex tunes you can use https://en.wikipedia.org/wiki/Music_Macro_Language[MML] instead of https://en.wikipedia.org/wiki/Ring_Tone_Text_Transfer_Language[RTTTL].

See: https://cubeatsystems.com/tinymml/faq.html

### Other Links

- https://www.bristolwatch.com/debian/beep.htm
- https://computers.tutsplus.com/articles/creating-a-speaker-for-your-raspberry-pi-using-a-piezo-element--mac-59336
- https://projects-raspberry.com/piezo-ring-tones-with-raspberry-pi/
- https://docs.circuitpython.org/projects/rtttl/en/latest/
- https://github.com/james1236/buzzer_music
- https://github.com/joan2937/pigpio/
- http://www.airspayce.com/mikem/bcm2835/

## Composers

- https://adamonsoon.github.io/rtttl-play/
- https://github.com/zserge/nokia-composer/
- https://eddmann.com/nokia-composer-web/

## LICENSE

BSD 2-Clause License

## Credits

++++
Made with ♥ by Ninjas.cl.
++++