I'm curious about the 'cos~' object.

iziq's icon

I'm curious about the 'cos~' object.
I don't quite understand why use a cos~ object and a phasor~ object together. (ex. Phase modulation)
The description of the cos~ object says that it yields a value multiplied by 2pi. As far as I know, 2pi is 360 degrees, so I didn't understand the point of multiplying it.

Additionally, I'm wondering if the result of calculating a number with the 'cos' object is different from calculating the cosine with a scientific calculator.

Secondly, does anyone know why I'm basically using a cosine waveform instead of a sine signal (this doesn't really matter, maybe it's because it's easier to start at the top or bottom in many ways than starting in the middle)?

Roman Thilenius's icon

the combination of phasor~ and cos~ is the precedent of an "tone oscillator":
you have a phase accumulator, which loops a ramp from 0 to 1 (or from 0 to 5 volts), and you have a function which transforms this phase into a certain shape, here a sine wave. (but it could be something else, for example [phasor~] into [=>~ 0.5] [*~ 2.] [-~ 1.] will give you a square waveform)

that the cos~ object performs cos(input)/2pi is for your convenience. you always want to have audio signals normalized to -1 - 1., so the usual range of cos() is too large.

a "normal" cos() function, which operates like the non-MSP [cos] object is also present in MSP, but it is called [cosx~]. i know that this naming scheme is questionable, but you will find that you need [cos~] far more often for digital audio.

it is not "easier" to start at zero. :) if you dont, it will click if a tone begins. so feel free to use sin~ for the creation of oscillators.

iziq's icon

I'm still a little confused, but this has been so, so, so helpful. I'm trying to find the information I need and studying, but I'm having a hard time figuring out what to do with the math and engineering part.

Still, I'm glad to know that there is an answer to everything, I just haven't found it.

Thank you so much for your help with my questions from yesterday. I will come back to this topic from time to time to get help.