ponty / arduino-rtttl-player Goto Github PK
View Code? Open in Web Editor NEWArduino library to play RTTTL melodies
Arduino library to play RTTTL melodies
The example testing the use of songs stored in Ram (Ram.pde) reveals a bug (which is implicit also in the other examples). In my environment at least, the Ram version of the examples doesn't play correctly, and never could.
That's because the notes array is declared as...
const prog_uint16_t notes[] PROGMEM
...and the read_word function is mistakenly invoked with a boolean which actually records whether the const char *p for the song should be interpreted as progmem or not, not the notes array.
This bug in the logic therefore confuses the reading of the notes[] array if the song is NOT stored in progmem.
The result is that if that the line in the _play(...) function which reads...
_tone(read_word(¬es[(scale - 4) * 12 + note], pgm));
...breaks when pgm is false, or in other words, mistakenly tries to access the PROGMEM notes array as if it was in ordinary RAM, just because pgm is false (the song itself happens to be stored in RAM). This creates junk notes on playback. Changing this line in rtttl.h so it reads...
_tone(read_word(¬es[(scale - 4) * 12 + note], true));
...should fix the problem for all playback types.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.