Gen codebox内でfor文を使った平滑化フィルター #maxmsp #jitter

スクリーンショット 2014-10-24 19.37.12
genでfor文の使い方メモ。genで配列使いたい。

Codebox / genexpr

size = 10;
offset = floor(size/2);
scale = 1/(dim+1);
pix = 0;

for(x = 0 ; x < size ; x = x + 1){
	
	for(y = 0 ; y < size ; y = y+1){
	
		delta = (vec(x,y) - offset) * scale;
		pix = pix + sample(in1,norm + delta,boundmode="clamp")/(size*size);
	}
}

out1 = pix;

サンプルパッチ


----------begin_max5_patcher----------
2564.3oc6bkziaibE9r5eEETBP5drFYVUwEw3X.m3rcI.AAAIHv8fFTjkjoM
2FRp1cGCeXbirAjKIHYtFDLmBliA4PPbv7iQwCxs4uPpERJRItI0TzRwsMZx
lUUrp26qdupdKE6WdxfgS8uhDMD7MAOALXvKOYv.dQrBFj77fgtFWY5XDwa1
PSeWWhW7vQh5hIWEyKeNwCX5aQnuM3buY9ge4m9aV95+3+4e+EK+jOa4m7Wd
6+7u+k+q+va+8e5xa9yKe8ms7lOe4q+hk27lzNxw1iX5uvi2anjBCLhMeps2
7KBIlwBpTVcrzH.FwtJqqvtoJMVB7QIuxrv4SYsjVVRI1VbBze5y9PHLc3l4
6E6Y3R3U8sCsMbRqwagqsmCIlytvbMOx9WxaNRNqqos0eQbZikXE9pSNgcYT
KgSOxKnD1FnY.3RKxk221KXQFTWFXHIMVYD.onwtA0XLM.AyAG4Yd0lYdA2D
ec.QL.CGNh9SVu0H1.wUfMElQIgIHRBjP6CaGxkjvHaeubc8fgFAA4JdPtWg
giOym2QpixJx1STDLqnPxk1ouudVoFgTnLlhiKBEnvUSTGJpjN2cR5qlhyHg
blNWzah3lTNoN5r7bGeymS3nsTZg9ADO5TXHIhpwXDmPEYUaQlYrvI9hB.HZ
bo0OyvjT4KW5b4fgyCss78XDQg2jUb5v8D.jyZrqqXFdK7LBJ4kin7whnoFg
LTcpCI2bKU7022oXUYSjTs.COaWiXRrsfXQRYcpsaPnsPyOqLhmAsOdZjYnu
iSgtRTyk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