Forums > MaxMSP

Morphing between waveforms…


max
March 3, 2009 | 2:20 am

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


March 3, 2009 | 2:41 am

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



Zh
March 3, 2009 | 3:01 am

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…)


March 3, 2009 | 4:20 am
maxd wrote on Mon, 02 March 2009 20:20
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 .

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 Smile

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~.


March 3, 2009 | 4:41 am

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

– Pasted Max Patch, click to expand. –

March 3, 2009 | 8:35 am

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


March 3, 2009 | 11:28 am
maxd wrote on Tue, 03 March 2009 03:20
I 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
March 3, 2009 | 1:33 pm

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


March 3, 2009 | 2:38 pm

[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.


March 3, 2009 | 3:16 pm

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

– Pasted Max Patch, click to expand. –


max
March 3, 2009 | 3:32 pm

Thanks a lot

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


March 3, 2009 | 4:29 pm

See "Sharing Patches With Others" in Max Help.

Quote:
Thanks a lot

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



max
March 3, 2009 | 4:55 pm

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?

– Pasted Max Patch, click to expand. –

please explain me

thanks a lot


March 3, 2009 | 5:58 pm

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


March 3, 2009 | 8:41 pm

maxd wrote on Tue, 03 March 2009 10:55

– Pasted Max Patch, click to expand. –

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
March 4, 2009 | 12:23 am

ok I understand now!

thanks a lot!

Max



Zh
March 4, 2009 | 12:31 am

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
March 4, 2009 | 12:34 am

ok thanks

I saw this!

thanks everybody for you help!

Have a good evening

M


March 4, 2009 | 5:25 am
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…


March 4, 2009 | 8:34 pm

Here’s the Max 4 version,
cheers
Roger

#P window setfont "Sans Serif" 9.;
#P user umenu 285 182 44 196647 1 64 198 1;
#X add off;
#X add ix;
#X add mod;
#P window linecount 1;
#P newex 330 222 61 196617 selector~ 2;
#P user hslider 204 87 18 128 128 1 0 0;
#P newex 396 170 30 196617 mtof;
#P newex 237 122 29 196617 – 24;
#P newex 200 124 30 196617 mtof;
#P newex 397 194 45 196617 phasor~;
#P newex 5 26 45 196617 loadbang;
#B color 5;
#P newex 454 240 45 196617 loadbang;
#B color 5;
#P newex 5 45 48 196617 t b 2049;
#N vpatcher 10 59 564 556;
#P window setfont "Sans Serif" 9.;
#P newex 86 65 53 196617 t b b b b;
#P inlet 88 44 15 0;
#P newex 322 310 42 196617 + 1535;
#P newex 322 351 55 196617 peek~ four;
#P newex 322 291 27 196617 t i i;
#P newex 339 328 105 196617 expr (255-$i1)/255.;
#P newex 322 272 27 196617 – 1;
#P newex 288 253 44 196617 Uzi 512;
#P newex 91 321 42 196617 + 1023;
#P newex 91 363 55 196617 peek~ four;
#P newex 91 302 27 196617 t i i;
#P newex 108 340 175 196617 expr ((cos($f1/511*6.28))>0)*2-1;
#P newex 91 283 27 196617 – 1;
#P newex 57 264 44 196617 Uzi 512;
#P newex 252 154 35 196617 + 511;
#P newex 252 196 55 196617 peek~ four;
#P newex 252 135 27 196617 t i i;
#P newex 269 173 132 196617 expr abs(255-$i1)/127.-1;
#P newex 252 116 27 196617 – 1;
#P newex 218 97 44 196617 Uzi 512;
#P newex 65 173 55 196617 peek~ four;
#P newex 65 131 27 196617 t i i;
#P newex 82 150 124 196617 expr cos($f1/511*6.28);
#P newex 65 112 27 196617 – 1;
#P newex 31 93 44 196617 Uzi 512;
#P comment 103 119 26 196617 sine;
#P comment 296 122 44 196617 triangle;
#P comment 133 297 32 196617 block;
#P comment 359 287 26 196617 saw;
#P connect 28 0 4 0;
#P connect 28 1 15 0;
#P connect 4 2 5 0;
#P connect 5 0 7 0;
#P connect 7 0 8 0;
#P connect 7 1 6 0;
#P connect 27 0 28 0;
#P connect 6 0 8 1;
#P connect 15 2 16 0;
#P connect 16 0 18 0;
#P connect 18 0 20 0;
#P connect 20 0 19 0;
#P connect 18 1 17 0;
#P connect 17 0 19 1;
#P connect 28 3 9 0;
#P connect 9 2 10 0;
#P connect 10 0 12 0;
#P connect 12 0 14 0;
#P connect 14 0 13 0;
#P connect 12 1 11 0;
#P connect 11 0 13 1;
#P connect 28 2 21 0;
#P connect 21 2 22 0;
#P connect 22 0 24 0;
#P connect 24 0 26 0;
#P connect 26 0 25 0;
#P connect 24 1 23 0;
#P connect 23 0 25 1;
#P pop;
#P newobj 5 64 30 196617 p fill;
#P message 199 279 55 196617 trigger $1;
#P user umenu 199 258 44 196645 1 64 274 0;
#X add None;
#X add Up (1);
#X add Down (2);
#P message 401 288 41 196617 rows 4;
#P user scope~ 139 351 269 481 2 3 128 -1. 1. 0 0. 1 0. 102 255 51 135 135 135 0;
#P toggle 321 429 15 0;
#P newex 342 429 30 196617 dac~;
#P user gain~ 351 345 13 54 158 0 1.07152 7.94321 10.;
#P newex 200 145 45 196617 phasor~;
#P user hslider 360 112 18 128 128 1 0 0;
#P newex 360 146 95 196617 scale 0 127 0 0.75;
#P message 360 169 35 196617 $1 50;
#P newex 360 190 31 196617 line~;
#P message 418 241 33 196617 2048;
#P newex 418 266 65 196617 sampstoms~;
#P newex 98 100 65 196617 buffer~ four;
#P message 98 83 42 196617 size $1;
#P newex 43 64 65 196617 sampstoms~;
#P newex 351 319 75 196617 2d.wave~ four;
#P comment 220 70 31 196617 pitch;
#P comment 391 96 33 196617 index;
#P connect 7 0 6 0;
#P connect 22 0 17 0;
#P connect 22 0 7 0;
#P connect 6 1 2 3;
#P connect 27 0 24 0;
#P connect 26 0 27 0;
#P connect 24 0 29 2;
#P connect 29 0 2 1;
#P connect 13 0 14 0;
#P connect 13 0 14 1;
#P connect 9 0 8 0;
#P connect 10 0 9 0;
#P connect 11 0 10 0;
#P connect 8 0 29 1;
#P connect 2 0 16 0;
#P connect 2 0 13 0;
#P connect 12 0 2 0;
#P connect 17 0 2 0;
#P connect 15 0 14 0;
#P connect 30 0 29 0;
#P connect 28 0 25 0;
#P connect 28 0 26 0;
#P connect 25 0 12 0;
#P connect 18 0 19 0;
#P connect 19 0 16 0;
#P connect 4 0 5 0;
#P connect 3 1 4 0;
#P connect 21 1 3 0;
#P connect 21 0 20 0;
#P connect 23 0 21 0;
#P window clipboard copycount 31;


March 5, 2009 | 11:16 pm

thank you!


March 7, 2009 | 3:53 am
ericrobert wrote on Tue, 03 March 2009 13:41
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. Smile

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.


March 7, 2009 | 4:31 am

– Pasted Max Patch, click to expand. –

this one is pretty cool


March 7, 2009 | 4:52 am

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)


March 16, 2009 | 11:39 am
Peter Castine wrote on Tue, 03 March 2009 04:28
maxd wrote on Tue, 03 March 2009 03:20
I 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…Wink

Stefan


Viewing 25 posts - 1 through 25 (of 25 total)