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

Thread: triangle & sawtooth oscillators : how to deal with aliasing ?

  1. #1

    triangle & sawtooth oscillators : how to deal with aliasing ?

    Hello,

    I noticed a lot of aliasing with the triangle & sawtooth oscillators, especially with high pitch notes. Is there a way to improve or smooth this waveforms ?

    Thanks,
    Emmanuel

  2. #2
    Senior Member
    Join Date
    Dec 2019
    Posts
    121
    You can use a bandwidth limited triangle wavetable.

  3. #3
    How do you do that ?

  4. #4
    Senior Member
    Join Date
    Dec 2019
    Posts
    121
    The simplest way would be to construct a soundfont using a free program called Polyphone: https://www.polyphone-soundfonts.com/ for each c note provide a sample of a triangle wave which is not aliased. This can be achieved by sampling any number of free software synthesizers available online. Generally you would need a free DAW like Reaper https://www.reaper.fm/ as well. Export the wavs for each sampled C and import these into Polyphone to create a soundfont. Then you would use the pjrc provided soundfont decoder and voila! You may also be able to find alias free triangle wavs sampled at each C on the internet to save yourself some work but I don't have any ready links... You may find this link helpful as well: https://www.music.mcgill.ca/~gary/30...ndlimited.html Cheers!

  5. #5

  6. #6
    Junior Member
    Join Date
    May 2017
    Posts
    1
    There are very many ways to do anti-aliased oscillator synthesis.
    If the wavetable approach isn't your thing, Mutable Instruments provides some excellent code used in their highly regarded Plaits eurorack module that utilizes the PolyBLEP method for anti-aliased oscillators. The aliasing isn't removed completely, but greatly reduced, and inaudible if you keep your oscillator frequency below 4-5 kHz or so.
    https://github.com/pichenettes/euror...w_oscillator.h

  7. #7
    Senior Member
    Join Date
    Dec 2019
    Posts
    121
    Martin Fink has a good tutorial regarding PolyBLEP algo: http://www.martin-finke.de/blog/arti...ep-oscillator/

  8. #8
    Finally, I used Faust language to add band-limited oscillators.
    Faust can run on Teensy. It is really worth giving a try...
    Emmanuel

  9. #9
    Senior Member Blackaddr's Avatar
    Join Date
    Mar 2017
    Location
    Canada
    Posts
    262
    Quote Originally Posted by emmanuel63 View Post
    Hello,

    I noticed a lot of aliasing with the triangle & sawtooth oscillators, especially with high pitch notes. Is there a way to improve or smooth this waveforms ?

    Thanks,
    Emmanuel
    You can process the triangle or sawtooth with an IIR filter (look at the CMSIS biquads supported by teensy for accelerated filtering) or use the waveform approach. The latter is is certainly more computationally efficient. Which one is easier depends on whether you find it easier to run a couple IIR biquads on it or compute and populate waveform tables.

Posting Permissions

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