1. IMPORTANT:
    We launched a new online community and this space is now closed. This community will be available as a read-only resources until further notice.
    JOIN US HERE

Syncing sine oscillators

Discussion in 'Building With Reaktor' started by synthlord, Feb 23, 2009.

Thread Status:
Not open for further replies.
  1. synthlord

    synthlord NI Product Owner

    Messages:
    48
    I am trying to add a bunch of sine oscillators together
    and want the phase to stay locked. The pitch for each oscillator
    will conform to harmonic series for doing additive synthesis.
    I have attached my basic core module to show what I am after.
    I can't seem to get them to stay synced together.
    They lock up nicely for a while and then they seem to lose
    sync if interrupted by editing or whatever.

    Any suggestions welcome.
    I have tried detecting the zero crossing and loading zero
    to the other osc but it doesn't work. Is there some way
    to creat a master read/write that can control all others?
     

    Attached Files:

  2. Aleksandr Smirnov

    Aleksandr Smirnov NI Product Owner

    Messages:
    1,539
    Hi!

    I don't really get the point of your question. I mean for me it goes ok no matter what I do (phase of oscillators doesn't change, it reminds the same), but behind synchronization I understand next thing - all 4 oscillators go with sync to each other, shouldn't they have the phase starting with same point (see pic)? Please, attach picture what happens in your case.

    Alex.
     

    Attached Files:

  3. Chet Singer

    Chet Singer NI Product Owner

    Messages:
    822
    Why do you need them to stay synchronized? Phase affects the appearance of the waveform, but usually not the perceived timbre.
     
  4. synthlord

    synthlord NI Product Owner

    Messages:
    48
    I have found that the phase sync does change sometimes but that is when I am building around it with pops and clicks from adding modules etc. I was afraid that switches resetting would cause problems. I don't understand the phase question. The increment size determines the frequency as they are added to the phase accumulators. They will wrap in phase won't they?

    Chet I thought with additive synthesis or Fournier series that phase is very important as the sum of sines in phase is what gives the waveforms their shape and sound. I will have to experiment to see if this is not the case but i think it is.

    I still would like to see a way to sync these sine oscillators.
     
  5. Aleksandr Smirnov

    Aleksandr Smirnov NI Product Owner

    Messages:
    1,539
    Yes, but that's nature of Reaktor - you get pops and clicks while building something "in progress" or changing values of output sound connecting and wiring some input ports of that sound (that is actually in use). But this won't happen in real time, for example when you use Reaktor as VST or standalone and play notes using it (on final result). This only happens in "live mode". I hope this will be fixed in next version.

    Yes, but each your phase is offset, because 2nd output phase is phase multiplied by 2 and so on (see my previous picture).
     
  6. synthlord

    synthlord NI Product Owner

    Messages:
    48
    Yes, but each your phase is offset, because 2nd output phase is phase multiplied by 2 and so on (see my previous picture).

    No it is just the size of the increment that is x2, x3, x4 etc.
    This does not offset the phase this just controls the frequency. They will all wrap when they reach +1 at the desired frequency. This does not create phase offset.
    The picture you mention just shows the phase section of my macro highlighted in Red. What does this illustrate?
     
  7. Chet Singer

    Chet Singer NI Product Owner

    Messages:
    822
    To our ears, phase is largely irrelevant. If you look at a waveform in a spectrum analyzer, and then change the phase of a harmonic, the spectrum will remain unchanged.

    Yes, the shape will be different. But to our ears it will sound the same.

    There are times when phase matters, such as short transient sounds. But there is no audible difference for longer sounds.

    If controllable phase is absolutely necessary, try syncing the oscillators once at the start of each note. That should be sufficient.
     
  8. Aleksandr Smirnov

    Aleksandr Smirnov NI Product Owner

    Messages:
    1,539
    But frequency affects the phase, doesn't it? It seems like I just don't get the point and the main idea:

    Phase difference (synonym Phase offset): The time interval or phase angle by which one wave leads or lags another.

    Wiki says:

    The phase of an oscillation or wave is the fraction of a complete cycle corresponding to an offset in the displacement from a specified reference point at time t = 0. The phase determines or is determined by the initial displacement at time t = 0. A motion with frequency f has period T = 1/F.

    Sorry. Good luck with it!
     
  9. synthlord

    synthlord NI Product Owner

    Messages:
    48
    phase sync

    I have attached an ensemble that has 6 sine oscillators.
    You can switch in and out sync. Listen to the difference between the two. One gives a sawtooth additive wave as it should. The other is just a wobbly mess.
    The frequencies are set matmatically so it should not be a tuning issue.
    I would be interested in a discussion of the best method to sync the oscillators in my core macro and less of a discussion on why.
     

    Attached Files:

  10. Chet Singer

    Chet Singer NI Product Owner

    Messages:
    822
    Your harmonics are not tuned properly. When the P inputs are left unconnected, the oscillators are offset by MIDI note 0, which is about 8 Hz. That's why the unsynched waveform moves.
     
  11. synthlord

    synthlord NI Product Owner

    Messages:
    48
    OK thanks. I got it now. You are correct..phase doesn't effect the resulting sound only the appearance of the wave form.
    I am always learning.
     
  12. herw

    herw NI Product Owner

    Messages:
    6,421
    i don't think so: f.i. if you have two waves with same frequency and same phase and add them you get double amplitude; but if they are not in phase f.i. with phase difference of half period you get zero. Isn't that a difference?

    Nevertheless to get such waves in phase you have to use the oscillators with sync input.
    Set the P-input to -300, calculate the frequency with the P2F-module and use the F-input. Then sync all oscillators by a GateOn-event.

    Your notice that the oscillators are out of phase after some wiring (deleting and inserting some modules) and playing with it is right.

    ciao herw
     
  13. Chet Singer

    Chet Singer NI Product Owner

    Messages:
    822
    Like herw said, if you do subsequent things to the wave the shape can make a difference. Straight filtering won't, but nonlinear operations such as clipping will.

    btw, many acoustic instruments, particularly plucked or struck instruments, don't have perfectly tuned harmonics anyway. Non-integer harmonics can be cool. If you sync your oscillators once at gate-on, you can have both a repeatable initial waveform and still be able to experiment with non-integer harmonics.
     
  14. synthlord

    synthlord NI Product Owner

    Messages:
    48
    Syncing Sines

    Ok here is my core macro attempt to combine all the suggestions made so far. I have included my own solution for syncing the phases for key down. If anyone knows a better way to implement the sync I would be interested in seeing how.

    In this version Key down starts all sines at 0 phase
    The Detune adds to phase increment which is then added to multiple of fundamental (x2,x3,x4 etc) for each sine oscillator for non-harmonic intervals.
     

    Attached Files:

Thread Status:
Not open for further replies.