Forums > MaxMSP

sinesum function a la PureData

January 9, 2010 | 6:00 pm

hi

is there any way to add sinewaves together and write them into an array (buffer) in msp, like in puredata? (explanation here — http://en.flossmanuals.net/PureData/GeneratingWaveforms)

i was surprised i couldn’t find anything similar in max/msp! i’m using v.4..

any help would be greatly appreciated
thank you
.klive


January 9, 2010 | 11:02 pm

My "Sine Wave Explorer" project I did awhile back does just this, plus some other goodies. Look for it a ways down on this page:

http://www.third-space-mind.com/max/max_main.htm

Max 5 only though, sorry…

No doubt there are many many ways to do add sines, but uzi–> peek~ certainly works if you’re making the sines with math expressions, and seems very fast. But if you want to just grab what’s coming out of some cycle~ objects (like if you’ve got some cool modulations going on), look to poke~, count~, etc. to sample and write-to-buffer~.

You’ll need to experiment with the timing of when you start and stop your sampling, and choose the exact buffer~ size beforehand. sampstoms~ will help here, since you specify the buffer~ size in msec and you’ll want exact control over the number of samples.


January 10, 2010 | 12:46 am

Sorry, again Max 5, but here’s a patch that is equivalent to the sumsine message.

– Pasted Max Patch, click to expand. –

June 27, 2011 | 5:13 am

Hey Chris,

Thanks for your sinesum patcher. I've been playing around with it and comparing the output to the sinesum message in Pd. I was never great at math–I'm a drummer, you know–so I'm not completely clear on the formula. However, sometimes, when I put the exact same values into your patcher and into Pd, I get different results, and at other times, they are identical. I'm attaching a couple of screen grabs that illustrate what I mean. The Example1 one is with the numbers you use in your example above (512 0.25 0 0.25 0). Example2 is with (512 1 1 1 1 1 1 1)–it has been normalized in both versions of Example2. As you see, the second examples look identical, but the first examples look quite different. Quite honestly, I have no idea which one is correct. Can you help me understand a bit better how this works? Thanks so much.

-Brian

[attachment=165186,2394] [attachment=165186,2395]

Attachments:
  1. Example2.png

June 27, 2011 | 9:17 am

Nevermind, I found the problem. The [bondo] object was carrying over previous values from each pass. That’s why the (512 1 1 1 1 1 1 1) worked, because all the values were the same. I took bondo out and it works perfectly! Again, thanks for your work on that, it was really educational for me.


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