Digital Audio: An Introduction

Lights! Camera! Just kidding. Today we are talking about digital audio and all the ways sound goes from your gadgets into your ears.

UPDATE: Added ALAC to the list of codecs and made it the recommended codec for music.

Lossy vs. Lossless Compression

When sound is recorded, all those beautiful sound waves can take up a lot of space. But people only have so much space, and some people have limited data as well. Because of this we need a way to make the audio smaller. That’s where compression comes in. There are two main types:

Lossy: Lossy compression saves space by throwing away “unimportant” bits of the audio. You probably won’t even notice them missing, but audiophiles definitely will. This especially impacts music, which is why most music streaming services have lossless audio as an option.

Lossless: Lossless compression sounds exactly the same as the original, but takes up less space. Lossless files tend to be a little bigger than lossy ones, but the quality is worth it for many applications.

In the end, choosing between a lossy and lossless audio codec mainly depends on your usecase. For audio that is mostly talking, lossy compression is suitable, where as musical audio is better in a lossless format.

Audio Codecs

There are a lot of different types of audio files. There are .mp3 files, .wav files, and others. The first thing to know is the the file type doesn’t necessarily tell you what codec it uses.

What is a codec anyway? A codec is a way to turn audio data into 0s and 1s. There are many codecs, some better than others. Here are a few common ones.

MP3: MP3, in terms of audio quality, is not good. It uses lossy compression, so bits of the song are thrown out. However, MP3s are compatible with basically everything and everyone has heard of them.

WAV: WAV is an old and simple format. Is losslessly stores audio data. WAV is great to work with since it’s fast and lossless, but the files are huge so you may not want to publish anything in WAV.

AAC: AAC is lossy, but better than MP3. It is compatible with most players as well. AAC is often stored in an M4A file, but can be used in others as well.

OGG: An old lossy codec that isn’t widely used. I can’t really think of when you would need this.

Opus: Like OGG, but new and better. It isn’t widely compatible, but some applications like Discord use it for calls.

FLAC: FLAC is a very good lossless format. It keeps the original quality of the audio but packs it into a much smaller file. FLAC is a favorite among music fans, and sites like Bandcamp allow for FLAC downloads.

ALAC: Similar to FLAC, but developed by Apple. Most modern players can handle this format. It usually comes in a .m4a file and is a good lossless format.

Other Things That Effect Audio Quality

Sample Rate: This is the rate at which data is recorded and played back. A higher sample rate during the recording process will generally sound better.

Bitrate: For lossy codes, this is the amount of data that isn’t thrown away. The higher the bitrate, the better the audio sounds and the more space it will take.

Channels: Sound can come in mono, stereo, or various types of surround sound. On a nice surround speaker system this lets you have sounds come from different directions. Stereo is great for headphones and there are a lot of neat things you can do with it.

Conversion

The best tool for converting media is FFMPEG, but it is a command line tool and has a steep learning curve. Audacity is another good option that is easier to use. It is important to note that quality is lost every time you convert to a lossy fomat, so definitely use lossless formats while working on audio. And don’t convert lossy to lossless, that will make it larger and still sound worse than an original lossless copy.

Formats I Recommend

For Working With Audio: WAV is probably best for working with audio.

For Podcasts: AAC, with MP3 as a backup for older players. The AAC audio should be in an M4A file.

For Personal Voice Recordings: Opus. It works with VLC and is very efficient.

For Music: ALAC. It’s a lossless codec that works on most players.


Posted

in

by

Tags:

Comments

2 responses to “Digital Audio: An Introduction”

  1. I love this! Jimmy, your writing is so well put together!

Leave a Reply

Your email address will not be published. Required fields are marked *