Hi, I'm a total newbie on pd, and I was trying to compose a sine wave. But there's something I really confused about.
So why these two patches behave differently, like in opposite? (1)
I have read the help file but still cannot figure out the reason, besides, it's saying [osc~] used to compose cosine wave, then why use it for sine wave? I'm aware that sin wave and cosine wave are the same shape but different starting point, in that case, how does [osc~] here handle? (2)
Also, it seems like every time I run the patches, the outcome is different, why is that? (3)
My questions may be naive, but still thanks in advance.
-
osc~ presentation with or without arguments
-
@auaa If you just "put" an array without setting its size then it will be 100 samples wide.
For a 50Hz sine wave to do a complete cycle.... 0 to 1 to 0 to -1 to 0.... requires 882 samples at 44100 samples per second or 960 samples at 48000 (samplerate... samples per second / cycles per second).
So you just see a small part of the wave in your 100 sample window.
And they are different because which bit of the wave you see in the array depends on the point that the wave is at in its cycle when you bang [tabwrite~]You can make them the same by banging them at the same time and reseting their phase just before they write.....
David.
Also you can write a sine wave into the array using the [simesum( message.
15.array.pd
There isn't much help, but I remember there being more help in the "Pd Floss Manual" which you should find with a google search.
Here...... https://archive.flossmanuals.net/pure-data/list-of-objects/introduction.html
Or more specifically here.....https://archive.flossmanuals.net/pure-data/audio-tutorials/generating-waveforms.html -
@whale-av Thank you so much for such precise explanations! I have another question to ask (different topic tho), how can I control the program flow based on the value of a vradio object? That means if I got a value of 0, I will carry on some actions, if not, then different flow. I was trying to implement [expr] and [spigot] but did not really work out... Mostly I'm programming oop language, and I feel like I'm a dummy when doing pd...
-
@auaa Usually the [select] object will help.
so.... send the output of the radio into [select 0 1 2 3] ..... put as many numbers as the radio button will send.
Put a bang on each outlet and you will see that you get a bang on the outlet corresponding to the radio number [select] received.
You can then use that bang to make something happen.
David. -
@auaa [send] and [send~] are wires which we get to dynamically patch by way of their right inlet.
Edit: forgot that [send~]'s destination can not be set dynamically like its message rate counterpart, [catch~] and [throw~] accomplish this in the audio realm.
Edit: but you can set [recieve~]'s source with a [set( message. I need to brush up on my pd audio. -
@whale-av Thanks a lot! I had figured out the method, using the same as your suggested [select].
-
@oid I was using [send] but didnt think about using them that way, thanks for the suggestion.
-
@auaa Another method is to use [route]:
-
@ingox I'll definitely try it later, thanks