Morphing between waveforms...

max's icon

HI list,

I am looking for a system to make interpolations between waveforms.

I want avoid too use a switch but find a way to morph progressively a square to a sawtooth for example. Like some analogic oscillators do .

Someone could help me??

Thanks by advance.

Max

Eric Sheffield's icon

Was trying to figure something like this out myself a few weeks ago. Tips from those who know, please!

Zh's icon

if you have one wave~ object with a sine wave and one wave~ object with a square wave, drive them from the same phasor~ and then crossfade between the outputs. if they're on the same phasor the output will be synced and the result will be a "morph" between the two waveforms. it is totally not cheating! you can check it with the scope~ object.

(equally you could use a cycle~ object and rect~ object and drive their phase inlet with the same phasor~. but wave~ lets you use any waveform...)

seejayjames's icon

maxd wrote on Mon, 02 March 2009 20:20HI list,

I am looking for a system to make interpolations between waveforms.

I want avoid too use a switch but find a way to morph progressively a square to a sawtooth for example. Like some analogic oscillators do .

The phasor method will work well and be very simple to implement, plus using all kinds of waveforms are possible. With a bit more work you can combine multislider and peek~, whereby you draw in the multislider and its list value (512 samples, say) gets stored in the buffer~ for playback. With some math you can fill the multislider with sine, sawtooth, etc., or simply draw whatever waves you want. Then use [pattr] on the multislider at your interpolation endpoints, and use a [line] to move smoothly between them. It also looks very cool

The drawback is that this is considerably more processing. It still is fairly smooth but the phasor~ route will take a much smaller hit. However you'll have a GUI for absolutely any waveform you want, plus you can load wave samples into the multislider using peek~ (reading from it instead of writing to it), save those in your pattr, then morph between them (snare hit to violin, speaking "ahh" to "ooh", etc...) You can reduce the processor hit by hiding the multislider, or much more so, speedlimiting how often its list goes out and is written to the buffer~ using peek~. Of course then you'll get "steps" in your interpolation that will be more noticeable than a smooth crossfade with the phasor~.

Randy Jones's icon

Simple crossfading does work great, as long as the relative phases of the waveforms are correct. This can be a little tricky to get right with rect~ and saw~ because one can't rely on them to start up with consistent phases relative to cycle~. Sending sync from another cycle~ offset in phase, as in this patch, makes it work consistently.

Fading between arbitrary waveforms indexed with a phasor~ can work, but you will have to oversample the **** out of it unless you don't mind aliasing.

-Randy

Max Patch
Copy patch and select New From Clipboard in Max.

jvkr's icon

With 2d.wave~ it is possible to morph between subsequent waveforms on audio rate in a clean way. Fill a buffer with subsequent cycles and have a look at the help file of 2d.wave.

_
johan

Peter Castine's icon

maxd wrote on Tue, 03 March 2009 03:20I am looking for a system to make interpolations between waveforms.

An alternative to 2d.waveform is the lp.frim~/lp.tim~ group of objects in Litter Power. They implement Larry Polansky's 'mutation' algorithms.

The objects are extremely powerful but not easy to use. To some extent they presume familiarity with the Mutation function in SoundHack (or any of the other implementations of mutation out there in the world). I've gotten great sounds out of the objects.

Lp.tim~ is part of the free Litter Starter Pack. For lp.frim~ (the big brother;-) people need to pony up for Litter Pro. As my mother always said, you get what you pay for.

max's icon

Thanks for all yours answers guys....

but Someone could send me the beginning of a patch or an exemple??
Because I use Max a lot but I never made synthesis and it's really complicated to understand your language.

Thanks a lot

Max

Jean-Francois Charles's icon

[2d.wave~] is a powerful beast, but may be difficult to use for a beginner.
Another option is to write both "source" waveforms in two jitter matrices, and to interpolate (for instance with jit.xfade) into a jit.buffer~, from which the sound is played back.
If you have never made synthesis, you can start in Max/MSP, of course! MSP tutorial 3 seems linked to your question. Do you find it useful?
Jean-François.

roger.carruthers's icon

Here's an example using 2dwave~ that someone posted to the list some time ago,
cheers
Roger

Max Patch
Copy patch and select New From Clipboard in Max.

max's icon

Thanks a lot

but how I can to open this code in Max5 please??

Randy Jones's icon

See "Sharing Patches With Others" in Max Help.

Quote:Thanks a lot

but how I can to open this code in Max5 please??

max's icon

I'm sorry but I don't see that in the documentation.

I know only the form

Max V2
etc...
etc......

copy and use the fonction "new from clipboard"

but how I could open this?

Max Patch
Copy patch and select New From Clipboard in Max.

please explain me

thanks a lot

Michele Verità's icon

can someone post it for max 4..still not m5 here..
thanks

Eric Sheffield's icon
Max Patch
Copy patch and select New From Clipboard in Max.

maxd wrote on Tue, 03 March 2009 10:55

This blows my mind a bit... O_o
How... How does one go about learning how to do this?
I mean, I'm pretty good with math and trig, and feel like I'm starting to get a good handle on at least the theory of synthesis... but this is just too cool. I'm sure most of you are going "no, this is actually quite passé" but it's new to me.

max's icon

ok I understand now!

thanks a lot!

Max

Zh's icon

hey maxd, you've answered your own question! select the whole code, from ---begin_max5_patcher--- to ---end_max5_patcher---, press copy, open max5 and do "new from clipboard". boom. if you only have max4 you can't use this code, but you said you have max5 so you should be fine.

max's icon

ok thanks

I saw this!

thanks everybody for you help!

Have a good evening

M

ComfortableInClouds's icon

seejayjames wrote on Mon, 02 March 2009 23:20 plus you can load wave samples into the multislider using peek~ (reading from it instead of writing to it), save those in your pattr, then morph between them (snare hit to violin, speaking "ahh" to "ooh", etc...)

what an idea! going to try this out...

roger.carruthers's icon

Here's the Max 4 version,
cheers
Roger

Max Patch
Copy patch and select New From Clipboard in Max.

Michele Verità's icon

thank you!

Axiom-Crux's icon

ericrobert wrote on Tue, 03 March 2009 13:41maxd wrote on Tue, 03 March 2009 10:55

This blows my mind a bit... O_o
How... How does one go about learning how to do this?
I mean, I'm pretty good with math and trig, and feel like I'm starting to get a good handle on at least the theory of synthesis... but this is just too cool. I'm sure most of you are going "no, this is actually quite passé" but it's new to me.

I think its just a matter of simple calculation of wavetables, I assume you checked out the p fill? Its all expr doing 1 512 space long wavetable per waveform, and then the 2d wave just basically crossfades between those.

I was never happy with that one simply because it sounds fine when you use it like this, but try FMing it, etc.. it gets kinda wanky.

I actually instegated the other thread that this is pulled from, and the solution that I was most impressed with was the one involving kink~, Ill find it and post it.

Axiom-Crux's icon
Max Patch
Copy patch and select New From Clipboard in Max.

this one is pretty cool

Axiom-Crux's icon

heres another sortof interesting one. Also something I found pretty great was the ejies list interpolator (they have a demo with 3d list interpolation, you can figure out a way to use it with audio, it wont be audio rate but it will do cool stuff)

Tj Shredder's icon

Peter Castine wrote on Tue, 03 March 2009 04:28maxd wrote on Tue, 03 March 2009 03:20I am looking for a system to make interpolations between waveforms.

Lp.tim~ is part of the free Litter Starter Pack. For lp.frim~ (the big brother;-) people need to pony up for Litter Pro.

Looking at the lp.frim~ help file would make me think it should work also within a pfft~, and the reason for creating "buzzy" sounds in the help patch is due to the lack of windowing?
(The help file doesn't sound like somthing I'd call "mutation" between two sine waves...)

Just curious (never played too long with these objects as the term "great sounds" is heavily bound to personal taste...

Stefan

webe's icon

I just tried to run the Litter Power objects, but they don't seem to work anymore in Max 8. I tried the email, maybe I can rebuild them. Anyone interested?