Forums > MaxMSP

How to peek~ a sinewave into buffer~ for waveshaping

October 7, 2010 | 1:43 pm

Hi,

I suck at math, so an easy solution where I understand what is going on would be great. Im using uzi to pack an index number together with 0 – 511 "converted" to a sine wave for the lookup~. If I use some math object? (cos?) for the values (the second integer in the list)

edit: scaling 0 511 to 0.1 made a sinewave in the buffer~, but I dont have a clue whats going on really…



TFF
January 18, 2011 | 10:03 pm

Bumping this old thread because this is the exact issue I’m dealing with now. Can anyone provide some insight into this?


January 18, 2011 | 11:07 pm

I can provide the patch, but I cant explain why I use 3210 samples, because I dont remember

– Pasted Max Patch, click to expand. –


TFF
January 18, 2011 | 11:34 pm

Thanks for the patch. I’d really like a clearer tutorial for this though (with an explanation of how/why the method works), if anyone would be so kind as to provide one.


January 19, 2011 | 12:35 am

this patch will make it a bit clearer.
the [sin] object works with radians, so you need to give it values from 0 to 2*PI (6.283) to get one period of a sinewave.

[uzi]‘s count will start from 1. So you subtract 1 and divide by the number of samples in the buffer.
Note, that this will give you a range from 0 to 0.9999, not reaching 1.
This is fine, because you don’t want _both_ the first and last sample in the buffer to be 0.

Then simply multiply by 2*PI and you’re done.

– Pasted Max Patch, click to expand. –


TFF
January 19, 2011 | 2:43 am

Excellent, thank you.


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