msp automatically ramping signals? explain the neccessity of this nonsense

Jan 28, 2012 at 12:42am

msp automatically ramping signals? explain the neccessity of this nonsense

ok. ive spent 2 days trying to figure out how to read back wavetables with another waveform.
i used a buffer to hold 1 second at 1hz sine wave. then i used a saw~ wave to read through it and play it back. but there was clicking. after finding out that the saw wave obviously wasnt true. i used phasor, phasor worked. i then want to use a user-definable wave (one that i draw) to read back the wave. i use phasor -> wave -> lookup -> dac, but when i read it back, it clicks aaaagain at the end of each cycle.
if i send the phasor -> wave, directly out to dac, then there is no clicking, but if i send it like phasor -> wave -> lookup -> dac, it clicks because it does some stupid ramping to smooth transitions.
this seems totally needless and has wasted 2 of my days. so anyone with some knowledge on the issue could youplease explain to me why this is like this and if there is a way to change it in some settings somewhere.

#61487
Jan 28, 2012 at 6:35pm

“phasor -> wave -> lookup -> dac”

i don’t know, i think it shouldn’t click. have you got a linear function in your lookup-Buffer?
Best is to post your patch(and sample youre using for distortion in lookup if neccessary)

(btw. max msp is working fine for a lot of people, so erm writing “nonsense wasting days of my life” isn’t the best way to get help i guess..)

#221862
Jan 28, 2012 at 7:22pm

there is an alternative way which goes by samples: index~and play~

p.s. are you sure the click isnt eventually occuring because of the audio content you are using?

#221863
Jan 28, 2012 at 9:05pm

first off, my apologies to woyteg and others. i was just extremely frustrated.
anyway. i spent a solid few hours of my day sending it back and forth to an e-friend who has done a bunch of schooling in max/msp and we both came to the same conclusion.
here is the patch.

you will have to turn on the dac and then record the 1 second of the sine wave in to the buffer because its not doing it with loadbang anymore.
then draw a ramp wave or whatever on the waveform~ and watch the clicks.
if you use the little phasor i labelled above it to readback the waveform instead. you get no clicking.
i have a feeling this has to do with some kind of automatic smoothing that max does on certain objects.

#221864
Jan 28, 2012 at 11:10pm

Why so much effort to play back a sine wave? Also, saw~ is anti-aliased. It’s good as a synthesis waveform, but no really intended for use as a control signal.

Try sending the message “fill sin 1″ to your buffer, if your using Max 6.

I think you’re hearing a lack of smoothing. In one case, you’re drawing a ramp into a 360 pixel waveform and playing it back at 12 Hertz. In the other case, you’re playing back with a phasor at 113 Hertz. I don’t think you’re going to be able to draw a click-free ramp in a small waveform object.

#221865
Jan 29, 2012 at 12:42am

the ramp doesnt click. look at the oscilloscope hooked up to it.

the ramp is being played back at 12 hz in order for you to see the clicks visually on the one oscilloscope. if you use the phasor to control it, turn it down to 12 hz too and notice there is no clicking.

it is only clicking when i use the generated waveform to control the lookup~, and it clicks at the end of every cycle, making me believe there is some kind of smoothing happening like with the saw~ wave.
with saw~, it doesnt go from +1, to -1 immediately at the next sample, it ramps downward very quickly over a few samples. if i am using this to read back a waveform, its going to play it from sample 0 to sample 44100, then right at the end its going to play it from sample 44100 to sample 0 very quickly.

#221866
Jan 29, 2012 at 12:45am

and the reason i want to read back a sine wave is because if it doesnt click, i can use the user-defined waveform to read the sine wave back in fucked up ways.
and i can also use not just a sine wave to read back in odd ways also.

refer to page 42.

http://crca.ucsd.edu/~msp/techniques/v0.11/book.pdf

this is what i am trying to do.

#221867
Jan 29, 2012 at 5:02am

I think you might be running into trouble because of your < vzoom 1000 > you are sending to lookup~. If you use values between -1 and 1 you might have better luck (I’m really not sure what the behavior of lookup~ is supposed to be if you go beyond -1 or 1).

In Miller’s book, he would just use tabread4~ which is like index~ (which Roman suggested) in that it takes input as a sample index. The difference is tabread4~ has 4-point interpolation and index~ does not if I remember correctly (so you guessed right for that reason you may be better off with lookup~ which does do some sort of interpolation—I think). Vinilla Pd doesn’t have all the buffer playback objects that Max has, so you just use tabread4~ and scale as you need or tabosc4~ if you want a basic wavetable oscillator.

Personally, I recommend downloading Pd if you are learning with Miller’s book. There is a lot of info in there and no need to confuse yourself translating it to Max as you are learning (I started my journy to Max with Miller’s build of Pd and his book). This examples certainly can be adapted to Max and I have done so for some of the classes I’ve taught, but why not Pd for learning with that book, it is nice too.

it doesnt go from +1, to -1 immediately at the next sample, it ramps downward very quickly over a few samples

Are you determining it is ramping down from looking at it in scope~? This could be misleading. Attach click~ to scope~ to see what I mean. If you want to know exactly what is happening on a per sample basis, I I usually record into a buffer and use peek~ to investigate sample values. Or you could save a sound file and look at it in some editor like Peak or Audacity. Maybe zooming in with waveform~ but I’ve never tried zooming in that far so I can’t say that works from experience—seems like it should work though.

#221868
Jan 29, 2012 at 8:59am

did you try sending “interp 1″ or “interp 2″ to [wave~]?

#221869
Jan 29, 2012 at 10:38am

you might find it easier, when going through that book, just to directly port the pd patches to max. in this instance you just need examples B01 – B06 from the pd browser. then just start developing those.

i am finding it hard to understand what you are up to, sorry.

sadly, there are big problems in MSP with [wave~] and [lookup~] – they do low quality linear interpolation on output only, whereas in pd those examples use [tabosc4~] which is 4-point interp. although example B04 demonstrates problems with that, too, at the wraparound point, which i think is your problem here?

are you on max 6? if so, use the advice of mzed. also, let me know, as i can post a gen~ patch which in 5 objects (4 of them inlets and outlet) gets an interpolated wave of any type which is better sounding by far.

however, it won’t fix discontinuities caused by wraparound points in hand drawn buffers.

maybe i misunderstand you, sorry. good luck.

#221870
Jan 29, 2012 at 1:07pm

>as i can post a gen~ patch which in 5 objects (4 of them inlets and outlet) gets an interpolated wave of any type which is better sounding by far.

yes please, pid :)

#221871
Jan 29, 2012 at 4:28pm

These two days have not been wasted; they can be considered an investment in mastering max. Many here will recognize this frustration.

First of all, reading out a sine wave can be simplified using the phase input of a cycle~ object. You need to map the -1 to 1 range to 0-1.

The clicking has to do with the way wave~ interpolates. When it wraps from end to begin, it will interpolate the jump from 1 to -1 by smearing it out over a few samples. This translates reading from end to begin of the lookup table on a very high rate. Rather then clicking, it is a short burst of high frequency content.

It is not a bad idea to record certain parts of your patch to a sound file so that you can better see what happens from sample to sample. An application like audacity shows quite clearly the values when you zoom in fare enough.

It was already proposed a number of times as a feature request to make the interpolation upon wrap an attribute. It has so far not been implemented. That doesn’t mean you’re stuck. Groove~ does wrap without interpolation, so that is a good replacement. The only thing you need to do is to convert frequency to speed given a certain buffer length.

– Pasted Max Patch, click to expand. –
#221872
Jan 29, 2012 at 7:46pm

jvkr saves the day as usual…

@wetterberg, this is so simple it is slightly embarrassing for us all i guess:

– Pasted Max Patch, click to expand. –

… i have Gen, so it is there, so i use it. i cannot imagine why i will ever use the [wave~] object ever again in my Max-life. it is a huge huge shame that cycling have not updated the MSP play~ and wave~ and lookup~ objects for use in normal MSP, but seeing as they have not, i just will not use them. the changes in Max6 to [groove~] however are awesome and appreciated.

#221873

You must be logged in to reply to this topic.