394 points · by beeeeeeeeeeeeen · 6y ago · 102 comments
No, we hear things as if they were a combination of sinusoidal waves (mostly). That's only one way to represent them; you can just as easily represent them as a series of impulses. Mathematically they're all equivalent models, and none of the models accurately represent acoustic transfer.
You can say we perceive things as if they were a linear combination of sinusoidal waves because we have a series of hair cells in the cochlea. Each bundle of hairs responds to waves within a very narrow frequency range, so that's what we mainly respond to. All of our audio perception is filtered through this process first. Since the hair bundles have a specific audio response, they don't respond to instantaneous frequencies- there has to be a wave of a certain duration for us to perceive a frequency. That's even independent of the mathematical fact that shorter wave pulses are more indistinguishable from white noise. Also, all of this is ignoring the other equipment of the ear, like the eardrum and the bone lever[1] that transmits sound to the inner ear.
We have a lot of brain circuitry that picks out specific features, which means we can recognize things like square waves or impulses. I don't know much about this stuff but it's important for things like cochlear implants. AFAIK it's similar to some optical illusion/visual perception phenomena- things like how we perceive magenta as a single color, even though it's just two colors together, or how we perceive orange as a distinct color from brown even though it isn't[2].
> The more you have it's as if there are more instruments playing on top of each other, in music they're called "harmonics".
Symmetrical clipping and square waves both create odd-order harmonics (3x, 5x, 7x, 9x, etc) which are very unnatural. The brain is good at picking this kind of thing out, and while I find it enjoyable (eg chiptunes), it's not really comparable to normal harmonics in music. It's certainly not something you can simplify down to just the component sinusoids. The perception of sounds has way more to do with stuff happening in the brain than in the air.
[1]: https://en.wikipedia.org/wiki/Ossicles#/media/File:Slide1ghe...
What do you mean by "unnatural"? A clarinet has mostly odd harmonics[1], for example. Clarinets don't occur in nature, I suppose, but they're not using electronics or anything either.
[1] https://newt.phys.unsw.edu.au/jw/clarinetacoustics.html#harm...
I plan to share on the blog at some point https://omnisplore.wordpress.com/category/music-creative/
> No, we hear things as if they were a combination of sinusoidal waves (mostly). That's only one way to represent them
Well, but the reason we do our audio processing this way is that the Fourier transform our ear puts out is a high-quality description of the sound. If it didn't work well, we wouldn't do it.
> or how we perceive orange as a distinct color from brown even though it isn't
Why orange and brown? You can say the same thing about red and blue.
Conversely, if orange and brown weren't distinct colors, it wouldn't be possible for us to perceive them differently, and yet we do, very consistently. What exactly are you trying to say by "a distinct color"?
Anything a human can perceive as sound can be simplified down to just the component sine waves.
> You can say we perceive things as if they were a linear combination of sinusoidal waves because we have a series of hair cells in the cochlea.
No. We say this because any waveform can be reproduced by a sufficient number of sine waves at different frequencies and amplitudes. It's not perception, or the physics of the human ear. It's math.[1]
[1] http://astro.pas.rochester.edu/~aquillen/phy103/Lectures/D_F...
Math does not have anything to say about sums of sine waves being the true form of functions. The wavelet transform is just as physically representative. In fact you can generate any number of Hilbert bases for a given function. They are ALL equivalent.
The Fourier transform has a particular relevance because ears do something similar. Hair cells signal the brain while they are sensing vibrations within their particular frequency range. You could have different ears that signaled when they saw a sharp rise or drop in pressure and worked completely differently, but they would sense square waves just as fine. Or you could have ears that directly sense and measure air pressure. Instead, our ears sense that there are vibrations at 1 Hz, 3 Hz, 5 Hz, 7 Hz etc. and the brain interprets that and realizes it is a square wave.
The concept of a real Fourier transform is just as unphysical as a real square wave. A real Fourier transform requires a perfectly defined sound pressure at every instant; because air and sensors have inertia that is not possible. There will always be lag, so any change in frequency is not perfectly transformed or represented from/as a sum of sine waves.
[1] https://xiph.org/video/vid2.shtml It's 24 min long and, imo, does an excellent job at explaining the role of digital sampling frequencies, bit-depth, and the misleading "stairstep" representation of digital waveforms.
Could you go into more detail on why you say this? A real life square wave is square, possibly with some ringing or overshoot in the flanks (but not necessarily)
The best you can get is a tight curve into an extremely steep "triangle".
The amplifier driving the speaker has finite slew. The speaker itself is constrained to move at finite speed and cannot accelerate instantly. The air has a finite slew rate - the speed of sound.
Stackexchange has a discussion on trying to determine a maximum frequency in air here: https://physics.stackexchange.com/questions/23418/is-there-a... which leads to all sorts of useful sub-discussions. Attenuation depends on frequency; the higher frequency harmonics are more subject to attenuation in air, as well as reflecting off surfaces and self-interfering.
What you might have is that the air might disperse the wave so it gets distorted but still with the same components https://en.wikipedia.org/wiki/Acoustic_dispersion
When installing pickups into one of my guitars several years ago, I decided I wasn't going to be satisfied by adjusting the height of the pole pieces by ear, nor was I going to be satisfied with with matching the height of the pole pieces to the radius of the fret board, then adjusting by ear. No, I had a hacker space membership and access to a 100Mhz oscilloscope, so I was going match the pole piece height to the fretboard radius, and then use the oscilloscope to tweak pole piece height until the output of each individual string matched amplitude with the others.
So there I was, with my guitar running into the oscilloscope, doing my damnedest to pick each string with equal force and watching the amplitude on the scope. And I noticed a curious thing. The initial pluck was a squiggly, kinda-saw-wave-shaped thing, and then as the note decayed, became something more akin the 2nd graph in the OP, and then slowly turned into something rather like a sine wave as the note faded.
What happens, is upon picking, there's a lot of higher order harmonics, and other high frequency content, and those higher frequencies quickly decay, and soon you're dealing with mostly just the fundamental and its lower order harmonics.
https://pdfs.semanticscholar.org/b2e2/c20f8fe3ad45d39bc8f562...
One way to get a clearer sound with modern high-gain metal tone is to record each note of a chord running through the amp individually. (I can't remember exactly, but I think this avoids "intermodulation" distortion within the amp itself.)
edit: Looks like this might be exactly that: https://www.youtube.com/watch?v=9EUbO59OO_Y
Note that normal guitar pickups have one or two coils (humbucker) that span all six strings. A hexaphonic pickup has 6 or 12 coils for 6 outputs, one (or two) per string.
The first time I recall hearing about this was with In Flames' album Reroute to Remain. That album has pretty fat distortion sounds.
This lets him do things like mute one string when another starts playing in software, as he won't always have his hands on the bass to be able to mute the non-playing strings.
The fundamentals of the notes of the power chord have frequency ratio 1:1.5
Where i, j, k are all integers:
0.5 * i = 1 * j + 1.5 * k
0.5 * i = 1 * j - 1.5 * k
No matter what combination of frequencies you select, you always end up with multiples of 0.5. Even if you extend the power chord with the octave (frequency ratios 1:1.5:2) you still only get multiples of 0.5. The same applies if you add the harmonic overtones of the fundamentals. This generation of a new bass note contributes to the "heavy" sound.
But in reality guitar strings have non-zero thickness, which means they produce notes with overtones that aren't perfectly harmonic (they are non-integer multiples of the fundamental) . This means you actually won't get perfect multiples of 0.5 of the root of the chord, but it's close enough that the inharmonicity just adds even more "heavy" sound without sounding like noise.
https://www.youtube.com/watch?v=erv4lit4aWY
https://www.youtube.com/watch?v=NO2OZ3UTy2k
Actually all the videos of Dan are amazing.
[1] https://www.electrosmash.com/proco-rat [2] https://www.electrosmash.com/boss-ds1-analysis
This is a good entry level guide to distortion, but it misses a few points.
The first is that any non-linear mapping will introduce aliasing which folds back below the sample rate. The more clipping, the more aliasing you get. In commercial DSP you deal with this by oversampling, applying the distortion, and then filtering and downsampling to remove the aliasing.
If you don't do that, the sound that comes out is nasty and crude with none of the creamy warmth of the real thing.
The other is that high-quality amp distortion emulations - Kemper, etc - are more like real transfer function emulations. They're also level-dependent, so the mapping that comes out isn't one-size-fits all and responds to dynamics.
That doesn't mean delay/echo/reverb, it means a network of very short delays characterised by a Volterra series and/or some form of convolution which models the dynamic tone characteristics of a real guitar amp.
So, non-linear transfer functions can be seen as arbitrary functions, or can be seen as linear transfer functions parameterised by some parameter that varies non-linearly with the input (eg a gain modulated by a non-linear function of the input amplitude -- distortion). This second view is called "linearization" where you model a non-linear system with a local linear model, based on the assumption that non-linearities are smooth when viewed "close up", and is needed to apply certain linear control methods to non-linear systems.
"Okay, so what exactly do you mean by 'distorted', anyway? I hear that term thrown around..."
So we sat down in front of dad's stereo, turned it nice and up, and I played her the intro to _Sorrow_: https://www.youtube.com/watch?v=AdKNlGfkyhc
2 minutes and 14 seconds later: "Oh. Okay. I think I get it now."
...
"You got any more of that?"
(Anecdata: committed rock fan since getting Boston's "More than a Feeling" on 45 in the mid 70s, later played in several punk and hard rock bands ... but I can't stand the sound of Harleys or loud engines)
Personally I think distortion does a good job of conveying emotion / passion as it intuitively gives you a sense of “wow they are really pushing stuff beyond it’s intended limit”.
And if yes, can we consider another kind of machine harmonization which would be to add notes to create wanted harmonies, based on an incoming note (modulating velocity, and maybe timing, so as not to overpower the original note)?
And if yes, this could be called "MIDI distortion"... Are there MIDI plugins that do this?
I recently started making (very simple) plugins in the Reaper DAW; it would be possible to do such MIDI harmonization in JSFX. I'm wondering if it's been done already.
And there are many patches out there to do this sort of thing.
But you are far better off processing the audio signal for any kind of interesting modulations.
So it seems that at least in theory it should be possible to produce any harmonics using just MIDI.
Why would one want to do this? 1/ It's fun 2/ It should give more control about what harmonics are actually produced so maybe more interesting to hear.
There are many MIDI effects around "harmony" but they tend to help with chord progressions, and not this AFAIK.
Imagine that you have a (pure) input sine-wave coming up on the y-axis. It then hits some function on the x-y plane, and then gets "reflected" (mapped) onto the x-axis.
This imagine explains it quite well, and in this case there's a linear transfer characteristic / operating curve, with no distortion of input signal: https://www.tutorialspoint.com/amplifiers/images/input_cycle...
Now - instead of imaging a perfect linear operating curve, think of how the curve of a diode looks like, and how that would clip the upper curve of input.
Now put another diode for the reverse, and you're also clipping the bottom curve of input - this would be a basic diode clipping circuit, which is the fundamental drive-stage for distortion pedals like tube screamers - you'll often see a pair of diodes going opposite directions.
(In electronics classes, you tend to learn how to NOT generate distortion - or rather, how to amplify stuff with least amount of distortion possible.)
I don't know why a new term is needed, but if you can visualize function composition for simple functions like floor, min, max, you can visualize wave shaping.
If the input signal is f(x), you obtain clipped signal g(x) like this:
g(_) = min(1, _) ○ max(-1, _) ○ (a * _) ○ f(_)
This can also be written as g(x) = min(1, max(-1, a * f(x)))
In the example in the article, T(x) = min(1, max(-1, ax)) is called a transfer function.I find it easier to understand function composition by breaking the functions down into simple parts, though.
The sonic effects of this are completely unexplained in the article. Other comments here discuss the effects on harmonics; mathematically, the TL;DR is that the Fourier series of g = t ○ f are more interesting (the intuition why can be obtained by looking at the Fourier series for a square wave).
Without getting into math: a clipped signal retains some of the input, and adds more of square wave characteristics. A square wave is the buzz you get by flipping + and - very rapidly, which will force the speaker cone to go all the way in/out very rapidly.
The reason why math above doesn't fully represent the effect is that an actual speaker cone won't be able to teleport to min/max positions instantaneously; and the unfaithfulness of the speaker cabinet creates pleasing tonal characteristics.
Interestingly I found the simple "clipped" and "clipped/boosted" functions by far the most pleasing.
I doubt it's a coincidence that's what most analog FX are doing.
The distinctions between these are usually murky but in guitar FX:
Boost - Boost Overdrive - boost + soft clipping Distortion - boost + hard/soft clipping Fuzz - boost + mostly hard clipping
All the effects are generally doing one or more of the following: - Boost signal through a transistor till the transistor saturates/cuts off and clips - Do the same with an OP-AMP - Use diodes to do an extra clipping stage
In analog audio the signal is literally an alternating current... the "values" in digital audio correspond to +/- voltage levels. So his transfer functions are trying to mimic what electronic components do when they hit their limits. The transfer functions can also do things that are probably impossible in the analog world.
There's a lot of weird non-linear stuff that seems to bring out harmonics as well.
In short, FT2's sample editor could handle a few common waveform formats, but this was cross platform days and there were a lot of wave formats. These have differnt headers and different structures, but many of them ended up being just a series of samples, either in 8-bit or 16-bit, and at some sample frequency. To deal with this, FT2 added a button that let you reinterpret a waveform as if it was stored signed or unsigned, and one that let you reinterpret as 8/16 bit. This let it load a huge amount of sample formats well enough; you'd fiddle around with those buttons until it sounded right, then you cut the first few millisecs of noise (the file format header) off the front, and done!
But turns out that the "reinterpret as (un)signed" button (called "Conv" in FT2) is pretty spectacular for nasty distortion too.
Imagine a sine wave. Loaded correctly, it'll look like this:
+-----------------------------------------------------------------------------+
| |
| X|
| XXXXX XXX|
| X XX X |
| X XX XX |
| X |
| X XX XX |
| X X |
| X X X |
| X XX |
+-----------------------------------------------------------------------------+
| X X X |
| X X X |
| X X X |
| X XX |
| X XX X |
| X X |
| X X X |
| X XX X XX |
| X XXXXXX X XXX |
| |
+-----------------------------------------------------------------------------+
Imagine this was stored as 8-bit signed. Now, if you reinterpret those bytes as unsigned, it'll look like this: +-----------------------------------------------------------------------------+
| XX XX XX |
| X X X X X X |
| X X X X X X |
| X X X XX X |
| X X X XX X X |
| X X X X X |
| X X X X X X |
| X X X XX X XX X |
| X X X XXXXXX X XXX X |
| X X X |
+-----------------------------------------------------------------------------+
| X X X |
| X X X X|
| X XXXXX X X XXX|
| X X XX X X X |
| X X XX X X XX |
| X X X X |
| X X XX X X XX |
| X XX X X |
| X X XX X X |
| X X XXX |
+-----------------------------------------------------------------------------+
Notice how the top half and the bottom half of the sine waves are swapped.Now, I don't understand much about DSP and sound and the frequency domain. Better programmers than me have told me that this makes no sense from an audio/music perspective. But it sounds pretty cool; you keep a lot of the essence of the original sound, and add a lot of nasty.
I once made a VST plugin that does this (it lets you slide the waveform up, wrapping over to the bottom; its only parameter is by how much to slide), but I don't think I have it anymore unfortunately.
For context, applied to a random bassdrum using 8bitbubsy's amazing Windows clone of FT2[0]:
- original: http://neuvostoliitto.nl/808_drum_kick_035_21338.wav
- distorted: http://neuvostoliitto.nl/808_drum_kick_fucked.wav
Just sharin' :-)
Without going into theory, just look at it. It's the addition of a square wave and a sine wave now. And a square wave has lots of harmonics, giving that buzzy sound.
A square wave is 100% distortion effectively. It's an infinite series of sine-waves (although the infinite series isn't needed to generate a square wave, just the sum of harmonics up to nyquist)
also, the sine wave got flipped, half, kinda. just mixing a square wave with something has a totally different effect than this. it'll sound like the original sound and also a square wave tone playing together.
Speaking of synthesizers, my favorite line was "I’m building a synthesizer in javascript at the moment". I'd love to see this!
(I look forward to this becoming more common.)
The instructor would often mention odd transharmonic distortion. It sounds pleasant to our ears but even transharmonic does not. That's about all we were told about that.
Years later I was reading about brains and somehow I understood transharmonic distortion. The article mentioned something that I now forget but it was clear to me why we like to listen to loud rock music.
I've found that the nice thing about distortion, especially in shoegaze music like My Bloody Valentine, is that the noise makes what you hear sort of an "audio illusion" in that you start picking up melodies that maybe weren't really there. It tickles your ears. Ironically, you could say the noise smooths out the wrinkles in the piece.
let's talk about bitcrunching! now that's fun. and definitely not the other way i cover up poor recording!