Forums > MaxMSP

### Phase of "cycle~" in "MSP Tutorial 4: Routing Signals"

May 07 2014 | 2:11 pm

I have 2 questions regarding the bottom-left part of the tutorial patch.

The document says the following:

Click on the message box in the lower-left part of the window, and notice how the beat frequency varies sinusoidally over the course of 10 seconds, from 0 Hz up to 8 Hz (as the frequency of Oscillator B approaches 1008 Hz), back to 0 Hz, back up to 8 Hz (as the frequency of Oscillator B approaches 992 Hz), and back to 0 Hz.

I am very confused why the message box has "0.75, 1.75" rather than "0, 1." The reason I thought of "0. 1." is because the phase length of one cycle~ is 1.0, and the starting point is 0.

Also in the same message box, I cannot understand why the last semicolon(";") is required. The message box does exactly the same thing without it, as there’s no following augment for that semicolon.

Masa

• This topic was modified 1 year by  Masa.
###### Attachments:
1. 04mRoutingSignals.maxpat
May 08 2014 | 12:19 pm

"notice how the beat frequency varies sinusoidally"

the internal wavetable of cycle~ is actually a cosine(it starts at 1, then falls to -1, before rising again to 1 in one cycle). in order to obtain a sine from a cosine(a sine starts at 0, then rises and falls above and below 0 before arriving at 0 again at its end), the phase values are shifted back by 1/4-wavetable-cycle(-0.25).
easier to see with a graph:
http://en.wikipedia.org/wiki/Sine_wave

^on that graph to the right in the link above, look at the horizontal axis running from 0 to 3π.
now look at the dotted blue wave shown in the graph, this is a cosine wave, and looking at it going from 0 to 2π, is one full cycle the same way cycle~ would output when controlled in phase from 0 to 1.
in order to get a sine wave from that dotted blue wave, you’d need to go backwards(in the negative π direction) on the blue by a 1/4 cycle of the entire wave. in terms of the max cycle~ object, it’s going backwards by 0.25(or add -0.25 to its running phase).
finally, since cycle~ runs in phase from 0. to 1., going backwards from 0. by -0.25, then wrapping within the range of 0. and 1. is the same as having a phase of 0.75.
(as for why a sine instead of a cosine in that tutorial, it just makes for a clearer demonstration, since the user will hear the frequencies as they are set in the UI as the start of the ramp, rather than having the ramp jump suddenly to the modulated sound)

"I cannot understand why the last semicolon(";") is required."

HA! i think that’s a typo. good catch ;)

May 14 2014 | 4:02 am

Hello, RAJA_THE_RESIDENT_ASSWIPE. Thank you very much for your help.

the internal wavetable of cycle~ is actually a cosine(it starts at 1, then falls to -1, before rising again to 1 in one cycle).

Aha, I didn’t notice that. That makes my understanding clear.

Your further explanation with the indicated graph was amazingly great to follow.
Now I understand why the argument of "0.75, 1.75" generate the phase from 0 to 0. I just did a little adjustment of changing it to "-0.25, 0.75" and heard the same result as you explained!

"I cannot understand why the last semicolon(";") is required."

HA! i think that’s a typo. good catch ;)

OK, thanks for making it clear. ;)

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

Forums > MaxMSP