Tuesday, August 30, 2016

Audio file formats explained and where to get them

ZTE Axon 7 NC 3-18

Smartphones have long since surpassed the old MP3 player when it comes to portable music, and continue to include more and more impressive audio hardware to win over the audiophile crowd – from front facing speakers, to DACs and even new USB Type-C digital audio. Of course, the other half of a good audio experience is the file type you're using, and today's smartphones can play back a wide variety of audio file formats, including the popular MP3 and FLAC formats.

If you're unsure about what the differences are between these formats and want to know how to get the most out of your smartphone's audio, then this guide will walk you though the key things to know, will help breakdown the most common audio file formats, and offer download and streaming suggestions for where to buy these files from.

Lossy vs lossless

Before we delve into specifics of the MP3 or WAV, there's a little bit of general background on digital audio that will help set the scene. Raw audio recorded in a studio and mastered onto physical media, like a CD or hard drive, is saved in a format called Pulse-code modulation (PCM). This data is uncompressed and rather large, as it stores data sample by sample to a certain degree of accuracy, known as bit-depth. Typically, this will be in the form of a 16-bit 44.1kHz stereo file at around 40MB for a 4 minute track, but these days you can find huge 24-bit files with 192kHz sample rates.

Distributing audio through the internet and squeezing tracks into new pieces of hardware with limited storage capacities makes owning a library of PCM files rather unwieldy. Portable audio file sizes needed to be made smaller.

Lossy vs Lossless Spectrum Analysis

Spectral analysis of a track, with frequency content plotted over time. If you look closely at the compressed MP3 version, you can see less data at the higher frequencies.

As such, much of the music that is distributed these days is compressed. This can be done by chopping out bits of data that we don't really need (lossy compression) or varying the sample rate/bit-depth, at the cost of some quality. Alternatively, algorithms can be implemented that re-configure the sound data into a smaller form to be de-compressed later, but without removing any data and thereby preserving sound quality (lossless compression).

Examples of lossless formats include FLAC, WavPack and ALAC. Popular lossy files are the MP3, aiff, and wma types. The table below gives you an example of the different file sizes for the most common formats.

Stereo file sizes (16-bit 44.1kHZ) WAV AIFF FLAC (typical) MP3 (320Kbps) MP3 (192Kbps)
1 min 10.6 MB 10.6 MB 6.4 MB 2.4 MB 1.4 MB
4 mins 41.6 MB 41.6 MB 24.9 MB 9.6 MB 5.6 MB
1 hour 635 MB 635 MB 381 MB 144 MB 84 MB

Without further delay, let's go through these most popular formats, explain how they work, and where you can get them from.

PCM (WAV/AIFF)

Let's start with our biggest lossless file type – Pulse Code Modulation (PCM). As we mentioned earlier, PCM files contains audio in its pursed digital form of individual samples (sample-rate) to a specific degree of accuracy (bit-depth). Therefore, PCM file sizes are directly linked to their length, bit-depth, sample rate, and the number of channels. You can use the formula below to work out the file size of any PCM file:

PCM Size = sample rate X (bits per sample /8) X time in seconds X number of channels 

PCM files are most commonly found in either WAV or AIFF formats. There are essentially Microsoft's and Apple's individual names for the same PCM data. The only real differences here are the type and format of the metadata and header information included alongside the PCM audio track. PCM files come in bit-depths of either 16, 24 or 32 bits and sample rates range from 44.1kHz up to 384kHz these days, although you'll be hard pressed to find many audio files to download at these very largest sizes. Not to mention that such files are complete overkill.

Sine Wave PCM data

In the old days of slower broadband, copying data from physical CDs was the best way to grab raw PCM audio. These days we have lightening fast broadband, and so there are a few download and streaming services that you can can find these tracks on. However given the huge file sizes, many services prefer lossless compressed formats like FLAC, which we'll get to in a just a minute.

  • HDTracks – offers a wide selection of downloads in WAV, AIFF, ALAC, and FLAC formats, with either 16-bit/44.1kHz or 24-bit/94kHz file sizes. Prices range from £16 to £20 per album.
best music streaming apps for androidSee also: 10 best music streaming apps and services for Android38

FLAC

When it comes to lossless audio downloads, FLAC (Free Lossless Audio Codec) has been growing in popularity and is now the go to format at a number of high-quality streaming services. FLAC offers exactly the same audio quality as raw PCM, but manages to compress file sizes by around 30 to 50 percent, depending on the encoder and track contents.

FLAC doesn't cut out any data to shrink its file size, instead it optimizes the way that bits of data are stored by looking for patterns. It might help to think of this as somewhat similar to a .zip or .rar file: the contents are preserved during compression and then restored to reveal the original file for playback. Apple has its own version of lossless audio which it calls ALAC.

The three services that have made the list below offer FLAC streaming and also have dedicated Android apps so that you can take your lossless collection with you on your phone or tablet.

  • Tidal – one of the better known 16-bit/44.1kHZ FLAC streaming services, with over 25 millions tracks. A monthly streaming subscription costs $19.99/£19.99/€19.99, while FLAC albums retail for between $10 and $20 typically.
  • Qobuz – offers 16-bit/44.1kHz FLAC streaming with a £19.99/€19.99 monthly subscription. Customers can also purchase 24-bit tracks as part of the £220/€220 yearly premium package. The service hosts over 30 million tracks from major and independent labels.
  • Deezer – Deezer may be best known for its 40 million song strong free music streaming service, but the company also offers a $9.99/£9.99/€9.99 monthly subscription that boosts the quality to 16-bit/44.1kHz FLAC streaming too.

Google Play Music podcasts AA 8

MP3

MP3 is certainly one of the most popular audio formats, but the standard is much derided by audio enthusiasts for cutting out content. While it's true that a bad MP3 can sound terrible, good quality MP3's offer excellent sound quality for their much smaller sizes, and are still very useful if you want to carry around a large song library or stream over slower 3G and 4G networks.

MP3 is a lossy format, but it uses clever noise shaping algorithms based on psychoacoustic effects of the human ear and brain to remove bits of music that we shouldn't be able to hear. For example, the brain can't differentiate between two frequencies that are right next to each other, the adult human ear struggles to identify the direction of high frequency sounds and begins to lose sensitivity above 16kHz, and loud sounds can mask quieter ones, so these can be removed.

MP3 works by splitting a track up into 576 sample frames, and Fast Fourier Transforms (FFT) are used to obtain frequency data from these frames. This frequency data can then be analysed for masking opportunities, where data can be quantized (rounded) to lower bit-depths to save on space, which varies based on each frame. The data needed to restore each frame is housed in a 32-bit header.

MP3 encoding exampleMp3-tech

The bit-rate determines the maximum allowed file size for each frame, and the more aggressive the compression, the more likely the algorithm is to remove something that is audible. Furthermore, this type of filtering and cutting isn't perfect and the quantization can leave behind artifacts that some people can hear. This lossy psychoacoustic compression is then followed up by a lossless Huffman coding compression that is similar to .zip or FLAC files, in order to reduce the file size further.

  • Google Play Music – Google's MP3 service offers top-notch 320Kbps files, although this can vary on a poor connection, for free with ads or $9.99 per month if you want to avoid ads. The service boasts over 18 million tracks.
  • Amazon Prime Music – The standard streaming bit-rate is set at 256kbps but the Amazon Cloud Player app can lower this if your data connection is poor. Prime Music is included as part of Amazon's $10.99 per month or $99 yearly subscription.

Spotify-2

OGG Vorbis and AAC

Now that we understand roughly how an MP3 file compresses data, we can look at some other MPEG based and similar file formats. Essentially these all use slightly different algorithms for data removable and build on the base psychoacoustic model with additional techniques. Therefore, their bit-rates are not directly comparable in terms of quality, as Vorbis offers better sounding compression at low bit-rates than MP3, but they aren't far off. That being said, MP3 encoders have been fitted with similar improvements over the years too.

For example, Ogg Vorbis is an open-source alternative to MP3 that still uses FFT and MDCT to analyze and quantize mask-able frequency information, but uses a different algorithm. Vorbis also takes the noise-floor into account to improve low bit-rate performance.

Meanwhile, AAC and AAC+, which are used by Tidal, Pandora, and YouTube, are an evolution of the MPEG (MP3) format. ACC allows for higher sample rates up to 96kHz, can dynamically switch frame lengths between 1024/960 or 128/120 samples for better resolution when required, and also performs better at lower files sizes than MP3s. However, high bit-rate MP3 reportedly still sound better.

  • Spotify – Ogg Vorbis is the format of choice here, but quality is limited to a questionable 96Kbps on mobile under normal quality, and 160Kbps on high quality or when using a desktop. Decent 320Kbps quality can only be unlocked with a $9,99 per month Premium subscription.
  • Pandora – US residents can try out Pandora's questionable AAC+ 64Kbps steaming for free, or upgrade to ad-free 192Kbps AAC if they pay a monthly $3.99 cost or $36 for the year. Pandora certainly isn't offering the best quality out there, but it is cheap.
  • Apple Music – also uses the AAC format, but at a higher 256Kbps bit-rate. Individual membership costs $9.99/£9.99/€9.99 per month for unlimited streaming of 30 million tracks, which rivals Spotify for choice.

In summary, today's streaming and music download markets cater to both ends of the consumer market. There are higher quality options for those looking to make the most of their top-notch audio hardware and lower cost streaming services that make the most of intelligent compression techniques to help consumers store large music collections or stream music on-demand over slower wireless networks.

Do you have any preference for your audio formats you use, or perhaps you have a music streaming service of choice? Let us know in the comments below.



from Android Authority http://ift.tt/2c8OwWD
via IFTTT

No comments:

Post a Comment