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

Averaging to Integer?

Discussion in 'REAKTOR' started by dfa, Jan 14, 2003.

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

    dfa NI Product Owner

    Messages:
    474
    How do I average a non-integer event number to an integer? I would imagine the Quantizer module should do this, but I can't get it to.

    Example, I have an event input of "4.345" -- and I want that to come out the other end as "4". When the input has increased to "4.5", I want the output to step up to "5".

    I don't have to build a 79-piece math macro... do I?
     
  2. self oscillate

    self oscillate NI Product Owner

    Messages:
    279
    hello dfa,

    you don't have to build a big macro, but a small one :)

    use a combination of "modulo" and "compare".
    connect your knob or whatever to modulo input a
    and a constant of 1 to input b.
    now connect the mod output of modulo to the compare input a
    and a constant of 0.5 to the compare input b.
    now add the outputs modulo div, compare = and >
    together and thats it.

    best wishes

    self oscillate
     
  3. dsho71@yahoo.com

    dsho71@yahoo.com NI Product Owner

    Messages:
    24
    I don't think you need to build any macro at all... The Quantizer module does this nicely if you wire a constant 1 to the St (step size) input.

    peace,

    Dale
     
  4. self oscillate

    self oscillate NI Product Owner

    Messages:
    279
    yes, you're right, the quantizer will do.
    i was just in the "construction mood" :)
     
  5. dfa

    dfa NI Product Owner

    Messages:
    474
    BTW I should have said "round" not "average".

    I'm getting weird results with the Quantizer. Sometimes when I first connect it together, the Out output has the In value (not rounded) or "0" (when the In value is higher than .5). Other times when I first connect it together it works correctly.

    In the buggy state, doing something to it (disconnecting and reconnecting a wire, etc.) causes it to then start working properly. But, if I then save the ensemble and reopen it, it's back to being buggy at first.

    This actually might only be happening in one particular test ensemble I had been working in. I've found occasionally that ensembles become mysteriously corrupted and start behaving weirdly, so maybe that's the case.

    Anyway, thanks for both tips as I might end up using self oscillate's approach if it's more reliable...

    Mac 3.07.008 Non-Altivec
     
  6. self oscillate

    self oscillate NI Product Owner

    Messages:
    279
    modulo + compare should always work correctly.
    please tell me if i'm wrong.

    best wishes

    self oscillate
     
  7. dfa

    dfa NI Product Owner

    Messages:
    474
    Well the math does work correctly... I'll have to see over time if there are any intermittant bugs with it though like Quantizer... Thx
     
  8. dsho71@yahoo.com

    dsho71@yahoo.com NI Product Owner

    Messages:
    24
    Here's what I've found... The Quantizer works fine UNLESS the input signal chain begins with a knob. The Quantizer will miss the event the knob sends when an ensemble is loaded. The Modulo solution does not suffer from this problem. The Quantizer will work with a knob if you insert an event delay (leave the delay time input unconnected) between the knob and the Quantizer.

    peace,

    Dale
     
  9. dfa

    dfa NI Product Owner

    Messages:
    474
    Hi Dale,

    Thanks for confirming this. I'm going to report it to NI with a demonstration ensemble. What Reaktor version are you using (platform, Reaktor subversion, altivec/SSE) and what OS version?

    Yesterday I was finding it usually but not always occurred with a knob, but also sometimes occurred with just constants (more likely with two constants multiplied). But in today's alternate universe it is only happening with knob, fader, button, and XY.

    I'm getting correct results with self oscillate's macro as you are.

    Doug
     
  10. dsho71@yahoo.com

    dsho71@yahoo.com NI Product Owner

    Messages:
    24
    Hi Doug,

    I've tested this on 2 PC's running v3.0.5-002. One is a PIII running Win2K. The other is a mobile Athlon running XP.

    - Dale
     
  11. dfa

    dfa NI Product Owner

    Messages:
    474
    Thanks... we'll see if the fix gets in the next build.
     
Thread Status:
Not open for further replies.