Given two directories with all the tracks of an album, could we automatically compare them in terms of quality?
There are several values which can be automatically obtained (Bitrate, for instance, is one of the most popular. Some people would even use this data as part of the directory's name).
Others are purely subjective. For instance, overall audio quality, as the perceived by the user while hearing the album. A high bitrate means nothing when the quality of the original audio source is not so good.
And then, every user will grant different weights to each value. For instance, some people prefer an album with a higher mean bitrate, and other people prefer an album where all the tracks share the same properties (thus indicating that probably all the tracks come from the same original source).
Obviously, same mp3 properties doesn't garantize that all the tracks come from the same physical album, they could come from different album releases (perhaps even different remasters, with very different sound qualities or with differences in the songs themselves)
We will list all the values that we want to measure, and how can we doit, using free software on a POSIX environment (Unix, Linux, OS X, Cygwin).
Bitrate (from "lame" documentation): Bitrate is of course the main influence on quality. The higher the bitrate, the higher the quality.
Bitrate is not so simple as it seems. If all the tracks use the same constant bitrate (CBR), there is no problem. But we have serveral different scenarios:
Detected by: [ 1 == `mp3info -p '%r\n' *mp3 | sort -u | wc -l` ] [ 0 -lt `expr \`mp3info -p '%r\n' 01*mp3\` : '[0-9][0-9]*'` ] Value: mp3info -p '%r\n' 01*mp3 Typical values (from worse to better): MPEG-1 layer III bitrates (kbps): 32 40 48 56 64 80 96 112 128 160 192 224 256 320
Detected by: [ 1 -lt `mp3info -p '%r\n' *mp3 |sort -u |wc -l` ] [ 0 -eq `mp3info -p '%r\n' *mp3 |egrep -v -e '^[0-9][0-9]*$' |wc -l` ]
Detected by: [ 1 == `mp3info -p '%r\n' *mp3 | sort -u | wc -l` ] [ "Variable" == `mp3info -p '%r\n' 01*mp3` ]
Detected by: [ 1 -lt `mp3info -p '%r\n' *mp3 |sort -u |wc -l` ] [ 0 -lt `mp3info -p '%r\n' *mp3 |egrep -v -e '^[0-9][0-9]*$' |wc -l` ]
Values for all the above
mp3info -r a -p '%f %.2r\n' *mp3
mp3info -r a -p '%r %S %b\n' *mp3 |\ awk ' BEGIN { min=400 } { time += $2; if ( $1 < min ) min = $1; if ( $1 > max ) max = $1; total += $1 * $2; } END { printf( "%0.2f\t%d\t%d\n", total/time , min, max )}'
Note: it seems there is a bug in mp3info. For the same file reports different bitrates depending on format string:
$ mp3info -p '%b %r\n' 07* 0 Variable $ mp3info -p ' %r\n' 07* 192 (This particular file uses VBR, so the first one is right) As a workaround we could use mp3info -p '%b %r\n' *mp3 | sed -e 's/^[0-9]* //' instead of mp3info -p '%r\n' *mp3
The most common sampling rate is 44.1 KHz, being the original sampling rate for CD-Audio.
Sometimes you can find also 48 KHz, wich could mean that original source is DAT, or, most probably, that someone has resampled the digital audio data without knowing was he or she was doing.
MPEG-1 Layer III allows also 32 KHz, and you can find also MPEG 2.0 Layer III 22 KHz files, for instance. Most people find anything below 44.1 KHz sub-standard
As with bitrates, we could have mixed sampling rates.
Detected by: [ 1 == `mp3info -p '%Q\n' *mp3 |sort -u |wc -l` ] Values (in Hz): mp3info -p '%Q\n' 01*mp3
Detected by: [ 1 -lt `mp3info -p '%Q\n' *mp3 |sort -u |wc -l` ] Values (in Hz, min, max): mp3info -r a -p '%Q\n' *mp3 |\ awk ' BEGIN { min=80000 } { if ( $1 < min ) min = $1; if ( $1 > max ) max = $1; } END { printf( "%d\t%d\n", min, max )}'
There are serveral stereo modes, but usually you can't tell the quality from the stereo mode used. For any stereo mode quality depends heavily on the encoder used.
Perhaps one could use the stereo mode to spot suspicius files. For instance, very little (if any) albums since 1980 are released with monophonic audio.
Typical values:
Anyway, as always, a mix of "stereo modes", points to an album compiled from different sources.
Detected by: [ 1 == `mp3info -p '%o\n' *mp3 |sort -u |wc -l` ] Values: mp3info -p '%Q\n' 01*mp3
Detected by: [ 1 -lt `mp3info -p '%o\n' *mp3 |sort -u |wc -l` ] Values: mp3info -p '%o\n' *mp3 | sort | uniq -c
Last Modified: April 10, 2015