How to peek~ a sinewave into buffer~ for waveshaping

flowdesigner's icon

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's icon

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

flowdesigner's icon
Max Patch
Copy patch and select New From Clipboard in Max.

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

TFF's icon

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.

mudang's icon

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.

Max Patch
Copy patch and select New From Clipboard in Max.

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

TFF's icon

Excellent, thank you.