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

Aliasing question...

Discussion in 'Building With Reaktor' started by KoaN, Oct 31, 2015.

  1. KoaN

    KoaN NI Product Owner

    Messages:
    266
    I am messing around with phase distortion in my synth...it is giving me a lot of aliasing with certain settings,combinations.
    I found that link from Salamander's site.
    http://www.nireaktor.com/wp-content/uploads/2013/06/8.jpg

    The problem is my synth is just huge and already over the top in terms of cpu power so if i duplicate 8 times everything this is overkill.

    My question is this :When Using Phase distortion in various ways is it possible to reduce aliasing without having to duplicate 8 times the Phase+Oscillator?

    I have zero knowledge about anti-aliasing method but i was hoping for a simpler and lighter trick that could help.
    I see that all these anti-aliasing methods soften the wave edges at higher frequencies as to avoid aliasing.

    Thanks.
     
  2. colB

    colB NI Product Owner

    Messages:
    3,969
    You could try 4x oversampling instead of 8x, or even 2x or 3x.

    Another option might be to look at something based on the same idea as polyblep anti-aliasing, where a polynomial smoothing operation is applied when there is a discontinuity in the waveform or the derivative of the waveform. Basically, when a waveform is made up of straight lines joined together, where ever there is a change in angle, a polyblep is calculated and mixed in that reduces the aliasing. This is how the oscillators in Reaktor work. Also look up 'Differentialted Polynomial Waveform (DWP)' approach, and more specifically it's variants PTR and EPTR. These are alternative approaches to the same basic idea as polyblep.
     
  3. salamanderanagram

    salamanderanagram NI Product Owner

    Messages:
    3,454
    there is an anti-aliasing method for this oscillator in the paper i stole it from

    http://recherche.ircam.fr/pub/dafx11/Papers/55_e.pdf

    i don't think i ever got it to work though.

    the authors of the paper were hired by some company or another to implement their algorithm in a synth. the post i read about that said that they had been hired specifically to reduce aliasing.
     
  4. KoaN

    KoaN NI Product Owner

    Messages:
    266
    Hmm this is way over my knowledge and not something i can implement myself.
    The only thing i can do is take an existing module and copy it somewhere else hoping the modifications will be easy.
    I have tried once to use Salamander's algo and choose 2,3,4x instead of 8x,hoping this would be easy to change and that wasn't working well...i thought maybe it was because of the Table module? with a setting other than 8x does it have to be changed?

    I also tried testing with different Oscillator to see if the Anti-aliasing was helping and it was doing zero difference.
    I was adding a PW phase distortion module or ZP "zero phase" distortion module right next to the end of the phase accumulator with the new Polyblep Oscillators,R5 AA,no anti-aliasing Oscillators and there was no difference.
    I have no idea what to change in order to make that Phase distortion module work with the anti-aliasing.

    I stumbled across a nice paper involving phase distortion techniques,even though i cannot understand any Math in there i always drool over new approach in sound design.To my great surprise there's even a Reaktor instrument file link at the end!!! Really nice examples of phase distortion specially the super saw one only made with manipulating the phase.Unfortunately there's no anti-aliasing in there.
    The paper does talk about integrating Polyblep.
    http://smcnetwork.org/files/proceedings/2010/15.pdf
     
    Last edited: Oct 31, 2015
  5. colB

    colB NI Product Owner

    Messages:
    3,969
    There would be a bunch of filter coefficients that would need to be changed, and possibly other stuff.
    Look here to find an example I posted that has 4x up and down-sampling macros. You would line everything else up in pretty much the same way... Making sure that any internal references to the sample rate are changed to 4x SR.R rather than 8x.
    I don't think you can just use AA oscillators as building blocks and expect the end result to be anti-aliased. It will take some fancy trickery involving some math and a lot of 'getting your head around it'!
    The anti-aliasing trick in the paper Don posted is interesting, but it will change the sound somewhat. It seems to work by replacing the remainder 'part sections' of modulator with scaled sinusoids that are nearly the same, but result in way less aliasing. It is definitely a good option if you want to keep cpu usage low, but I think it might be possible to do something that preserves the high end more accurately, and has minimal aliasing when oversampled a few times.

    Or just embrace the aliasing!
     
  6. salamanderanagram

    salamanderanagram NI Product Owner

    Messages:
    3,454
    the oversampling ensemble i designed automatically calculates filter coefficients for an arbitrary number of taps and oversampling rate.

    but once you get those values (stored in a table on the panel) you need to build the filter itself. my 8x example works on a 64 tap filter. i'll be making some videos soon about creating oversampling filters to fit your choice of specifications.
     
  7. KoaN

    KoaN NI Product Owner

    Messages:
    266
    Ok i'll check that link.
    I was hoping the AA algo would magically make aliasing disappear whatever the modification i was doing to the phase...hehe

    Honestly i do like aliasing in some context and i am really used to it since all the synths i have built have it,not enough of an expert in DSP.
    I use several phase distortion modules so after a few of them "PW,formant,ZP..." things get really nasty in high frequencies.
     
  8. KoaN

    KoaN NI Product Owner

    Messages:
    266
    I think i have used an ensemble at the time i was trying to oversample 4x that would calculate the number of tap filter and generate a table with coefficients...but there was something i was doing wrong.
    Looking forward to your new videos.
     
  9. colB

    colB NI Product Owner

    Messages:
    3,969
    4x oversampling does make a big dent in the aliasing, but it is still noticeable in certain situations.
     
  10. colB

    colB NI Product Owner

    Messages:
    3,969
    Here's an example that highlights why using standard poly-blep waves for modulator doesn't work:
    If there is a jump from 1 to 0 or 0 to 1 in the modulator, a standard anti-aliased saw for example would use a poly-blep to remove aliasing. However, as we are applying the modulator value to a cosine function, 1 and 0 (equivalent to 0 and 2xpi) give the same result 1, we don't need a blep! so in this situation the poly-blep is actually bad, it causes artifacts when without it there would be none!
    So we need a special poly-blep process that calculates correctly in the context of the cosine function (or use the approach from the paper Don posted).
     
  11. colB

    colB NI Product Owner

    Messages:
    3,969
    I've been experimenting some more with this. I've implemented their 'novel' one oscillator approach. IMO it's not a good solution. It doesn't really anti-alias, instead it smooths by replacing part of the wave with a scaled partial sinusoid. There are two main problems with this:
    #1 It is not a general solution in that it only smooths in the specific circumstance of scaling the inflection point to produce formants. It can't help with aliasing caused by hard sync (even if it could, it would change the character of the sound too much), and it doesn't work when the number of inflection points is increased to more than two.
    #2 While it removes aliasing that was being caused by non-integer peaks in the phase vector, it introduces low level overtones that can cause unwanted inharmonic artefacts in some circumstances. The problem here is that while oversampling can reduce normal aliasing to an acceptable level, these overtones remain and can be annoying.

    I have found that oversampling the naïve approach gives a better overall result, isn't hugely cpu intensive, and is completely generalizable.
     
  12. salamanderanagram

    salamanderanagram NI Product Owner

    Messages:
    3,454
    yeah i think you are right.
    i have tried a few times to implement the suggested method and it really never helped much.