Best Audio Compression for WordPress

Feb 17, 2022 | Tutorials

Properly compressing your audio files before uploading them to your site can saves resources and bandwidth if you want is self-host them for a blog, a podcast, or an audio library website.

The big benefits of self-hosting include:

  1. You don’t need to depend on a third-party service
  2. You retain ownership of your files
  3. You have a built-in backup of the files
  4. You can provide direct playback to your readers

And if you need to scale bandwidth for streaming, you can use a CDN to help manage traffic without losing ownership or control of your content. Convenient!

In this article, I will show you everything you need to know about audio compression. We will look at the available formats and how to compress your files without a noticeable loss in quality.

Let’s dive in.

Types of Audio Compression

Lossy formats degrade audio quality. It uses acoustic modeling to remove frequencies for minimal impact on hearing quality. Lossless formats do not remove any audio frequencies from the source and work similarly as a ZIP/RAR files. 

While the Lossy formats are ideal for podcasts, Lossless formats are better for archiving files if preserving the quality is more important than file size.

Before doing any transcoding or compression for your audio, let’s check out the formats that are most suitable for self-hosting your content and sharing on WordPress.

Lossy Audio Formats

The following formats give you a smaller file but can degrade the quality. The more compression you apply to them, the less quality the output should have in exchange for less storage size. These formats are not reversible. Once you compress your audio files into any of these formats you cannot undo the process as it removes frequencies from the original file.

MP3

MP3 stands for MPEG-1/2 Audio Layer III. This is a well-known coding format for digital audio developed by the Fraunhofer Society in Germany. MP3 has been around for years. It is supported on almost every device on earth, it is easy to compress and use, and it doesn’t require any third-party mechanism to work through WordPress. MP3 does not have the best compression algorithm though, and while compressing in more than 256kbits leads to great results, compressions below this level can have an audible quality loss – especially below 128kbits. AAC is a better format for saving space because you can compress as low as 96kbits and get better results than an MP3 compressed at 192kbits. It’s something to consider when choosing the proper format.

AAC

Advanced Audio Coding (AAC) is also a lossy format. AAC is also part of the MPEG-2 and MPEG-4 standard and can be found as HE-AAC for AAC+. It has been adopted by digital radios and mobile television as a standard. Even though this format is highly efficient, it is not compatible with WordPress, so if you want to upload a file it must be attached with the URL.

Ogg Vorbis

Vorbis is an open-source alternative to MP3 and was developed by Xiph.Org Foundation. The format has a slightly better encoding quality than MP3 but it is inferior to AAC in most circumstances. Because it is Open Source, it has wide support and most devices will play it without the need for an extra decoder and it is compatible with WordPress.

The Lossless formats

The following formats have no quality loss after compression. Compression can vary depending on how you adjust the Encoder and the resulting output will retain the quality to the source – hence the term “Lossless”. The more compression being applied, the more strain is put into the decoder. This format is reversible, meaning you can convert these files back to the source (for example WAV), simply by transcoding them into any other Lossless format.

Apple Lossless (ALAC)

This format was developed by Apple. The idea is that music/audio compressed with this format won’t have any audio degradation or loss of quality. The compression algorithm functions similarly to a ZIP compression algorithm in which the audio being decompressed won’t have any quality loss whatsoever. The format was launched in 2004, but Apple made it Open Source and Royalty-Free so it can be used anywhere. Even though this format is highly efficient and similar to FLAC in performance, it is not compatible with WordPress audio upload and will need to be attached as with a URL for download and it does not allow online playback by default.

FLAC

FLAC was designed by the same people behind Vorbis, Xiph.Org Foundation. FLAC has its own set of tools and codec implementation. It is not as widely used as AAC or Vorbis, but the capabilities are superb. The format can compress from 50 up to 70 percent of the original audio file size in most situations and can decompress the audio into an identical copy of the original without any quality loss.

This is an ideal format for an audio archive website that needs to preserve source quality audio since it is also compatible with WordPress audio upload and can be played online.

Which format should we use then?

Of all the audio formats, the ones that are compatible with the default WordPress uploader and can be played online are:

  • MP3
  • Ogg Vorbis
  • FLAC

AAC and ALAC are not, so you should consider that when deciding what is best for your project.

Compressing With Fre:ac

There are several free tools on the market that allow you to convert audio easily. Foobar is widely used but it is not user-friendly. For that reason, we will use Fre:ac for this article.

Fre:ac is a really handy tool that will work in most situations as it sticks to the KISS concept and is available on Windows, Linux & Mac.

You can download Fre:ac for free here.

The music for this example comes from Free Music Public Domain.

Transcoding Audio

The first thing we will want to do is to select an appropriate audio format for transcoding. Remember that we have the option to either go Lossy or Lossless depending on your project.

In this section, we will explore each format, the options that should be selected, and the resulting file sizes after conversion.

Let’s open up Fre:ac.

First, you need to add files for conversion. This can be done by using the button below “File”. Once the file has been added, we can select the Encoder on the bottom right corner.

MP3

Now that we have our WAV file as the source, let’s configure the LAME encoder for MP3.

Now configure that particular Encoder. There are 2 methods I will use for this tutorial.

Smaller File Size

The The VBR encoding (Variable Bitrate) is designed to set a Quality Value for your encoding instead of relying on the Bitrate. For this particular mode, we want to save as much bandwidth as we can. Set the Quality option to no less than 3. An encoding Quality 3 will generally create an output file with an average bitrate of about 160-192kbits, which is acceptable for MP3. Less than that and you will start losing audio details.

After the encoder is configured, we can proceed with the encoding.

Exploring the resulting file

Once the file has been encoded, if we take a closer look at the properties, you will see that the average bitrate is about 168kbits.

Higher Quality Larger Files

In this preset, we will focus on retaining as much audio quality as we can. To do that, we will use ABR (Average Bitrate) instead of variable. For this preset, we will shoot for 256kbits. The resulting output will be as close to the original as you can get for an MP3.

This is our highest preset suggestion for ABR on MP3. If you want to go higher, 320kbits should be the absolute maximum.

Ogg Vorbis

Ogg Vorbis is quite the popular format and has the same level (if not better) than MP3 for compatibility. You will have no issues in using Vorbis on any of your projects online and WordPress doesn’t have any problems in uploading or supporting Ogg Vorbis has the same level (if not better) than MP3 for compatibility. You will have no issue using Vorbis on your WordPress website and it is supported right out of the box.

Although Ogg Vorbis does support the same VBR and ABR modes than in MP3. Vorbis is quite efficient in the VBR mode and reOgg Vorbis does not support the same ABR mode. Vorbis is quite efficient in VBR and doesn’t need ABR in most circumstances. The encoding Quality for our preset will be no less than 6.

FLAC

Since ALAC is not supported on WordPress, that leaves us to the only LossLess format available, FLAC. For FLAC there is no need to tweak the configuration, the Encoder is pretty efficient as it is so the only step required is to select the FLAC encoder.

AAC

Even though AAC and ALAC are not supported by WordPress directly, we will show you how to properly set AAC in case you need it for a local project or to include files to download directly.

For AAC it is best to go with AAC Low Complexity at no less than 50kbits per channel. This will give you the best of both worlds – a lower file size than even MP3 and Ogg Vorbis combined with a superior encoder that will most definitely sound equal to MP3 and Ogg Vorbis at higher bitrates such as 160/190kbits.

Apple Lossless (ALAC)

For Apple Lossless there is no option to configure, the encoder will directly encode the file as-is. The resulting output will be similar to that of FLAC.

Resulting File sizes for all formats

Once we have all the files in one place. Let’s see their file sizes so you can better understand the differences.

All the numbers are expressed in bytes

The original WAV is taking the most space because it is uncompressed audio. The following formats are the Lossless Apple Lossless and FLAC where FLAC manages to beat Apple Lossless by a thread, making FLAC an ideal format for your archive purposes. In most situations, lossless formats will reduce file size to about 50% of the original size.

MP3 in ABR as we expected is the next in line with a reduction in file size of more than 5 times the original file. Vorbis goes even further with its VBR format with 3.9Mb followed by MP3 VBR that goes up to 8 times less file size than the original.

Last but not least, it’s the AAC format that proved its power by reducing the size to just 2.2Mb, that’s a total reduction of more than 14x the original file.

Uploading to WordPress

Adding your file to WordPress is as easy as selecting the Audio item on the editor and pointing it to the files. If you have Infinite Uploads installed, your audio files will automatically be stored in the cloud.

That’s it!

Hear the results

Now that you have an idea on what to expect from all these formats, let’s hear them

Original WAV File (Uncompressed)

FLAC (Lossless)

MP3 ABR 256kbits (Lossy)

Ogg Vorbis Quality 6 (Lossy)

MP3 VBR Quality 3 (Lossy)

Were you able to spot the difference?

Summary

There you have it! If you are trying to save space on your server or just want to make your audio files run smoother for online playback, I hope this tutorial was helpful. You’ve learned the difference between Lossy and Lossless formats, which formats are compatible with WordPress and how to use them depending on your needs. We hope this article is useful to you in choosing the appropriate format for your next Audio blog or Podcast project. If you need help uploading large audio files, checkout our tutorial for managing big files in the WordPress media library.

0 Comments

Submit a Comment

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