Square wave , how come no distortion?
I have been going through Fundamentals tutorial 5 patch,
If a phasor (receiving a 440 freq) is ramping from 0 to 1, and that signal is sent to the object <0.5~ so that anything below 0.5, the objects sends 1, and anything above 0.5 the object sends 0....
then that signal is sent
well how is there not distortion due to the abrupt changes between the wave 0 and 1?? Because in all the other tutorials, it has explained how line~ must be used to prevent distortion from these abrupt changes…. or is this dealt with when the wave reaches the line section before the dac~
If someone could clarify this with me, that would be fantastic.
it seems you are getting 2 separate concepts mixed up:
1. with line~, the tutorials refer to changes in volume (amplitude). an abrupt change in volume results in a pop / click, which is "usually" undesirable.
2. with a square wave oscillator, the signal "oscillates" from 1 to -1. above the frequency of ~20hz, this tone becomes audible to the human ear as a perceivable pitch rich in overtones (harmonics above the fundamental pitch). below ~20hz it becomes a regular clicking sound with no perceivable pitch.
without delving further into synthesis, its tricky to explain this briefly… this wikipedia entry should help explain the waveforms: http://en.wikipedia.org/wiki/Waveform
right i see where your coming from, although it doesnt say the phasor is ramping from -1 to 1, it says 0 to 1….
I kinda of am almost understanding it, i think i have been sat here for too long though and have confused myself even more. Im definately getting mixed up between oscillating and amplitude…
infact, what you have said still hasnt answered my question i dont think, as what you have said i already know…
On Aug 21, 2008, at 10:36 AM, Natasha wrote:
> I kinda of am almost understanding it, i think i have been sat here
> for too long though and have confused myself even more. Im
> definately getting mixed up between oscillating and amplitude…
To confuse you even more: oscillating and periodic amplitude changes
are the same thing.
I think where you might be going wrong is that in the case of wanting
to change the amplitude of existing material, any click is annoying,
whereas in something like a square wave, the click-train of the abrupt
amplitude change _is_ the sound.
it’s because those ‘undesirable’ clicks are happening so fast that you hear them as one constant pitch.
right ok, thankyou, i think thats what i was hoping to hear… i kind of sat here knowing that the answer was along those lines, but i still kept asking that same question of how there would be a click through abrupt amplitude change. Sometimes its obviously not worth thinking too much about it!!
You were referring to line~ being "used to prevent distortion from …abrupt changes…". The word, "distortion" here is probably not the right word. Line~ is used to take care of "clicks and pops" in abrupt amplitude changes in those cases(distortion refers to some way in which the original shape of a waveform is modified by some process and one type of distortion is "clipping" which can be due to having an amplitude that is greater than 1(or less than -1) causing the waveform to "clip" at the top and bottom because a signal cannot go beyond that range in digital audio… normally…).
You probably already know this but just clearing it up before I go on(and before I do, let me just also say that english is pretty horrible for trying to express anything so be patient with me since I might not even know how to say what I’m trying to explain)…
Phasor is running at 440 going between 0 and 1(continuous ramp from 0 to 1 but then a sudden drop from 1 to 0(in fact, your question could also be applied to phasor~ -> "why isn’t line~ used to thin the sudden drop between 1 and 0 in a phasor~?" it isn’t because the "click" or "pop" in this waveform is desirable for what a phasor~’s waveform(saw-tooth waveform) needs to do).
It then is passed through < 0.5~ so now it is a square wave(0, 1, 0, 1, etc.; no continuous ramps, just sudden drops and spikes(square-wave refers more to the shape of the waveform so it doesn't necessarily need to be -1 to 1, it can also be 0 to 1 so long as the changes are abrupt to keep the shape of "squares")).
In a square wave, it could be said(not completely technical but still could be argued) that you are hearing clicks and pops(in fact, you could also say you are hearing half as many clicks and pops in a phasor~ as well) but that they are happening so fast that they are perceived as a tone. These clicks and pops are always uniform sounding because they occur as the same exact waveform with every appearance(0 to 1 suddenly, 1 to 0 suddenly). Because these clicks and pops in a square wave are uniform and appear at a regular rate, they become the regular tone of a square wave. All in all, you ARE hearing the clicks and pops but they are mathematically uniform so they sound like a nice square wave.
Line~ is normally used in amplitude-changing cases to turn a signal on and then off. You don’t normally use line~ at a high-frequency of on/off since there are other ways to shape the waveform with smooth ramps. If a phasor~ is running at 440, and your line~ is set to ramp from 0 to 1 within one second, phasor~ will already have gone from 0 to 1 440 times before line~ helps its loudness to grow to full volume of 1. This means, while line~ is working, phasor~ is going from 0 to something less than 1 increasing its maximum towards 1 as line~ works its magic(i.e. ramping from 0 to say, 0.05, then from 0 to 0.07, hypothetically speaking since english isn’t good for explaining the work of samples running 44100 times per second).
I know I haven’t done a great job explaining it, but if you read it over and look at the patch below, it might make more sense:
----------begin_max5_patcher---------- 1237.3oc4YssiiZCF95jmBKtoGTRDFaNUMpR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bc1i6BiCyNZgiu9PX36CiiCeAPBDKJ79HWBzQ3F2wPMvv5i c4ebtw8chad3Yf8BWSnEyxAgftcBmbp5Ct5VLzuFSh58pdN8VKBo0A2lmm0M wb41BqOUornKib8MaezUmrzQYW6Gbk1GUSmphfWcSvJHoKWqKeUxpJhZT5l6 sUTqUCphok7jbh7n5cFj7jifWf9lj3XZd26KKKIdKSTFcMHfZk2ApRM54E7V InsJXnqmv6pVB74d2yGpl.2Ci8qH3ySOPdPE5b0WrlCtU5FfUY8HFAVUtWTX PqzM.rhHj.mgi0QhHkQ6I4uybyFhTLlCT4w54qKgYOo56TE6pYZ6fwystCPS dk5dsYWYsNmFS92gXZuPYWcHELP+B7vgDNLTYYoKJBibakFIXwCwgI3LC3TG OLPmf22Seb48jz+6XZTKuwqHuJUzAzjarwo+PY2yv5rIynqJqoKzqU5VDxw0 nXmPecU7A9sRiDrCAquJ1v0d2FOP56FFIxYfPBc6fDZnU3bFzTSdWsKAF5dw bIFT3Qz8YFuaHjfC0azTaegv2m9u.6cUC5A -----------end_max5_patcher-----------
If not, I’d also recommend picking up a copy of Computer Music Tutorial by Curtis Roads or even Computer Music by Charles Dodge.
Hope it helps, though.
never mind what i wrote, hahaha, you’ve got it.
Thanks for your response!!
See it wasn’t the phasor ramping that ‘worried’ me, it was the 0 0 0 0 0 and 1 1 1 1 1 coming from the < ~0.5
I was thinking, well how can this work so nicely without clicks…. but you guys have been great in clarifying this so thanks.
Sorry to be so tedious about this, it was just something i needed to get my head round.
Quote: Natasha Roberts wrote on Thu, 21 August 2008 21:57
> Thanks for your response!!
> See it wasn’t the phasor ramping that ‘worried’ me, it was the 0 0 0 0 0 and 1 1 1 1 1 coming from the < ~0.5
> I was thinking, well how can this work so nicely without clicks….
It’s "clicking" multiple times per second and that is its "sound", in this case.
Chris Muir explained it very nicely.
Because you generate the sound through this means, you would consider this its sound – the result of the method you’ve chosen. If I would be synthesizing a sine wave, and overloading/overdriving the dac or medium at some point, I’d get a similar spectrum (becuase of the waveform being squared off), but in that case I would call it distortion. Because the resulting sound was not caused by the method I’ve chosen, but because of the waveform resulting from my synthesis being distorted at some point in the signal chain.
Forums > MaxMSP