Forums > MaxMSP

grain envelope help

January 31, 2008 | 11:14 pm

Hallo
Having recently built a workable live-looper/glitcher patch, which relies on drunk/metro/line objects into a groove object to create grains, I’d now like to get rid of all those nasty artifacts that occur when I ‘scrub’ through groove (non zero-crossing points obviously), or ask metro to drop below c.100ms. I’m led to believe that the phasor and waveform objects can help enforce a smooth envelope on each grain, but i ain’t got no clue as to how to hook ‘em up. A similar question may have arisen before, but can’t find it in the forum.
Any suggestions good people?
Thank you
Brendan



kjg
January 31, 2008 | 11:58 pm

this simple example should give you some ideas on how you could window your signal. it uses the cycle~ object.

using wave~ you’d have to provide a window shape in a buffer and send wave~ a signal going from 0 to 1 over the duration of your grain. you could indeed use phasor~ for that. you’d have to calculate the right frequency for it though, depending on you r grain duration (freq = 1000/dur).

regards,
kjg

max v2;
#N vpatcher 14 59 849 683;
#P window setfont "Sans Serif" 9.;
#P window linecount 2;
#P comment 287 163 148 196617 phase values for cycle (it wraps the 1.25 around to 0.25);
#P user scope~ 228 203 328 253 64 3 128 0.5 1.5 0 0. 0 0. 102 255 51 135 135 135 0;
#P user scope~ 228 252 328 302 64 3 128 -1. 1. 0 0. 0 0. 102 255 51 135 135 135 0;
#P window linecount 5;
#P comment 346 224 88 196617 cycle object provides a nice window when you send it the right phase signal;
#P window linecount 1;
#P comment 52 199 63 196617 sine tone >>;
#P user ezdac~ 259 532 303 565 0;
#P toggle 208 69 15 0;
#P newex 256 69 27 196617 * 2;
#P newex 208 91 58 196617 metro 100;
#P newex 208 136 31 196617 + 20;
#P newex 208 113 58 196617 random 31;
#P user scope~ 161 305 291 435 64 3 128 -1. 1. 0 0. 0 0. 102 255 51 135 135 135 0;
#P comment 42 358 100 196617 sine grains come out;
#P newex 130 196 61 196617 cycle~ 321;
#P newex 161 253 27 196617 *~;
#P message 208 161 74 196617 0.75 , 1.25 $1;
#P newex 178 227 40 196617 cycle~;
#P newex 208 179 56 196617 line~ 0.75;
#P newex 1022 427 32 196617 print;
#P comment 14 255 141 196617 signal gets windowed here >>;
#P window linecount 3;
#P comment 299 97 77 196617 some durations between 20 and 50 ms;
#P connect 7 0 6 0;
#P connect 6 0 9 0;
#P connect 4 0 6 1;
#P connect 14 0 12 0;
#P connect 12 0 10 0;
#P connect 10 0 11 0;
#P connect 11 0 5 0;
#P connect 5 0 3 0;
#P connect 3 0 4 1;
#P connect 3 0 19 0;
#P connect 4 0 18 0;
#P fasten 11 0 13 0 213 156 292 156 292 62 261 62;
#P connect 13 0 12 1;
#P pop;


February 1, 2008 | 9:09 pm

Hey Hallo
thanks a lot for this; it works just like i need it to:) I can see that the variable coming from the random object is dictating the duration of the ‘grain’ envelope; as I don’t really understand what wrap-around is (you say 1.25 ‘wraps around’ to 0.25), i can’t see if it’s possible to vary the attack and release portions of the envelope. Forgive my weak Math/DSP knowledge: i’m quite new to MSP
Best wishes
Brendan



kjg
February 1, 2008 | 9:50 pm

>I don’t really understand what wrap-around is (you say 1.25 ‘wraps >around’ to 0.25)

I just meant that the cycle~ object does something like a modulo 1 (% 1) operation on everything coming in to its phase input. for example, an input of 1.01 will result in a value of 0.01, and 5.76 would result in 0.76.

Like I said, if you want another window shape, you’d have to make that happen using for example phasor~ and wave~ or phasor~ and trapezoid~. Of course you could also use line~ in the same way it’s being used in my earlier example to send a signal from 0 to 1 to wave~/trapezoid~ or even to a cycle~ object using another buffer.

If this all sound like Greek to you, it’s probably time to start doing the tutorials.

good luck
kjg

modulo:

max v2;
#N vpatcher 448 205 660 481;
#P user ezdac~ 59 173 103 206 0;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 60 86 34 196617 %~ 1;
#P user number~ 60 112 99 127 9 3 3 2 0. 0. 0 0. 250 0. 0 0 0 221 221 221 222 222 222 0 0 0;
#P user number~ 60 60 99 75 9 3 3 1 0. 0. 0 1.28 250 0. 0 0 0 221 221 221 222 222 222 0 0 0;
#P connect 0 0 2 0;
#P connect 2 0 1 0;
#P pop;


February 1, 2008 | 10:45 pm

Thanks again for this; it’s much clearer. Although I’m new to this forum, I have been through the tutorials (in detail) and i’m fairly fluent in the MAX processing side of MAX/MSP, but, without an extensive Math background, i’m finding the MSP side of things a bit of a challenge. But your help has been very valuable;
thanks a lot, this forum is one of the best online
Brendan
ps if you like i’ll post the final finished patch: i’m going for an interactive live glitcher/loop-sampler patch, maybe you would like to point out my errors



kjg
February 1, 2008 | 11:05 pm

you’re welcome. glad i could be of help.

if you’re serious about this stuff, a good text book like the computer music tutorial by Roads can be very helpful. I bought it years ago and I’m still looking up things regularly. very good resource.
just a suggestion.

if you feel like sharing your patch, feel free. just don’t ever feel obliged.

also, feel free to post any questions. some will be answered, some won’t. it’s the nature of forums. it’s quite an amazing pool of knowledge and experience here, but of course.. sometimes people are busy or just don’t feel like typing/patching.

if you have any specific question on a patch, just post an example to clarify your question. this will improve your chances of getting an answer.

o btw:
maybe you should download the granular toolkit by Nathan Wolek. There is a patch "gtk.winmaker" in there. it will help you understand how to make your own window shapes, and how to get them into a buffer for use with wave~

happy glitching :)



kjg
February 1, 2008 | 11:16 pm

> Having recently built a workable live-looper/glitcher patch, which relies on drunk/metro/line objects into a groove object to create grains, I’d now like to get rid of all those nasty artifacts that occur when I ‘scrub’ through groove

actually, you might want to post a little patch demonstrating how you control that scrubbing through groove.. to get more specific suggestions perhaps.


February 2, 2008 | 1:51 am

I too have no background in maths but i found it very useful to use the Signal Scope to see what effects operators are having on the signal. I learned a lot about the objects this way. Also for Granular stuff i highly recommend checking out Nobuyasu Sakonda’s granular Max/MSP patches. It might be good for you to see how he deals with windowing.

http://www.bekkoame.ne.jp/~nsakonda/maxpatch.html

best of luck.

John.



kjg
February 2, 2008 | 4:41 pm

John is right.
Scoping is probably the best way to find out what’s happening to a signal if your not sure due to lack of experience/imagination/math background/coffee/cookies.
Just slow things down and scrutinize the patch with a few scopes.

And Sakonda’s patches are indeed very educational if you are going for a more "proper" signal based implementation of anything granular.

regards,
kjg


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