GitXplorerGitXplorer
j

TunePlayer

public
1 stars
0 forks
0 issues

Commits

List of commits on branch main.
Verified
e3fe3be3e4f9f0b958d0aea4420cdf8169b3cf79

Merge pull request #5 from jgOhYeah/development

jjgOhYeah committed 2 years ago
Unverified
4b93d2bb1b220ddc974bd02d6517cf0d99d678bb

Added md documentation for midi processor

committed 2 years ago
Unverified
217ada1c6b12cbaeb127572aed9ddcfff6d20656

Added command line options to change midi processing settings

committed 2 years ago
Unverified
06ddb1a69b3a9f0b667c983c3696c71461014323

Manually implemented padStart as musescore does not always seem to cope with the String.padStart method used

committed 2 years ago
Unverified
31f9f9a635afed92e171f08fc7036515de25aed1

Added verification, multiple selectors and cleaned up (old commit)

committed 2 years ago
Unverified
284e7d1c5f13b785870f7d8fb8998c80bd04b60c

MIDI processor mostly works

committed 2 years ago

README

The README file for this repository.

TunePlayer Arduino Lint Actions Status

An Arduino library to decode and play simple tunes.

Each note is stored as a 16 bit integer and the method of loading tunes and how each note is played is reconfigurable. The current anticipated method of tune playing revolves around a pwm square wave on a piezo siren or speaker.

Quick links

This library is inspired (but not compatible with) the PICAXE tune command

This cppQueue library is required to be installed.

Getting started

See the simple example for this in one file.

Installation

Search for TunePlayer in the Arduino library manager or download this repository and copy it to the libraries folder (for me, ~/Documents/Arduino/libraries/). If not installed already, the cppQueue library should be installed as well.

Hardware

The simplest way is to connect a piezo buzzer / siren (e.g. smoke alarm) to the output pin (pin 9 in the examples). For makimum loudness, you will probably need a driver circuit and tune things to resonate.

Include the library

#include <TunePlayer.h>

Add the tune

See the Musescore Plugin page for a fairly straightforward way to generate the tunes.

// Converted from 'FucikEntryoftheGladiatorsPNO' by TunePlayer Musescore plugin V1.6
const uint16_t FucikEntryoftheGladiatorsPNO[] PROGMEM = {
    0xe118, // Tempo change to 280.0002 BPM
    0x3a38,0x2a38,0x1a18,0x2a18,0x1a18,0xa18,0xb838,
    // ...
    0xf000 // End of tune. Stop playing.
};

Create the required objects

FlashTuneLoader flashLoader; // Where the notes come from
#define PIEZO_PIN 9
ToneSound piezo(PIEZO_PIN); // What plays the notes
TunePlayer tune; // Coordinates everything and does things at the right times.

Set up to play

flashLoader.setTune(FucikEntryoftheGladiatorsPNO);
tune.begin(&flashLoader, &piezo);

Play

tune.play();

Regularly update

This needs to be called as often as possible while the tune is playing.

tune.update();

Other functionality

See the API reference.