posted on 2016-12-21 at 12:30 EST
The impetus for this article is a post by a friend that Facebook pushed into my feed. In it, his friend asserts that Pandora's audio is worse than Spotify's audio. My friend responds with each services respective streaming bitrates. While the answer isn't wrong, it isn't complete; the two services use different formats, thus making a simple bitrate comparison impossible.
Pandora's support indicates that they encode their audio using Advanced Audio Coding (AAC) at bitrates of 64Kbps on the web for free listeners, up to and including 64Kbps for mobile, 128Kbps for home devices (e.g. Sony STR-DN1040 receiver), and 192Kbps for subscribers.
There are a few things to notice in these statements:
- Spotify is clearly stating that they use Variable Bitrate encoding (VBR)
by prefixing their rates with a
- Pandora doesn't give any indication they use VBR, so we can only assume they encode with Constant Bitrate encoding (CBR).
- They use completely different encoding algorithms.
Given the information in Bitrates, we can devise an analyical method for comparing the two services:
- Acquire a source sample with very high quality.
- Encode the source sample into the various formats at the various bitrates.
- we will use CBR encoding to keep things simple
- Create a spectrogram of each sample.
As our source, we will use a sample from my 2015 release Thirty-six. This sample is a raw audio file recorded at 96Khz per second with a resolution of 24bit. The sample covers the audio range fairly well:
The full details of which are:
Input File : 'source-sample.wav' Channels : 2 Sample Rate : 96000 Precision : 24-bit Duration : 00:00:12.00 = 1152000 samples ~ 900 CDDA sectors File Size : 6.91M Bit Rate : 4.61M Sample Encoding: 24-bit Signed Integer PCM
Additionally, we must consider that the majority of Spotify's and Pandora's source material comes from Compact Discs (CDs). Thus, their source material has a sample rate of 44.1KHz per second with a resolution of 16bit. Therefore, we will also encode our source sample to a reference sample with the same detail. The reference sample's spectrogram looks like:
It is from this reference sample that we will generate the remaining samples.
Notice that this sample already has a lot more noise in the spectrogram when compared to the source's spectrogram. This indicates that no matter what encoder or bitrate is used, Spotify and Pandora (in the majority of cases) will never be able to stream a true representation of the music.
% sox source-sample.wav -b 16 -r 44100 reference-sample.wav % soxi reference-sample.wav Input File : 'reference-sample.wav' Channels : 2 Sample Rate : 44100 Precision : 16-bit Duration : 00:00:12.00 = 529200 samples = 900 CDDA sectors File Size : 2.12M Bit Rate : 1.41M Sample Encoding: 16-bit Signed Integer PCM
It is important to note that we must use sox's
-C parameter to encode into
Ogg Vorbis. The details of which mean that we cannot explicitly
specify sample rates. This is a limitation (feature) of the format, and is why
Spotify cannot give explicit rates.
Our AAC encodings are created using FAAC because sox will not ship AAC encoding due to patent restrictions.
Normal Desktop Rates
Let's start our comparison by investigating each service's normal desktop encodings and bitrates for free listeners. We can clearly see from the spectrograms that at the normal, free tier, Spotify captures much more of the source audio than does Pandora. It's very likely you will have a hard time distinguishing the Spotify stream from their source material (the refrence sample in our tests). Whereas Pandora will be very noticeably different.
% sox reference-sample.wav -C 4 spotify-normal.ogg % soxi spotify-normal.ogg Input File : 'spotify-normal.ogg' Channels : 2 Sample Rate : 44100 Precision : 16-bit Duration : 00:00:12.00 = 529200 samples = 900 CDDA sectors File Size : 245k Bit Rate : 163k Sample Encoding: Vorbis Comment : 'Comment=Processed by SoX' % sox spotify-normal.ogg -n spectrogram -t "Spotify Normal" -o spotify-normal-spectrogram.png
% faac -b 64 -o pandora-normal.m4a reference-sample.wav Freeware Advanced Audio Coder FAAC 1.28 Average bitrate: 64 kbps Quantization quality: 100 Bandwidth: 5604 Hz Object type: Low Complexity(MPEG-4) + M/S Container format: MPEG-4 File Format (MP4) Encoding reference-sample.wav to pandora-normal.m4a frame | bitrate | elapsed/estim | play/CPU | ETA 518/518 (100%)| 64.0 | 0.2/0.2 | 72.48x | 0.0 % faad pandora-normal.m4a -o pandora-normal.wav % sox pandora-normal.wav -n spectrogram -t "Pandora Normal" -o pandora-normal-spectrogram.png
High Quality Rates
I this test we will look at Spotify's regular, free, "high quality" rate of ~192Kbps and Pandora's subscriber only "high quality" 192Kbps rate. This will give us our closest "apples to apples" comparision possible.
In this comparison we can see that both are capturing mostly the same amount of detail. However, the Ogg Vorbis encoding is capturing much more detail above 16KHz. This coincides very much with the average adult's range of hearing.
% sox reference-sample.wav -C 5 spotify-high.ogg % soxi spotify-high.ogg Input File : 'spotify-high.ogg' Channels : 2 Sample Rate : 44100 Precision : 16-bit Duration : 00:00:12.00 = 529200 samples = 900 CDDA sectors File Size : 298k Bit Rate : 198k Sample Encoding: Vorbis Comment : 'Comment=Processed by SoX' % sox spotify-high.ogg -n spectrogram -t "Spotify High" -o spotify-high-spectrogram.png
% faac -b 192 -o pandora-high.m4a reference-sample.wav [s:0 l:3954] Freeware Advanced Audio Coder FAAC 1.28 Average bitrate: 152 kbps Quantization quality: 100 Bandwidth: 16000 Hz Object type: Low Complexity(MPEG-4) + M/S Container format: MPEG-4 File Format (MP4) Encoding reference-sample.wav to pandora-high.m4a frame | bitrate | elapsed/estim | play/CPU | ETA 518/518 (100%)| 152.3 | 0.2/0.2 | 52.24x | 0.0 % faad pandora-high.m4a -o pandora-high.wav % sox pandora-high.wav -n spectrogram -t "Pandora High" -o pandora-high-spectrogram.png
If we assume that I have come within an acceptable degree of modeling the encoding environments of both Spotify and Pandora, we can only conclude that Spotify streams the better audio. However, since sox does not support AAC files at all, we can't be too sure of our results. The sox and faac tools are very different, and would be even if sox supported AAC.
What is most concerning to me is the fact that faac seems to be using a low pass filter set at 16KHz for its upper threshold. If that is the case, then the Pandora results are not completely accurate. And I have hard time believing that Pandora would stream with such a cutoff.
Thus, if we assume Pandora's tooling does not have this 16KHz cutoff like faac does, we can theorize that Pandora's encodings would include more detail above 16KHz just as Spotify's streams would (based on our findings). Which leads me to the conclusion that Spotify is better for free users, but either service will be roughly equal for paid users.
Full discolsure: I do not use Spotify. I am a paid Pandora subscriber.