transitioning between waveforms
currently using menu to switch between waveforms for a frequency, obviously there is an audible click each time i select a new waveform and this is something I’m trying to fix.
i’ve attempted to multiply the output of cycle~ into a clip~ object which results in something much like a square wave or rect~ but its not completely similar as much as i would like it to be.
what i’m trying to achieve is something much like the moog voyager where you have a knob that gently crossfades between various waveforms without audible clicks.
any help is greatly appreciated
you could let them run both and simply crossfade using *~
I would recommend scanning a wave table. Cross fading between sources will create an audible dip in volume when you are transitioning between oscillators.
The main cause of a "dip" in crossfading is using a linear crossfade (and, if you do that, then you sort of deserve the results you get:-)
Using a quarter-cosine mapping is the standard approach to maintain equal power over a crossfade. Exactly how well that works will depend on your source material, but it generally does a good job.
What Peter said:
<code>-- Pasted Max Patch, click to expand. --Copy all of the following text. Then, in Max, select New From Clipboard.----------begin_max5_patcher---------- 637.3ocyV0saaCBE9ZWo9Nf31klA3eydP1MSSUXLIkNGvx3zk1p0m8gAGWm1 zFZZhajr.4iOb72467GOd4EAvb0ZtFB9A3WfffGMRBrxZkDrQP.bIcMqjpsJ Bk7+pxuENo6aM70MV4kBI+odwUzF1MB4hqq4rF2OHDmLEMAfCia2hHsqD7TD 32aNjZUSIuo49Jt6DPsXgjVBm.f4T4B3yZNWIajzkV8f+jWWPkz9+snvJ1fx qvQ8RkqVJjFya8BxPCoEOXMDtEROqsCMN0sR+2kWzta1l7oYqJJ6Of4.LB4A kMKrcMMxCF6P3nviBGgOXNRyTUCRcxWvTkpZmCgsoL8KngN+NHLRlM4JDG6R 0P8aC3kWYezzHT3LBwZ+DRZTr8287QFxVn8vVayJnidlC6dV46WnEEacaBwR Bcu3Ug1GO4Y1WbtyawRe6ISrLM1CZBOyRSIjSIMk8ESS7GJnr2MoAmYYiLaA QT7l0cVCjNRk.L0xkbYyqit3uGATyAT.SoMic7HJm3h06pXv2XXxt8Z7GKF1 Kdd8hbqfoGNAoKEE7ZeF555GlNy1cD46HjJZsgXZ30Wykz7R9VNv.pIZOTyo tZWynkb.xP6oF9z7Ph8fT5xIHoml4puwX0jygwpntgocK3ivX0AdN4reDYmC 006+zNhDeR586vg8V2u7B7V+s8Cuf6zpU0rMtS2vav.WtfqaDRZiPIGnT6Ed Fp0MhhBtbqNAEBca2gh8DM8FWXevEY7gUjO3JazwUlOvpMViOCoK73iqPuvU znGG8CWgiNt7JN94fUW2LZU0c7ZcmkcHxzx+V2XK2jSnoGp6cmkg076DaNRp Qh0plk+C81bqdC -----------end_max5_patcher-----------
we use this a lot
thanks for all the replies. i was hoping to get a little more elaboration on n00b_meisters patch… very interesting but i’m lacking the understanding as to how I could create that crossfade between waveforms smoothly, while interpolating the various points between each waveform.
As Peter says, the success of the non-linear crossfade is dependent upon source material, and with simple waveforms in the -1. +1. range you will get some cases where they exceed (=clipping) this range, so a linear crossfade might be better; for example:
<code>-- Pasted Max Patch, click to expand. --Copy all of the following text. Then, in Max, select New From Clipboard.----------begin_max5_patcher---------- 1422.3oc2Z1saihCEG+5LRy6.kq1YmNU1Gaig8h8wXuY0nQDvIkYI.KPZmOz 1m8ErIYRZcJNMfCIRUfJPrO7y+843yw7y2+tYtyy+lnx04Ob9amYy9YyUlIu V6Uls4BybWE9snzvJ4C5FkuZkHq181taVK9Vs7FoIYhvRmnx7ppEgwhsOQRr 794y+5mXv1qVTJpZZmv5j7ruTJhpUlgmObG5VGNu8Hp6fym27qVjmUWk7CQ6 CiaextqmsdURVpnVZi3s8QXcz8IYK2q8I2wZZeVaSiYxd.v61EMMU955MsEZ 2dNKbkrmc+KQYbXV31WlEkKmKe56Pxq7eu+csmaNc6oCVw+tNL0oH+QQoyuE st7AQ7Gzf4V9GkuNS9i.cvG2G7ITeI78GI3ST7dO3S7lzvOJMonn4s3lazom od8gz.P9xxPAiDS883sBZFB0dJXBInmuttNOSK13FhMpGUO1NV7PYr1SDkjC cX7rssTWq96EBUC4NOLaoqymey3HS7Xy69KUXe7IsHx2PDQ3zSPYA8iNhmBc P6wWSYcXzUkrLKL0cea6EZuAmrh3kB8vMvT8GgNtSao.SM6suosvqqKucq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MLKqwLhXf8CIQ3 FowrePbhQAwImAO+dFMTZ+YkFRLO6OTRLxv.6SLjwyJmh9w.9D0y+4vvLZVI 4L34Gar6B7DzvHmgjQLwtv3IpcA12YgQdwr+B9wFkIB19FFfMdjbJRL3L3Dy HfY+T2LKWW6ONZlqBO6aXvT0vvF6qvx0RzLoO8jHVW0XCKJdPTV00zJaxcU3 WU6hupNxtqRxT+upkcKEOjr4mvathrUaN7+PJ3r0Z -----------end_max5_patcher-----------
Incidentally, there’s a great patch from Gregory Taylor somewhere on the forum with a catalogue of waveform shapes built in gen, if you have that add-on. Might be of interest?
it seems to be easier to do *~ 0.5 when the range really is a problem. which it shouldnt be as long as we are inside the actual synth patcher.
not crossfading linear – and the use of interpolation – is a given. ;)
Note that the 2d.wave~ patch that I posted (not mine) will alias at higher frequencies so you wont be able to do fun things like FM with it, so implementing a decent cross-fade is probably a better solution (it’s just not as much fun ;-)
Axiom-crux’s kink~ solution is pretty neat too, but again, you’ll need to put it in an up-sampled poly~ to reduce aliasing,
Instead of clip~ with cycle~ to make a square wave, use tanh~. It will generate odd partials but can be band limited. There’s a CMJ article (Lazzarini, IIRC, is one of the authors) on distortion synthesis that presents a simple formula for calculating the multiplier. It works well.
Also, if you go the cross-fade route, you’ll notice that there’s a difference in average volume between cycle~ and rect~.
Forums > MaxMSP