Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 2 of 2

Thread: Beginner Question about Envelope / Timing

  1. #1
    Junior Member
    Join Date
    Jun 2019
    Posts
    10

    Beginner Question about Envelope / Timing

    Hi All,

    Audio Library newbie here.
    I'm curious as to how people handle scheduling "noteOn" and "noteOff" messages for envelopes in the audio library.
    For example, if I want to do something like:

    Code:
    envelope1.noteOn();
    delay(1000);
    envelope1.noteOff();
    delay(1000);
    Obviously, delay is not a smart choice here as is is blocking (i.e., if I wanted to read a sensor during this time).
    I've looked around the listed examples and helpfiles, and didn't find a definitive answer.

    Are people out there using millis() this kind of timing in relation to the audio library? Or is there some other functionality built into the library that I am missing?

    Thank in advance for any tips / a point in the right direction.

    DS

  2. #2
    Hi,

    use elapsedMillis.

    explanations here: https://www.pjrc.com/teensy/td_timin...pedMillis.html

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •