interpolating between waveshaping values

Nov 3, 2008 at 4:43pm

interpolating between waveshaping values

Greetings,

I’m looking to interpolate between two waveshaping functions (‘previous’ and ‘current’). Attached is my current waveshaping patch (macbook running max 4.6 on windows xp), and as it is it does not support interpolation. When you click on function, the new distortion setting is automatically triggered, commonly resulting in sudden unwanted changes in timbre and/or volume.

I tried switching [uzi] to [line] with no success (line is much slower than uzi so the waveform is very jagged rather than a smooth line). I have set up two buffers and am now wondering if i can interpolate between buffers with a specified time ramp. This doesn’t look promising.

Any suggestions?

#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#N vpatcher 20 74 200 341;
#P window setfont “Sans Serif” 9.;
#P newex 20 201 27 9109513 *~;
#P newex 38 178 82 9109513 +~;
#P newex 109 132 40 9109513 ==~ 0.;
#P newex 109 155 40 9109513 *~ -1.;
#P newex 109 102 33 9109513 >~ 0.;
#P newex 20 77 31 9109513 abs~;
#P newex 20 48 55 9109513 clip~ -1 1;
#P newex 20 102 86 9109513 wave~ ws 0. 11.61;
#P inlet 20 28 15 0;
#P outlet 20 225 15 0;
#P connect 1 0 3 0;
#P connect 3 0 4 0;
#P connect 4 0 2 0;
#P connect 2 0 9 0;
#P connect 9 0 0 0;
#P connect 8 0 9 1;
#P fasten 5 0 8 0 114 126 43 126;
#P fasten 3 0 5 0 25 70 114 70;
#P connect 5 0 7 0;
#P connect 7 0 6 0;
#P connect 6 0 8 1;
#P pop;
#P newobj 9 353 49 9109513 p distort;
#B color 5;
#P newex 124 306 28 9109513 node;
#P button 49 112 15 0;
#P user function 63 27 263 127 1 1 1 0;
#X frgb 82 82 82;
#X brgb 204 204 204;
#X rgb2 85 85 85;
#X rgb3 255 255 255;
#X rgb4 0 0 0;
#X rgb5 0 0 0;
#X add 0. 0. 0;
#X add 513. 1. 0;
#X domain 513.;
#X range 0. 1.;
#X done;
#P flonum 50 276 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P button 62 173 15 0;
#P window linecount 2;
#P comment 87 274 146 9109513 gives a value (y) for every value (x) banged by uzi in function;
#P window linecount 1;
#P comment 109 196 157 9109513 clear all;
#P comment 201 173 157 9109513 bang when changed with mouse;
#P button 185 173 15 0;
#P newex 62 194 48 9109513 t b b;
#P message 106 227 95 9109513 clear , 0 0. , 513 1.;
#P newex 9 331 71 9109513 buffer~ ws1 12;
#P newex 9 293 51 9109513 pack 0 0.;
#P newex 9 312 52 9109513 peek~ ws1;
#P newex 68 249 40 9109513 uzi 513;
#P window linecount 2;
#P comment 201 220 127 9109513 clear function & create points at 0ms (0) and 513ms (1);
#P window linecount 1;
#P comment 112 251 127 9109513 bang 1 to 513 very fast;
#P inlet 50 251 15 0;
#P inlet 62 153 15 0;
#P inlet 185 153 15 0;
#P outlet 106 308 15 0;
#P connect 10 0 0 0;
#P connect 10 0 20 0;
#P fasten 6 2 8 0 103 272 14 272;
#P connect 6 2 0 0;
#P connect 6 2 20 0;
#P hidden connect 20 0 18 0;
#P connect 18 3 12 0;
#P connect 18 0 17 0;
#P connect 19 0 16 0;
#P connect 8 0 7 0;
#P connect 1 0 12 0;
#P connect 11 1 10 0;
#P fasten 12 0 6 0 190 218 73 218;
#P lcolor 8;
#P connect 11 0 6 0;
#P connect 16 0 11 0;
#P connect 2 0 16 0;
#P connect 17 0 8 1;
#P connect 3 0 17 0;
#P window clipboard copycount 22;

#40638
Nov 4, 2008 at 7:49am

Here’s a waveshaping approach using pattrstorage for interpolation. Maybe it will give you some ideas: http://compusition.com/web/software/maxmsp/interpolating-waveshaper

This works by storing all the samples for the waveshaping buffer in a pattr. Store some presets and use pattrstorage to interpolate between them. Then do [pattr] -> [listfunnel] -> [peek~] to update your buffer. Actually, this patch is using [pvar transferfunction] -> [listfunnel] -> [peek~], but that pvar is controlled by a pattr because I am using [autopattr].

There are probably ways to do this that give better sound quality, but if you like this approach you could always run it through a low pass filter to remove some of the harshness.

I just noticed this patch doesn’t seem to work quite right in Max 5, but it looks like you are using Max 4 so it should be fine.

#143949
Nov 4, 2008 at 7:54am

> I just noticed this patch doesn’t seem to work quite right in Max 5

Nevermind, I restarted Max 5 and now it works ok there too. Weird.

#143950
Nov 4, 2008 at 12:35pm

exactly what I’m looking for! Thanks.

#143951

You must be logged in to reply to this topic.