Square wave , how come no distortion?
Aug 21, 2008 at 2:55pm
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....
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.
Aug 21, 2008 at 5:23pm
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
Aug 21, 2008 at 5:30pm
right i see where your coming from, although it doesnt say the phasor is ramping from -1 to 1, it says 0 to 1….
Aug 21, 2008 at 5:36pm
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…
Aug 21, 2008 at 5:47pm
infact, what you have said still hasnt answered my question i dont think, as what you have said i already know…
Aug 21, 2008 at 6:32pm
On Aug 21, 2008, at 10:36 AM, Natasha wrote:
To confuse you even more: oscillating and periodic amplitude changes
I think where you might be going wrong is that in the case of wanting
Aug 21, 2008 at 6:34pm
it’s because those ‘undesirable’ clicks are happening so fast that you hear them as one constant pitch.
Aug 21, 2008 at 7:42pm
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!!
Aug 21, 2008 at 7:52pm
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:
– Pasted Max Patch, click to expand. –
Copy all of the following text.Then, in Max, select New From Clipboard.
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.
Aug 21, 2008 at 7:53pm
never mind what i wrote, hahaha, you’ve got it.
Aug 21, 2008 at 7:57pm
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.
Aug 22, 2008 at 1:59am
Quote: Natasha Roberts wrote on Thu, 21 August 2008 21:57
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.
You must be logged in to reply to this topic.