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

Thread: help reseting the phase of sine

  1. #1
    Junior Member
    Join Date
    Jan 2020

    help reseting the phase of sine

    hi there, posting for the first time so nice to meet you all!
    i have a question regarding reseting the phase of the sine object from the audio lib, im pretty much new to the teensy so i ask for your kind forgiveness if i ask obvious / stupied stuff ,
    im attempting to set the phase of sine to 0 upon midi note receive,

    whereas (sphase) is basically 0 which is sent to the object everytime midi note 60 is received

    this resides in a loop and the outcome is a saw wave because i assume that im doing something wrong and the phase resets everytime the loop is executed

    how could i "tell" the phase to reset to 0 momentarily when the midi note is received and proceed from there?

    thank you very much!

  2. #2
    Hello, if you want to reset to the start (0 degrees phase) you'll probably need to modify the AudioSynthWaveformSine object (synth_sine.h and synth_sine.cpp) because I believe, setting phase(0) doesn't work like this. Have a look at the sync() function I wrote in a modified version of AudioSynthWaveformMod, it resets the phase_accumulator when the sync function is called, I use it to retrigger LFOs when they receive note on messages:

  3. #3
    Junior Member
    Join Date
    Jan 2020
    @UHF for some reason i cant see my other reply so thank you very much! just to make sure, i call it using "waveform1.sync();" when ever i want and it should restart the phase?

    thanks again!

  4. #4
    Yes that's correct.

  5. #5
    Junior Member
    Join Date
    May 2019
    London UK
    I had trouble with this also but lucky a helpful user pointed me to this thread.
    So it appears phase() doesn't work?

Posting Permissions

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