Forums > MaxMSP

discrete summation formula on max

February 23, 2011 | 2:05 pm

Hi list,
here a patch concerning the "discrete summation formula" showed in the Dodge-Jerse’s book.
I developed the flowchart of page 162 (latest edition).
Unfortunately it doesn’t work properly.
Could you please take a look at the following patch? Thanks
fv

– Pasted Max Patch, click to expand. –

(edited by admin – please use copy-compressed when posting patches)


February 27, 2011 | 12:16 am

hi federico,

here’s my take on it, using the second formula from the book to avoid division by zero. I’m not quite sure, which treshold to use for "near zero"..

But there’s still a problem with keeping the oscillators in sync…
I’ve used one main phasor~ and rate~.
The oscils seem to drift. Strangely, when *repeatedly" sending rate~ the "sync lock" message, they stay in sync.

PS:
there is a typo in your patch:
(2+N+1) should be (2*N+1)

– Pasted Max Patch, click to expand. –

February 27, 2011 | 10:59 am

I couldn’t resist to also patch the gbuzz, which is easier to implement and more fun to use :)

happy buzzing,

– Pasted Max Patch, click to expand. –

February 27, 2011 | 6:52 pm

thanks mudang,
the second is great. I’m trying to realize a patch to choice the number of the components.
best


February 27, 2011 | 7:08 pm

hi mudang,
in your second patch i found there are strange components which grows up when
index is > 0.5. this is probably due to the division, because some zero is still present…
i will thinking about that.
thanks
fv


March 1, 2011 | 6:39 pm

The artifacts you mention, are probably aliasing or clipping.
The second patch ("gbuzz") isn’t band-limited and with high index values will also have a very high output amplitude.
The next step would be to implement a normalizing function, that keeps the amplitude in range.

There’s a good paper on discrete summation formulas by Moorer:

http://www.jamminpower.com/PDF/Sine%20Summation.pdf

it doesn’t deal with the division by zero problem, though…


March 2, 2011 | 11:25 am

Thanks for the paper,
In regard the second patch unfortunately it’s not an aliasing problem…
The second patch works fine with an index < = 0.85, in this case the
amplitude response in the spectrum is something like y=x raised to a
power <2, and not strange frequencies are present.
Best
fv


March 4, 2011 | 10:19 am

here there is a patch in which cycle gives no "zeroes", but the problem is still there!!!!
i suppose the wrong spectral component depends on other problems….

{
"boxes" : [ {
"box" : {
"maxclass" : "comment",
"text" : "no zero!",
"linecount" : 2,
"numinlets" : 1,
"numoutlets" : 0,
"fontname" : "Arial",
"patching_rect" : [ 259.0, 344.0, 64.0, 43.0 ],
"id" : "obj-17",
"fontsize" : 16.0
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "print",
"numinlets" : 1,
"numoutlets" : 0,
"fontname" : "Arial",
"patching_rect" : [ 218.0, 354.0, 42.0, 25.0 ],
"id" : "obj-11",
"fontsize" : 16.0
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "if $f1 != 0 then $f1 else 0.001",
"numinlets" : 1,
"numoutlets" : 1,
"fontname" : "Arial",
"outlettype" : [ "" ],
"patching_rect" : [ 111.0, 251.0, 217.0, 25.0 ],
"id" : "obj-9",
"fontsize" : 16.0
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "expr sin(6.2831*$f1)",
"numinlets" : 1,
"numoutlets" : 1,
"fontname" : "Arial",
"outlettype" : [ "" ],
"patching_rect" : [ 111.0, 203.5, 173.0, 27.0 ],
"id" : "obj-59",
"fontsize" : 18.0
}

}
, {
"box" : {
"maxclass" : "button",
"numinlets" : 1,
"numoutlets" : 1,
"outlettype" : [ "bang" ],
"patching_rect" : [ 60.0, 27.0, 31.0, 31.0 ],
"id" : "obj-61"
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "/ 513.",
"numinlets" : 2,
"numoutlets" : 1,
"fontname" : "Arial",
"outlettype" : [ "float" ],
"patching_rect" : [ 109.0, 146.5, 56.0, 27.0 ],
"id" : "obj-63",
"fontsize" : 18.0
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "uzi 513 0",
"numinlets" : 2,
"numoutlets" : 3,
"fontname" : "Arial",
"outlettype" : [ "bang", "bang", "int" ],
"patching_rect" : [ 60.0, 73.0, 84.0, 27.0 ],
"id" : "obj-64",
"fontsize" : 18.0
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "t i i",
"numinlets" : 1,
"numoutlets" : 2,
"fontname" : "Arial",
"outlettype" : [ "int", "int" ],
"patching_rect" : [ 61.0, 110.5, 58.0, 27.0 ],
"id" : "obj-65",
"fontsize" : 18.0
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "buffer~ tab2 11.6326",
"numinlets" : 1,
"numoutlets" : 2,
"fontname" : "Arial",
"outlettype" : [ "float", "bang" ],
"patching_rect" : [ 34.0, 411.0, 175.0, 27.0 ],
"id" : "obj-66",
"fontsize" : 18.0
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "peek~ tab2",
"numinlets" : 3,
"numoutlets" : 1,
"fontname" : "Arial",
"outlettype" : [ "float" ],
"patching_rect" : [ 64.0, 352.5, 100.0, 27.0 ],
"id" : "obj-67",
"fontsize" : 18.0
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "-~ 1.",
"numinlets" : 2,
"numoutlets" : 1,
"fontname" : "Arial",
"outlettype" : [ "signal" ],
"patching_rect" : [ 413.0, 533.0, 43.0, 25.0 ],
"id" : "obj-24",
"fontsize" : 16.0
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "loadmess 0.75",
"numinlets" : 1,
"numoutlets" : 1,
"fontname" : "Arial",
"outlettype" : [ "" ],
"patching_rect" : [ 797.0, 276.0, 115.0, 25.0 ],
"id" : "obj-18",
"fontsize" : 16.0
}

}
, {
"box" : {
"maxclass" : "spectroscope~",
"numinlets" : 2,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 659.0, 756.0, 300.0, 100.0 ],
"id" : "obj-16"
}

}
, {
"box" : {
"maxclass" : "ezdac~",
"numinlets" : 2,
"numoutlets" : 0,
"patching_rect" : [ 489.0, 803.0, 45.0, 45.0 ],
"id" : "obj-15"
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "*~",
"numinlets" : 2,
"numoutlets" : 1,
"fontname" : "Arial",
"outlettype" : [ "signal" ],
"patching_rect" : [ 467.0, 678.0, 32.5, 25.0 ],
"id" : "obj-14",
"fontsize" : 16.0
}

}
, {
"box" : {
"maxclass" : "flonum",
"numinlets" : 1,
"numoutlets" : 2,
"fontname" : "Arial",
"outlettype" : [ "float", "bang" ],
"patching_rect" : [ 535.0, 581.0, 75.0, 25.0 ],
"id" : "obj-13",
"fontsize" : 16.0
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "expr $f1/(2*$f2)",
"numinlets" : 2,
"numoutlets" : 1,
"fontname" : "Arial",
"outlettype" : [ "" ],
"patching_rect" : [ 534.0, 610.0, 121.0, 25.0 ],
"id" : "obj-12",
"fontsize" : 16.0
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "/~",
"numinlets" : 2,
"numoutlets" : 1,
"fontname" : "Arial",
"outlettype" : [ "signal" ],
"patching_rect" : [ 414.0, 488.0, 32.5, 25.0 ],
"id" : "obj-10",
"fontsize" : 16.0
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "expr $f1/2.",
"numinlets" : 1,
"numoutlets" : 1,
"fontname" : "Arial",
"outlettype" : [ "" ],
"patching_rect" : [ 693.0, 276.0, 86.0, 25.0 ],
"id" : "obj-8",
"fontsize" : 16.0
}

}
, {
"box" : {
"maxclass" : "button",
"numinlets" : 1,
"numoutlets" : 1,
"outlettype" : [ "bang" ],
"patching_rect" : [ 406.0, 62.0, 20.0, 20.0 ],
"id" : "obj-7"
}

}
, {
"box" : {
"maxclass" : "number",
"numinlets" : 1,
"numoutlets" : 2,
"fontname" : "Arial",
"outlettype" : [ "int", "bang" ],
"patching_rect" : [ 555.0, 77.0, 83.0, 25.0 ],
"id" : "obj-6",
"fontsize" : 16.0
}

}
, {
"box" : {
"maxclass" : "number",
"numinlets" : 1,
"numoutlets" : 2,
"fontname" : "Arial",
"outlettype" : [ "int", "bang" ],
"patching_rect" : [ 406.0, 97.0, 83.0, 25.0 ],
"id" : "obj-5",
"fontsize" : 16.0
}

}
, {
"box" : {
"maxclass" : "flonum",
"numinlets" : 1,
"numoutlets" : 2,
"fontname" : "Arial",
"outlettype" : [ "float", "bang" ],
"patching_rect" : [ 406.0, 194.0, 129.0, 25.0 ],
"id" : "obj-4",
"fontsize" : 16.0
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "expr $f1*(2.*$f2+1.)/2.",
"numinlets" : 2,
"numoutlets" : 1,
"fontname" : "Arial",
"outlettype" : [ "" ],
"patching_rect" : [ 407.0, 149.0, 167.0, 25.0 ],
"id" : "obj-3",
"fontsize" : 16.0
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "cycle~ tab2",
"numinlets" : 2,
"numoutlets" : 1,
"fontname" : "Arial",
"outlettype" : [ "signal" ],
"patching_rect" : [ 693.0, 340.0, 92.0, 25.0 ],
"id" : "obj-2",
"fontsize" : 16.0
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "cycle~ tab2",
"numinlets" : 2,
"numoutlets" : 1,
"fontname" : "Arial",
"outlettype" : [ "signal" ],
"patching_rect" : [ 406.0, 340.0, 92.0, 25.0 ],
"id" : "obj-1",
"fontsize" : 16.0
}

}
],
"lines" : [ {
"patchline" : {
"source" : [ "obj-9", 0 ],
"destination" : [ "obj-67", 1 ],
"hidden" : 0,
"midpoints" : [ ]
}

}
, {
"patchline" : {
"source" : [ "obj-9", 0 ],
"destination" : [ "obj-11", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

}
, {
"patchline" : {
"source" : [ "obj-8", 0 ],
"destination" : [ "obj-2", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

}
, {
"patchline" : {
"source" : [ "obj-7", 0 ],
"destination" : [ "obj-5", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

}
, {
"patchline" : {
"source" : [ "obj-65", 0 ],
"destination" : [ "obj-67", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

}
, {
"patchline" : {
"source" : [ "obj-65", 1 ],
"destination" : [ "obj-63", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

}
, {
"patchline" : {
"source" : [ "obj-64", 2 ],
"destination" : [ "obj-65", 0 ],
"hidden" : 0,
"midpoints" : [ 134.5, 107.0, 70.5, 107.0 ]
}

}
, {
"patchline" : {
"source" : [ "obj-63", 0 ],
"destination" : [ "obj-59", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

}
, {
"patchline" : {
"source" : [ "obj-61", 0 ],
"destination" : [ "obj-64", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

}
, {
"patchline" : {
"source" : [ "obj-6", 0 ],
"destination" : [ "obj-7", 0 ],
"hidden" : 0,
"midpoints" : [ 564.5, 124.0, 501.0, 124.0, 501.0, 58.0, 415.5, 58.0 ]
}

}
, {
"patchline" : {
"source" : [ "obj-6", 0 ],
"destination" : [ "obj-3", 1 ],
"hidden" : 0,
"midpoints" : [ ]
}

}
, {
"patchline" : {
"source" : [ "obj-6", 0 ],
"destination" : [ "obj-12", 1 ],
"hidden" : 0,
"midpoints" : [ 564.5, 135.0, 574.0, 135.0, 574.0, 261.0, 645.5, 261.0 ]
}

}
, {
"patchline" : {
"source" : [ "obj-59", 0 ],
"destination" : [ "obj-9", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

}
, {
"patchline" : {
"source" : [ "obj-5", 0 ],
"destination" : [ "obj-8", 0 ],
"hidden" : 0,
"midpoints" : [ 415.5, 135.0, 702.5, 135.0 ]
}

}
, {
"patchline" : {
"source" : [ "obj-5", 0 ],
"destination" : [ "obj-3", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

}
, {
"patchline" : {
"source" : [ "obj-4", 0 ],
"destination" : [ "obj-1", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

}
, {
"patchline" : {
"source" : [ "obj-3", 0 ],
"destination" : [ "obj-4", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

}
, {
"patchline" : {
"source" : [ "obj-24", 0 ],
"destination" : [ "obj-14", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

}
, {
"patchline" : {
"source" : [ "obj-2", 0 ],
"destination" : [ "obj-10", 1 ],
"hidden" : 0,
"midpoints" : [ ]
}

}
, {
"patchline" : {
"source" : [ "obj-18", 0 ],
"destination" : [ "obj-2", 1 ],
"hidden" : 0,
"midpoints" : [ 806.5, 327.0, 775.5, 327.0 ]
}

}
, {
"patchline" : {
"source" : [ "obj-18", 0 ],
"destination" : [ "obj-1", 1 ],
"hidden" : 0,
"midpoints" : [ 806.5, 327.0, 488.5, 327.0 ]
}

}
, {
"patchline" : {
"source" : [ "obj-14", 0 ],
"destination" : [ "obj-16", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

}
, {
"patchline" : {
"source" : [ "obj-14", 0 ],
"destination" : [ "obj-15", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

}
, {
"patchline" : {
"source" : [ "obj-14", 0 ],
"destination" : [ "obj-15", 1 ],
"hidden" : 0,
"midpoints" : [ ]
}

}
, {
"patchline" : {
"source" : [ "obj-13", 0 ],
"destination" : [ "obj-12", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

}
, {
"patchline" : {
"source" : [ "obj-12", 0 ],
"destination" : [ "obj-14", 1 ],
"hidden" : 0,
"midpoints" : [ 543.5, 665.0, 490.0, 665.0 ]
}

}
, {
"patchline" : {
"source" : [ "obj-10", 0 ],
"destination" : [ "obj-24", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

}
, {
"patchline" : {
"source" : [ "obj-1", 0 ],
"destination" : [ "obj-10", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

}
]
}


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