triangle wave problems

Peter Nyboer's icon

i'm trying to create a triangle waveform from a phasor~ - like cycle~ (i have a ramp buffer that cycle~ refers to). I won't get into why I'm using cycle~ instead of phasor~...BUT, I'm getting a strange discontinuity that I can't figure out. This patch demonstrates the problem (XP). Why does does the cycle~-based version behave differently????

Peter.

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

flies's icon

just checking, but is there a reason that the triangle~ and tri~ objects
don't work for you?

Peter Nyboer's icon

i'll be damned! I didn't know triangle~ existed. Thanks for that. tri~ doesn't "work" for me because it's anti-aliased. I'm still curious why the above doesn't work right, though.

Peter Castine's icon

On 28-Apr-2006, at 21:39, pnyboer wrote:
> BUT, I'm getting a strange discontinuity that I can't figure out.

Going back to The Book:

>> The cycle~ object is an interpolating oscillator that reads
>> repeatedly through one cycle of a
>> waveform, using a wavetable of 512 samples. Its default waveform
>> is one cycle of a cosine
>> wave. It can use other waveforms by accessing samples from a
>> buffer~ object. The 513th
>> sample in the wavetable source (the buffer~) is used for
>> interpolation beyond the 512th
>> sample.

That last sentence is, I think, what's killing you. Try defining that
513th sample at loadbang time.

-- P.

-------------- http://www.bek.no/~pcastine/Litter/ -------------
Peter Castine +---> Litter Power & Litter Bundle for Jitter
Heavy-Duty Mathematics for Everyday Use
iCE: Sequencing, Recording &
Interface Building for |home | chez nous|
Max/MSP Extremely cool |bei uns | i nostri|
http://www.dspaudio.com/ http://www.castine.de

Peter Nyboer's icon

hmmm...ok, that 513th doesn't really do it either. here's a patch that demonstrates the problem I'm having. Theoretically, the cycle~ phasr should be the same as phasor~. Practically, it's not:

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

projects's icon

At 44.1kHz 11.61 milliseconds makes a buffer~ with 512 samples. You
want a buffer~ with 513 samples.

Ben

Peter Nyboer's icon

hmmm...right. but I still the clicks if I change the buffer size to 11.63265. Did changing this fix the problem for you, or is it just an observation of me being absent minded? :)

p.

volker böhm's icon

hi,
this works for me.
cheers,
volker.

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

Peter Nyboer's icon

thanks! works here too.