How (and Why) Your Digital Audio Sounds Awful

What on Earth does sample-rate mean? What’s a bit depth? Am I adopted? I’m here to answer most of these questions to the best of my knowledge.

Hi. My name is Mosh, and I’m a hopeless audiophile. I’ll spare you the details, but mostly it just means that I have super strong opinions and complain a lot about music production and sound quality. I didn’t used to be like this. I was always the life of the party, from a safe corner looking awkwardly out. But then I went to college and everything changed. The moral of the story is: if you want to be forever branded as a nerd, get an engineering degree. Who would have thought?

At any rate, I’m here today to try and educate you all (and possibly clear up some misconceptions) on the basics of something you, the readers of this hallowed blog, most likely make use of every day: digital audio files. This isn’t going to be some in-depth nerdfest, I just want to cover the basics so that everyone knows what they’re putting into their ear canals… I mean, up to a point and within certain limitations. You filthy individuals. Here we go…

L0044_Wave

This is an analog audio wave. It is the visual representation of how sound exists in the real world; what your ears actually hear. An analog wave is a continuous line, and every line is made up of an infinite number of points (along the “time” axis) that can have an infinite number of values (within the “amplitude” axis). When wanting to convert an analog wave into digital, this presents a slight problem. See, you think computers are smart, but in reality they’re dumb enough that they can only work with finite things: bits. To convert something infinite into bits, the conversion from analog to digital is based around two key concepts: sampling and quantization.

Sampling

In short: sampling means taking your analog signal and checking the amplitude every x seconds. If you take 100 values in a second, you’re sampling at 10 samples per second (or at a 10 Hz rate). Now, the important detail: this process is fully reversible. In order to play back digitalized files for your ears to comprehend, you need to be able to convert the files back into analog signals, and this can be done without losing any information whatsoever as long as you sample at what’s known as the Nyquist rate. The gist of it is, if you sample with a rate that’s double the maximum frequency of your original signal, you will be able to recover it flawlessly. Since the human ear can hear up to about 22 kHz (usually less), the standard sampling rate for files that go on CDs is 44.1 kHz. Makes sense, right? Alright, stay with me for a bit longer…

digital-audio-technology

Quantization

So, now we have our analog wave made into a bunch of samples… but these samples still have amplitudes with an infinite number of values (not good for your computer). This leads to a non-reversible process known as quantization. Let’s say you would like each amplitude to be matched to a specific value, or a combination of bits that your computer could use. So you would take each infinite-amplitude’d sample and compare it to your pre-defined set of different values (levels) to see which one it’s closest to: the closest finite amplitude is now that sample’s amplitude, simple as that. In the image you can see a sampled wave before and after quantization to get a clearer idea of what I’m talking about.

waveform_digital

This means that we’re purposefully introducing a degree of error into the process, which translates into (controllable) noise. The thing is, the higher the number of bits you use for this process, the more levels you’ll have and the more accurate (less noisy) your quantized samples will be. CDs use 16 bits (this is what’s known as bit-depth), which means there are two to the power of 16 different levels (65,563 to be exact) to quantize samples to, with virtually no discernible noise. For comparison’s sake, an 8 bit song only has 256, which is why 8 bit songs sound so characteristically… well, bad.

quantization-0-400


To wrap this up: after this whole process, a non-compressed stereo audio file (that is, two separate channels) with a bit-depth of 16 and a sample-rate of 44,100 Hz would be a series of 16-bit blocks arranged one after the other in a string of 2 x 16 x 44,100 = 1,411,200 bits per second. This is the bit-rate of a standard WAV file, and it makes files take up space on your hard drive reeeeeeal quick, which is why compression is used… but that’s for another time.

Hopefully you’ve made it this far having understood the key concepts, and I think this is more than enough for a first foray into perpetual dorkery. Thanks for reading, Mosh out.

(Photos VIA, VIA, VIA, VIA, VIA and VIA)

  • Dubs

    Calculus is fun!

    • Abradolf Lincler

      nerd

      • If you knew how much money I make being a nerd, you would sign up to be one too. lol

        GL

        • Abradolf Lincler

          i think my track record is pretty ez mode on being a nerd, myself. and i think W recognizes the sarcasm.

          -BB

    • Janitor Jim Duggan

      If you’re as awful at math as I am no math is fun, especially calculus.

      • You could learn a few things about “Math” from this man…

        https://pbs.twimg.com/media/BSEu0xoCIAE8ggP.jpg

        • Dubs

          Dr. Haake

        • Stockhausen

          “Based on my calculations, if you bang your head to the quarter note it’ll line up in 32.5 bars. See you there.”

          • Abradolf Lincler

            i go to concerts and enjoy watching people attempt to headbang on time

        • Mother Shabubu

          He maths so hard I didn’t even realize they switched to a drum program for two albums.

        • CyberneticOrganism

          Dude also made this himself. http://tinyurl.com/jpgyxgm

        • tertius_decimus

          4/4. His math is 4 out of 4.

      • Dubs

        You can’t tell me that this isn’t fun. (RFI)

        • Janitor Jim Duggan

          Yes I can. This isn’t fun. It’s not even close to fun. If you were me you’d understand my loathing of math.

        • CyberneticOrganism

          “2 = 3. Solve.”

          – Calculus

          • Dubs

            I remember when a teacher first did the ol’ .9=1 trick. Good stuff, that math.

          • I hope you can find some comfort in all those numbers while you’re hanging from your underwear.

          • Dubs

            I’m busy calculating whether my acceleration due to gravity will create sufficient force to tear the cotton of my underwear and free me from this wretched entrapment.

          • Janitor Jim Duggan

            Try calculating anything when I’m giving you a swirly nerd!

          • Dubs
          • Janitor Jim Duggan

            I will catch you. You cannot beat me.

          • more beer

            No you won’t. Texas isn’t in your area.

          • Janitor Jim Duggan

            🙁

          • Dubs

            I’l just get in my car and use one of our plentiful roads to make my escape.

          • Abradolf Lincler

            toplel

          • more beer

            Yea you can’t win a car chase. While waiting for the bus.

          • Abradolf Lincler

            is JJD allowed to ride the bus?

          • more beer

            How else does he get to Old Navy?

          • Abradolf Lincler

            perhaps he should join the actual Navy

          • more beer

            As a Navy Veteran, I don’t think he is cut out for that.

          • I don’t think they serve ranch pizza in the NAVY either. Bust for JJM.

          • more beer

            Maybe on a shore base he could get that. But not on ship that is underway.

          • Abradolf Lincler

            but then the entire world would be in JJDs area

          • more beer

            If his area is in the middle of the ocean. Then yes.

          • Abradolf Lincler

            better than po’keepsy?

          • more beer

            I was in Norfolk. Not much better.

          • Abradolf Lincler

            nope

          • Tronc McBeefyBeardloaf

            I’ve only been there a couple of times, and yeah, it’s a shithole. Not the worst area of Hampton Roads (that title would most likely go to Portsmouth), but pretty fucking close.

          • ranch pizza? no thank ya. having said that, Mother Shabubu does have some not-so-nice things to say about the pizza of my people (St. Louis style)

          • What makes it “St. Louis style”? Is it infused with the “Blues”.

          • you’ve already got enough vernacular to fit in over here!
            it’s topped with a kind of processed cheese called “provel”; which is a love it or hate it product. people who have been fed it since birth will love it. everyone else on the planet will hate it.
            also, is cardboard thin.

          • more beer

            That is why the St. Louis style pizza place that opened here. Closed down in about a month.

          • now that’s on the owner. should have known there’s only one group of people cray cray enough to eat it.

          • more beer

            I never went there. I have an awesome pizza place I go to.

          • Tronc McBeefyBeardloaf

            “it’s topped with a kind of processed cheese”

            https://c2.staticflickr.com/4/3292/5763428843_ce57f1f3a9.jpg

          • more beer

            It is and it makes for a hard landing.

        • Waynecro

          Looking at that mess of numbers triggered my brain’s self-detonation function.

          • Abradolf Lincler

            I thought it was pretty straightforward

          • Waynecro

            I suck at math. I really wish I didn’t, but I do. I barely picked it up in high school and pretty much forgot everything after that. I’ve tried to learn since then, but I always fail. I think I need to hire a tutor. That requires time, money, and human interaction, which is probably why I haven’t done it yet.

          • tertius_decimus

            Same here. It sucks more with the fact I’m quite technically accurate dude, I understand physics and what’s going on in macro mechanics and little on quantum level. That’s by the way not my opinion but an opinion of engineer who’ve made couple of systems to Antonov cargo aircrafts.

            But… but… still too stupid!

            I eagerly want to understand formulas and shit but can’t. Maybe the culprit here is too high math pressure back in the school days. We were studying in experimental math-inclined class which by design was ahead of normal classes by no less than two years. Brains were literally were squeezing out. So, here’s the result of artificial acceleration: dude from math-oriented class who fail to compute. Bummer.

          • Waynecro

            I get that, man. I deal with a lot of highly technical content for work, and I understand everything until the analysts roll out the formulas.

          • tertius_decimus
  • Sound is like image resolution. The higher res the better. Get them big pixels outta here!

  • This was actually really helpful.

    You fucking nerd.

    • Owlswald

      This partially confirms I checked the right boxes when ripping my CD’s to .mp3 format.

      • EsusMoose

        Well depends on what software you did use and what bit rate it was ripped at, old mp3 encoders suck, ones in the last few years have improved decently. Generally the bit rates of 256 or 320 kbps are fine, variable bit rate like through amazon is iffy and I don’t like it, and anything beneath 200 like 128 kbps is garbage.

        • Mosh Hoff

          Disagree. All the 128 mp3 files I source from FLAC rips using this enconder I can’t remember the name of (the program itself is called Total Audio Converter) are virtually indistinguishable from said original FLAC files unless I go in and do what Max described below (lining the samples of both files up and listening to the “difference” wave).

          • Max

            The thing is, there’s good .mp3 codecs and bad ones – particularly at lower rates – but I’ve long felt that a lot of the bad reputation that .mp3 has is largely due to measures taken in the various software packages offered that don’t actually have anything to do with the .mp3 algorithm; they’re just added on to decrease the file size even more.

            For example, I often create .mp3 files in a very old (circa 2003) edition of Cool Edit Pro (long since deceased and absorbed into Adobe Audition). CEP’s version of the mp3 software had options to lower the sample rate from 44.1 kHz down to 32 kHz or 22.05. Obviously that’s going to affect the sound (less treble) and give you smaller file sizes, but it’s not actually in the remit of the .mp3 algorithm itself; it’s just an add-on to make smaller files. It also had options to put the file into mono (half the file size!) or to put bass frequencies into mono (smaller file size but with a slight smearing of the stereo image). Again, these aren’t part of the .mp3 codec, but they all help to make the file smaller. Use all of them in conjunction with .mp3’s perceptual codec, at a low bit rate, and yes – it’ll sound crap.

            So my theory is that in the days before broadband, when e-mailing an .mp3 still took a lot of time*, software developers were adding all sorts of sound-comprising measures like this to help people file-share mp3s. And that’s what helped .mp3 get such a bad reputation sonically which it has never really overcome, even though alot of those extra measures are no longer necessary. To say nothing of the fact that illegal file-sharers often put their files through several generations of .mp3 encoding, which’ll make it sound even worse. Done properly and discretely, even 256 kps can probably sound fine.

            * Fun story: around that time (2003), I once e-mailed a 6-minute, 44/16 stereo .wav file to a friend. It took at least 12 hours for him to download it all. I had to send it in 10 second fragments with instructions for how he should stitch it all together.

          • EsusMoose

            My experience with 128 came form early apple, and other poor choices of acquisition. I found the cymbals to have a slightly more washy sound and the bass to have a similar effect. I don’t doubt older forms of compression were total garbage but that’s where my experiences with 128 is from.

          • KozmoNaut

            Yeah, and older encoders at 128kbps CBR are generally shit. But you should never use CBR for anything, unless you’re paranoid and you want to lock it at 320kbps for some reason.

            Use LAME’s VBR modes, it’s really good.

        • KozmoNaut

          Modern MP3 encoders are a lot better than you give them credit for, the newest versions of LAME are ridiculously good. Try ABX-ing an original WAV against a -V5 VBR MP3 (~130kbps). It’s close to impossible to hear a difference, it really is.

          And VBR absolutely isn’t iffy, it’s the standard for a reason.

  • EsusMoose

    Great article, audio is fun. I assume future parts (compression) if they happen will cover the different audio compression (mp3, the large amount of lossy types,etc).
    Also for all, remember mp3 320kbps is generally considered the cut off point where you can’t tell the difference in audio quality (unless you try really hard). But remember if you can, download the FLAC files to appear cool and seem like you know what you’re talking about!

    • Max

      The only time I’ve ever been able to tell the difference between lossless .wav and lossy 320kbps .mp3 is when I load both files into a wave editor, sync them up to sample accuracy and invert the polarity of one to do a null test. The residual signal is what you can then hear that you lost from the .mp3 encoding process, and it’s really not that much. Usually just some low-level white noise that bounces in time to the percussion line.

      • EsusMoose

        Thanks for the example, yeah I’ve never sat them side by side but rarely have I noticed any difference. Maybe the sub-bass is lessened, maybe some unhearable highs are left out, I either don’t have the equipment to properly reproduce very deep sounds or wouldn’t be able to hear it because humans normally can’t

        • Max

          Well, the whole point of .mp3 is the perceptual codec used, which means that you shouldn’t be able to hear a difference, though of course at lower bit rates that doesn’t work.

          Think of everyday sound as “CD-quality” sound. Think of your ears as “CD-quality” microphones. And think of your brain as Pro Tools set to “CD-quality” recording levels. But the brain actually doesn’t “record” that much “data”. There’s a lot which gets discarded so that we don’t get sensory overload (your eyes do this too). Perceptual codecs are an attempt to minimize the file size by discarding data in a way that mimics what the human brain would do. Therefore, instead of listening to a CD and ignoring much of what emits from it, you listen to an mp3 and it “ignores” it for you. Though, again, it doesn’t always work.

    • KozmoNaut

      No, the cutoff point for 99.99% of people is much lower, try LAME VBR -V5 (~130kbps) on for size in a blind test. The quality will surprise you.

      I can just barely tell the difference between -V5 and FLAC, and that’s on material that’s widely considered to be the hardest for MP3 to handle, solo harpsichord (for some weird technical reason). And I can only do it if I find a particularly troublesome section and listen to it over and over again, constantly comparing.

      In normal playback, enjoying-the-music mode? Not damn chance.

  • Owlswald
    • Count_Breznak

      Well no, that is one note. Hold forever, at the same loudness. ..or actually nothing, since there are no axes and no legends.

      • Owlswald

        Killjoy

        • Count_Breznak

          Let’s go with “all of ACDC’s releases, al at once” then.

  • Abradolf Lincler

    vinyl bros staying ahead of the curve, basically

  • Thanks Mosh. I Think I’m ready for the complicated version now.

  • Janitor Jim Duggan

    No locker can hold this amount of nerd. You’ll need a full blown storage container to hold the amount of nerdiness here.

  • CyberneticOrganism

    Toilet Ov Technical Audio Motherfuckery

    Nice writeup Mosh, you obviously know your shit.

  • brokensnow

    You plus me equals us. I know my calculus.

    • CyberneticOrganism

      poo + pee = flush

      I’m sorry.

      • brokensnow

        Sad that kid died of cancer.

  • Joaquin Stick

    I installed Pied Piper to help store all my WAV files.

  • this is wonderful stuff Moshito. i hope you delve further into the realm of audio engineering, i’ll be there with you ’til the end

  • Count_Breznak

    Next week: Dirac combs : Not for your hair.

  • next week’s topic: we teach record labels how to properly format MP3 tags on Bandcamp

    • Abradolf Lincler

      How about just teaching everybody how to tag MP3 properly

      • tertius_decimus

        Wait, you don’t love unknown artist? He’s the most popular artist in the world!

        • Abradolf Lincler

          Almost as good as various artists

          • hey, heard any good new bands of the genre [Rock and Pop]?

          • tertius_decimus

            Try “various artists” compilation. Usually, labels make good mixes from their legacy.

        • Max

          And so eclectic in his output. Pretty boring cover art on his albums, though: Always a close-up of the “Men’s Toilet” guy.

    • KozmoNaut

      Tagging in a uniform manner is hard when different pieces of software can’t even agree on the ID3 spec!

      A lot of software seems to mix up Album Artist and Performer, because ID3 only really has one tag that some people use for one thing, some for the other.

  • Waynecro

    Thanks for the informative article, man. I’ll be sure to consult this text whenever my audiophile brother starts ranting about sound stuff.

  • Guppusmaximus

    “See, you think computers are smart, but in reality they’re dumb enough that they can only work with finite things: bits.”

    Actually, computers are dumber than that. Those ‘bits’ only represent a state of either on or off. Talk about an exaggerated light switch. *smirk*

    • currently working on an article about quantum computing. no joke.

      • Dave Vincent’s Perm

        The only quantum stuff I have a proper understanding of is the De Broglie model.

    • Tronc McBeefyBeardloaf

      They just want you to think they’re dumb, until…………………

      http://i.imgur.com/cEnPVuZ.gif

    • KozmoNaut

      Millions and millions of light switches. It’s a wonder it actually works!

  • Guppusmaximus

    I’m probably guilty of being tricked by a placebo effect of sorts but I’ve always found the detail to be much richer with higher bit-rates and sampling. Maybe it’s just my trained ear? However, there is an actual noticeable, discernible drop in quality when I play an Mp3 on my rig. I call them auditory artifacts. Hi-hats & cymbals don’t sound as clean and the dynamics seem to be missing. The imaging & soundstage seem to be impacted by the lack of supposed in-auditory details. However, “China Girl”, “Human Nature” & “Hotel California” spans out beautifully in 96/24.

    • Max

      The dynamics should be fine, unless somebody has also applied an AUDIO compression effect to the file you’re hearing – NOT to be confused with the DATA compression process of the .mp3 encoding.

      The dirtiness you’re hearing is caused by background sounds (ie: cymbals) being expressed with less bits (ie: coarser quantization) than 16.

    • KozmoNaut

      It all depends on the bitrate of the MP3 and the quality of the encoder used. What you’re describing definitely happens with low-bitrate MP3s, the cymbals get all washy and sound almost like they’re underwater. But you have to go to a pretty low bitrate for that to happen with a modern encoder like LAME.

      LAME -V3 or -V2 should be absolutely transparent to 99.99% of people in a double blind test, probably even as low as -V5 (~130kbps).

      Regarding 96/24, you can be 100% sure that it’s either placebo or a better master used for “hi-res” version, which is a common trick, especially with SACDs where you have an SACD layer and a CD layer. The CD layer is often made using a more dynamically compressed master, to make the SACD layer sound better. It’s pure marketing.

  • Max

    Just to nitpick on a typo: In 16-bit sound, there are 65, 536 steps of quantization.

    • Mosh Hoff

      brb commiting ritual suicide

  • ChuggaChuggaDeedleyDoo

    I can guarantee you that few people short of audio engineers can tell the difference between 100% analog and a 16 bit WAV file.

    Even then, all music since around 1998 was for the most part recorded digitally, and almost certainly mastered digitally.

    Bottom line: getting vinyl of an album that was recorded digitally is a complete waste of money from an audio quality perspective

    • Max

      “Even then, all music since around 1998 was for the most part recorded digitally, and almost certainly mastered digitally.”

      Well, no. If it’s a vinyl release, it had to be mastered analog since vinyl is an analog format (although it certainly could have started life as a digital multi-track recording and a digital mix).

      But that’s not to say that the vinyl release is going to sound any “better” (however defined) than the CD. And certainly, as you suggest, some vinyl releases are simply mastered to analog from an earlier CD release of the same album, because the original analog Production Master Tape has been lost or degraded.

      In that case, all putting it onto vinyl has achieved is to add whatever sonic artifacts an analog format introduces which a digital format doesn’t; ie: higher noise floor, pitch fluctuation, surface noise, signal dropout, distortion, etc. And yet so many people will think that all makes it sound “better”. It’s just trendy received “wisdom”, really.

      • KozmoNaut

        All vinyl since basically the late 1970s has been run through a digital delay line, it’s a necessity for the best possible utilization of an LP’s surface area. By listening “ahead” and delaying the actual signal by a known amount, the tracks can be pushed as close together as possible, while still making sure there’s enough space for louder sections (they need wider tracks).

        If you look at LPs where the music switches between quiet and loud sections, it’s pretty easy to spot.

        The original digital delay lines used had a 50kHz sample rate, so slightly more than CD-quality, but not an audible difference.

        So really all LPs apart from some very niche analog fanatic productions have been through at least one digital device. And most of the analog fanatics have no idea 😉

        • Max

          Wow, I didn’t know that. Any idea what the wordlength for those digital delay lines would have been? (I assume at least 16-bit.)

          It’s really letting the cat out of the bag for the analog purists, as you say. Of course, we can safely assume that today there’d be even more digital participation in the signal chain for vinyl mastering than there was in the late ’70s, but to have had such gear involved even back then…wow, I had no idea.

          • KozmoNaut

            The Ampex ADD-1 was 16-bit and 50kHz, and it was introduced sometime around the mid-70s. Here’s the patent application (from 1980, though): https://www.google.com/patents/US4348754
            And a blind listening test confirming the audible transparency (sorry for the ghastly website design): http://djcarlst.provide.net/abx_digi.htm

            I may have overstated things slightly when I said “all vinyl since basically the late 1970s”, because a lot of studios kept their tape machines with preview heads for this same delay line task. Ampex developed the ADD-1 because they couldn’t find a way to add preview heads to their ATR tape machines.

            But it would be fair to assume that all vinyl cut since sometime since the 1980s, and certainly all modern vinyl, either started out as digital recordings or were digitized at least once during the production.

          • Max

            Thanks for replying, and for the links which I checked out. I can’t wait to point this out the next time I get into a discussion about this with somebody from the Analog Warmth Brigade!

  • Eliza

    *sees complicated science stuff*
    Hmm, it looks like this thing I remember from maths class.

  • Thanks a lot for your writing, MoshOff! I’m finally getting this 🙂

  • J.R.™

    “Mosh out”
    Command, or signature exit phrase?