11 ms·
How Distortion Works in Music
- dkdbejwi383 6y agoIt would be nice if both waveshaping graphs were side by side so I don't have to keep scrolling up and down to change the function, and so I can see the waveform at the same time as the transfer function.
- traek 6y agoThis is super cool. I really enjoyed the demos, and the explanation of what distortion actually does to the waveform was very clear.
- beeeeeeeeeeeeen 6y agoThanks!
- vnorilo 6y agoSomewhat related, my colleague has studied the interplay between distortion harmonics and chordal harmony in metal music: https://pdfs.semanticscholar.org/b2e2/c20f8fe3ad45d39bc8f5623b50100338e35c.pdf https://pdfs.semanticscholar.org/b2e2/c20f8fe3ad45d39bc8f562...
- hrnnnnnn 6y agoThis is really interesting! 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.)
- vnorilo 6y agoYes, I can confirm you won't get intermodulation and the harmonic mix will be less dense.
- ubercow13 6y agoI wonder, has anyone tried making a guitar that outputs the signal from each string's pickup coils separately, and then an amplifier that distorts each signal separately? edit: Looks like this might be exactly that: https://www.youtube.com/watch?v=9EUbO59OO_Y https://www.youtube.com/watch?v=9EUbO59OO_Y
- deleted 6y ago[deleted]
- exDM69 6y agoYes, a pickup that has an output for each string is called a "hexaphonic pickup". 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.
- 01100011 6y agoOver the years my EE background led me to wonder about a number of different ways you could improve an electric guitar, only to find out later that they've all been done before. There are quite a few nerds who love music and they've been experimenting for decades.
- ftio 6y agoThe Line6 Variax does this. With their digital modelers, you can set different effects for each string. Pretty wild.
- hrnnnnnn 6y agoMartin from Wintergatan (of Marble Machine fame) has made a bass guitar with a separate pickup and output for every string. 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. https://www.youtube.com/watch?v=rvL83-iy-EQ https://www.youtube.com/watch?v=rvL83-iy-EQ
- 6y ago
- smcameron 6y agoThis is one reason Iron Maiden sounds so cool, because they have lots of harmonized guitar parts played by multiple guitarists. (loads of other bands too, but Iron Maiden is especially well known for this.) OTOH, so called "power chords" (root + 5th, or root + 4th) also sound pretty cool because of the "intermodulation" distortion. But it's true that "overly complicated" chords can be a tough listen with heavy amounts of distortion.
- mrob 6y agoIntermodulation distortion creates new tones with frequencies at the sum and difference of the frequencies (and integer multiple of the frequencies) of each pair of tones you're distorting. Usually this produces tones that are harmonically unrelated, but in the case of a power chord it produces a harmonic series with a fundamental one octave below the root of the power chord (0.5 times its frequency). 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.
- skrebbel 6y agoOne kind of distortion that I loved to apply in my FastTracker II days, and which I don't see used all that often, is to flip the sign. 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 http://neuvostoliitto.nl/808_drum_kick_035_21338.wav - distorted: http://neuvostoliitto.nl/808_drum_kick_fucked.wav http://neuvostoliitto.nl/808_drum_kick_fucked.wav Just sharin' :-) [0] https://16-bits.org/ft2.php https://16-bits.org/ft2.php
- paramost 6y agoThis is very interesting and a great interactive demo. Could you make it so that when you press another sine wave, the other one stops playing? I accidentally had a couple things playing at once.
- tuzemec 6y agoDan Worrall's videos for FabFilter about distortion and saturation are great too: https://www.youtube.com/watch?v=erv4lit4aWY https://www.youtube.com/watch?v=erv4lit4aWY https://www.youtube.com/watch?v=NO2OZ3UTy2k https://www.youtube.com/watch?v=NO2OZ3UTy2k Actually all the videos of Dan are amazing.
- thekegsi 6y agoFor a really cool and detailed break down of almost any audio effect checkout the book DAFX: Digital Audio Effects
- stagas 6y agoThat's cool, but it doesn't really explain _why_ the sound becomes more interesting. It has to do with how the sound is played back, in short, there are no "square" waves. Everything is a combination of sine waves. The more you have it's as if there are more instruments playing on top of each other, in music they're called "harmonics". A "squared" wave is a wave with many many additional sine waves in different frequencies that overlap with each other, if you were to plot it it wouldn't look square, rather it would be wavy. This article shows visually how this effect takes place, if you are interested: http://www.jezzamon.com/fourier/ http://www.jezzamon.com/fourier/
- eternauta3k 6y ago> if you were to plot it it wouldn't look square, rather it would be wavy 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)
- mhh__ 6y agoGibbs effect. To sample a signal you need an antialiasing filter in front of the ADC.
- elijahparker 6y agoThe square wave signal will move the speaker in a square pattern, but the actual waves propagating through the air are always sine waves. What you get is a series of harmonics indicative of the square source.
- raverbashing 6y agoThe waves can be mathematically described as a sum of sine waves, but there's no reason why air shouldn't support something that "looks like" a square wave (no more as the speaker anyway) within some limitations. 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 https://en.wikipedia.org/wiki/Acoustic_dispersion
- blt 6y agoI'm not a DSP person, but I thought the term "transfer function" was more typically used in reference to Laplace transforms of linear time-invariant dynamical systems. Is it also common to use it for state-space mappings like the ones in this article?
- radarsat1 6y agoYou make a good point. Indeed a transfer function is usually used to characterise linear systems. However, non-linear systems also have transfer functions, it's just that they are not scale invariant. Transfer function technically is just the "function" characterising the relationship between input and output. In a time-invariant linear system this is the ratio of the input spectrum to output spectrum, and is invariant to the scale of the input, and so can be characterised by a matrix multiplication (ie a linear transformation). For non-linear systems such as distortion, you now have a time-varying linear transfer function, a gain, depending on the amplitude of the input. So overall it is non-linear, and must be characterised by a function (the distortion curve), not by a single linear operation. One of the consequences of this is that it's a lot harder to go between the time domain and the frequency domain when dealing with non-linear transformations, so frequency analysis becomes more difficult -- but not impossible, depending on the system. For instance Chebyshev distortion can be analysed in the frequency domain. 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.
- TheOtherHobbes 6y agoYes, these are straight lookup tables/mappings, not transfer functions, which use complex math - and s-plane to z-plane transforms for DSP - and can implement various filter shapes. 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.
- montebicyclelo 6y agoGreat use of interactive visuals/audio to help explain things. (I look forward to this becoming more common.)
- bambax 6y agoSo, can we think about distortion as a kind of machine harmonization? 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.
- ioseph 6y agoWithin Midi you are limited to 128 notes. Within this range you could certainly produce some interesting chordal effects (one thought would be octaves and fifths phasing in and out). 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.
- bambax 6y agoNot sure; by definition a software synth can produce audio signal on the totality of the audible range. To control these we can use notes + pitch bend or some kind of continuous signal such as virtual cv. 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.
- themarkn 6y agoJust a note With MIDI 2.0 we now gone from 7-bit to 32-bit which makes a huuuge difference in terms of what can be achieved, no more 128-note limit!
- kchr 6y agoWe've been waiting 30+ years for this... At last!
- nydel 6y agodistortion is for pretending i meant to clip my recordings at a frequency i didn't notice on studio monitors. let's talk about bitcrunching! now that's fun. and definitely not the other way i cover up poor recording!
- qrv3w 6y agoFantastic article! I loved how the transfer functions are shown, with audio examples! I'm going to use this for writing an effects patch for my synthesizer :) Speaking of synthesizers, my favorite line was "I’m building a synthesizer in javascript at the moment". I'd love to see this!
- beeeeeeeeeeeeen 6y agoThat's awesome, thanks!
- dghughes 6y agoI recall something like this from a sound system engineering course I took in 1990. It was a course for people wanted a job of setting up speakers and operating the mixing board. (It was supposed to be a course to be a recording studio sound engineer... I'm still pissed) 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.
- myself248 6y agoMany many years ago, as my little sister was getting into rock and roll, I mentioned my theory that one reason American teenagers gravitate towards it, is that the sound of a distorted guitar resembles the sound of an engine, and that cars symbolize freedom and coming-of-age in our society. "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 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?"
- ilamont 6y agoThat's an interesting theory. But wouldn't the same people who like distorted guitar also like the sound of sports cars and motorcycles? I know there's some overlap, or at least many motorcycle owners listen to rock, but among the total population of rock fans are relatively few motorcycle owners. (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)
- kitotik 6y agoA lot of the basic rhythms and tempos (aside from the ones directly taken from west African music via American blues) were mimicking locomotives / steam 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”.
- SeanFerree 6y agoVery cool!!
- smcameron 6y agoIt's interesting to look at some circuits for guitar distortion stomp boxes like the ProCo Rat[1] or Boss DS-1[2] or others on that eletrosmash site. Also guitar cabinet frequency response drops significantly after 10kHz so that rounds high frequency sharp corners off a bit (try listening to the direct signal from a distorted guitar preamp vs. the same signal through various cabinet impulse responses sometime, or hook up an oscilloscope across the output of a guitar multieffects box on various distortion settings. Nary a square wave to be seen. [1] https://www.electrosmash.com/proco-rat https://www.electrosmash.com/proco-rat [2] https://www.electrosmash.com/boss-ds1-analysis https://www.electrosmash.com/boss-ds1-analysis
- TrackerFF 6y agoAbout the wave shaping, if some posters have a hard time visualizing how the mapping looks like: 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.jpg 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.)
- romwell 6y agoTL;DR: Wave shaping is just function composition. 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.
- techbio 6y agoI enjoyed the "very noisy" setting, actually sounds like most of the radio dial.
- ben7799 6y agoCool article. Pretty straightforward but very cool to see the interactive examples. 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.
- allenu 6y agoVery cool demos to play around with there! I was hoping it would go into the psychology of why distortion works, but this was still awesome. 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.
- korethr 6y agoSo, that 2nd sound with the grouping of sine waves that looks like it's starting to form a saw wave is actually rather close to the natural signal of an electric guitar. 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.
- realthing 6y agoThat’s basic harmony 101
- qmmmur 6y agoYou just described spectral envelopes.
- aldanor 6y agoWhat's so surprising? The initial pluck is dominated by the short percussive sound of actually plucking the string, which quickly fades away so what's left is the fundamental sine-like wave. As noted below, spectral envelopes.
- stevebmark 6y agowhy are the final audio samples so terrible/quiet? did no one actually try them out?