sinesum function a la PureData
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
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:
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.
Sorry, again Max 5, but here’s a patch that is equivalent to the sumsine message.
----------begin_max5_patcher---------- 1012.3ocyY0zbZCCE7L7qPiGNjlRcr9z18VO0a8VOkISGCHRTiQlAaRSSlze 60RxDfDriv1ngKnQxBypU668VIdd3.uIYOxy8.eEbMXvfmGNXfdH0.Cp5Ova QxiSSSx0SyaZ1hEbYg2XyyJ3OVnGOW7DGjxefmdcfuu+OtYyLjqWjstHkWn+ 9AUiNOSVn9JpwfH+MCKloeYYS98WHgd6LWYxB8b891JQR5lmrLoX5cB4s+ZE eZgYUPfgkuM.LfnanApFT4mfa1BHgbCdfpwdY3P0GisjBVvyyStk+NJXD7vq YXyqYyLK96RtYE348JT2kNXshNnHpg.vpFLxmVRJQ0wFnVvFR9eJw26HimRA 4ohobPMjB5XIkw0QLzVQLXJRKPXQpFZXyxDTOJSTqVgLOYwxbvoUxPZmjIvH Yn5HnXsvwIRlBvDv79QsLIQdqRwLOMKo3fjCNtcxFllbvLx13o9M6RMjyOeR .nPzgoGbKomMsBYMjzgS57ctj+PRCrTjgcv5juTlVNg6SEzj0EEYxlicN7p9 fKyvObsfheMCgi1v+LHvueRNzPP.tUAAPDTQCDFzlffdLCwRN+9+Alrd9ImX ZWpSDwPLwZMiIGQ8DCtGIlr64MPL165BSaWD+FIQTrpILn4P9dbkyeb4Jvn4 nKyExKP9Wh8gDHIFwnXF3xxm.u5hQyIWMRf+zmNgEawvNQb3XcVRBB2LyQ50 xs8CeTed0fVZg2TwHP6PCQbmC9SoaLDtKmmAYNHiCMvOMasrfu5vLB4HYDkA iwUl3avuApcocwwFxwbHmPbyBFZ+wQhZIn9QxP6BcTIYPgtK9ozfZoqEDEDT 0bJIGVKimzF3gnncul.WDPMISNK6DeXXDpSmpAaJBQb2ggmlxSNkgPvVdKRL 1NmAFG5NQx54y4qzV4JOHd+nVL1bG2PgZTWHopztQT6yynmgWpP916dT+qnF eelKOa8poaVNa1VAa+glwyKDxjBQ4YB2NIzdy4NwrYb4ttgWHlsLqrTTEF.2 bvsQagjp99GCoxBb.j6vD0VL4NdBaCOgotESDavjB3P6wjp9aoYMp4NCfwgk UDeWWBUa+GZx4p6000hMgFpK1wk7KaOYeC64vyLL41XC6hWOx7Z33X8EzDZx VGRdsWWQKwVz5tc02PN0rqF6V0erMXJ7H2UM6i3Hi8dr9rx62CECqtAeZUmt RtLaVHAtkbCrQDhO+vD7H2vIHpdeDatnsvs85HZIjyOuT1HzHt0i.Y+xS0PS zyPdxs05IVgIG64DZq+tyMOQP2pmPVnw0XB41pmVgoivkANJxbq6l+6JF0Gx XLJqZHWDBngL97JrTqIaqYsxNuL7+yXXOwC -----------end_max5_patcher-----------
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.
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.
Forums > MaxMSP