Giter VIP home page Giter VIP logo

nonblockingrtttl's People

Contributors

edorgeville avatar elbowz avatar end2endzone avatar jbrown123 avatar per1234 avatar starsoftanalysis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

nonblockingrtttl's Issues

Move library to the root of the repository

GitHub automatically generates .zip files of the repository contents. Moving the library to the root of the repository would allow that file to be used for installation, rather than requiring this complex deployment process. This will allow users to follow the same installation process as they would use for any other Arduino library hosted on GitHub, rather than a non-standard process.

This repository structure is also required if you want to add your library to the Arduino Library Manager index, which provides an even easier installation and update process for the users.

My proposed repository structure is:

NonBlockingRTTL (repository root)
|_library.properties
|_keywords.txt
|_examples
|_src
  |_NonBlockingRtttl.h
  |_NonBlockingRtttl.cpp

That is the Arduino Library Format 1.5. If you prefer the 1.0 format then the source files can be placed in the repository root instead of in the src subfolder.

Add support for RTX ringtones

RTX ringtones are superset of RTTTL. It adds style and loops option. I've implemented it to my library (before I discovered there are much more Arduino RTTTL libs on the internet).

Contradiction in the RTTTL specification

I've been struggling to get a tune to sound right, and eventually realised that NonBlockingRTTTL doesn't parse RTTTL in the way I expected.

The problem occurs with dotted notes that are not in the default octave, which I thought should be written as a4. but this library expects a.4

The confusion seems to arise because the 'language' is poorly specified. I don't know if there's a canonical definition anywhere, but I found a Backus-Naur specification which includes:

<note> := [<duration>] <note> [<scale>] [<special-duration>] <delimiter>

That puts the dot (the 'special-duration') at the end. But the same document includes g.6 in its example, cleverly contradicting itself.

Wikipedia says 'Dotted rhythm patterns can be formed by appending a period (".") character to the end of a duration/beat/octave element.'

I suggest that NonBlockingRTTTL should allow for either dot position -- simply by repeating the short bit of code that consumes the dot and extends the note's duration after the section that deals with the octave. That would avoid breaking anyone's existing tunes, and make it easier for people to get new tunes to work.

Cheers,

Chris

Bug for ESP8266 environment - noTone not called at end of sound

There is a bug at the end of playing a sound with respect to the ESP8266 environment. I don't know if this also is an issue on other processors.

The issue is that the library does not explicitly call noTone() at the end of playback. This leaves the sound pin active and in the case of the 8266 it creates 'noise' on the pin as the CPU executes other code. It is particularly noticeable during uploads of code over serial.

The fix is as follows. In file NonBlockingRtttl.cpp do the following:

  1. Replace line 270 in the play() routine with a call to stop()
  //ready to play the next note
  if (*buffer == '\0')
  {
    //no more notes. Reached the end of the last note

    #ifdef RTTTL_NONBLOCKING_DEBUG
    Serial.println("end of note...");
    #endif
    
270:->   stop();  // playing = false;    // replace this line with a call to stop();
    return; //end of the song
  }
  1. Add a call to noTone() in the stop() routine on line 295 where you are currently setting playing to false.
void stop()
{
  if (playing)
  {
    //increase song buffer until the end
    while (*buffer != '\0')
    {
      buffer++;
    }

295:-> noTone(pin);  // add a call to noTone() here
    playing = false;
  }
}

These two changes actually fix 2 bugs. First, it fixes a bug where the sound isn't disabled at the end of normal playback. Second, it fixes a bug where sound isn't disabled if you abort playback using the stop() command.

If desired, I can submit this as a pull request. Otherwise, just make these two one line changes and call it good.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.