• WANTED: Happy members who like to discuss audio and other topics related to our interest. Desire to learn and share knowledge of science required. There are many reviews of audio hardware and expert members to help answer your questions. Click here to have your audio equipment measured for free!

How to analyze audio library

jogi

Member
Joined
Aug 25, 2022
Messages
5
Likes
3
Location
Slovakia
Hi, I'm trying to analyze my music library consisting only of flacs with different sample rate and bit depth. I'm using PlexMediaServer + Plexamp or Volumio for listening. But none of those server has a rich statistics about the music. I'm specially interested about the sample rate and bit depth. Can your recommend any tool for analysing whole library (ideally mac or linux)?
 

fatoldgit

Active Member
Joined
Feb 29, 2020
Messages
295
Likes
344
On linux:

use an editor from the command line or gui (I am old skool so its always "vi" ***) to create a file called say "chk" with the following:

find . -print | grep -i "flac$" | sort |
while read nam
do
file "${nam}"
done


then just sh ./chk

Note that you would create/run chk at the top of the directory where your flac files are.

Also note if you cut and paste the above, make sure there are no blank lines.

If your file names have some funky characters (like $, & etc), then the above may abort at some point during execution but the above is all readonly/non-destuctive.

If you have these types of issues then we can use "sed" or "awk" to "escape" these types of characters but lets see how the above works (i.e. rather than boil the ocean anticipating what might never happen, lets see if you get issues and I can help to get a clean run)

Example output might be:

./rips/flac/George Smith/[1969]Blues With a Feeling/06 - Tell Me Mama.flac: FLAC audio bitstream data, 16 bit, stereo, 44.1 kHz, 7269602 samples
./rips/flac/George Smith/[1969]Blues With a Feeling/05 - West Helena Woman.flac: FLAC audio bitstream data, 16 bit, stereo, 44.1 kHz, 9502969 samples
./rips/flac/George Smith/[1969]Blues With a Feeling/11 - Too Late.flac: FLAC audio bitstream data, 16 bit, stereo, 44.1 kHz, 8503163 samples
./rips/flac/George Smith/[1969]Blues With a Feeling/02 - Can't Hold Out Much Longer.flac: FLAC audio bitstream data, 16 bit, stereo, 44.1 kHz, 8119597 samples
./rips/flac/George Smith/[1969]Blues With a Feeling/09 - Key To The Highway.flac: FLAC audio bitstream data, 16 bit, stereo, 44.1 kHz, 6637282 samples
./rips/flac/George Smith/[1969]Blues With a Feeling/04 - Juke.flac: FLAC audio bitstream data, 16 bit, stereo, 44.1 kHz, 8452056 samples
./rips/flac/George Smith/[1969]Blues With a Feeling/07 - Last Night.flac: FLAC audio bitstream data, 16 bit, stereo, 44.1 kHz, 11518964 samples
bob1.flac: FLAC audio bitstream data, 24 bit, stereo, 96 kHz, 15974400 samples
bob.flac: FLAC audio bitstream data, 24 bit, stereo, 96 kHz, 15974400 samples


To help in finding "stuff" of interest you could for example:

sh ./chk | cut -d':' -f2-2 | cut -d',' -f1-4 | sort -u will give you a summary of all your different sample rates and bit depths
sh ./chk | grep -v "16 bit" to find those that are not 16 bit
sh ./chk | grep "16 bit" to find those that are 16 bit
sh ./chk | grep "24 bit" | grep -v "96 kHz" to find those that are 24 bit but not 96 Khz

You could add | wc -l to the end of any of these to get the number of files matching the search such as sh ./chk | grep "16 bit" | wc -l to get number of 16 bit files

The "-v" excludes while no "-v" means include and the bit in quotes is part of whatever the output states. You can stack as many | grep xxxxx as needed

There is also a more powerful version of "grep" called "egrep" but of course linux command line stuff can be very obtuse so I wont cover it off here.

Peter

*** If you have NO editor skills then worst case you could do this (cut and paste each line into your terminal/shell session)

echo 'find . -print | grep -i "flac$" | sort | ' > chk
echo ' while read nam' >> chk
echo ' do' >> chk
echo ' file "${nam}" ' >> chk
echo ' done' >> chk
 
Last edited:

Daverz

Major Contributor
Joined
Mar 17, 2019
Messages
1,309
Likes
1,475
I'd use metaflac to get the bit depth and sample rate:

find . -iname "*.flac" -print0 | xargs -0 metaflac --show-sample-rate --show-bps | sort > sample_rate+bps.txt

That will find all files ending in .flac (case-insensitive) under the current directory and write the filenames, bit depths and sample rates to a file.
 

Chrispy

Master Contributor
Forum Donor
Joined
Feb 7, 2020
Messages
7,938
Likes
6,094
Location
PNW
I'd use metaflac to get the bit depth and sample rate:

find . -iname "*.flac" -print0 | xargs -0 metaflac --show-sample-rate --show-bps | sort > sample_rate+bps.txt

That will find all files ending in .flac (case-insensitive) under the current directory and write the filenames, bit depths and sample rates to a file.
Curious, will that show the flac bitrate or the original format? On the gear I've got I only see the bit rate of the compressed file with flac, altho it definitely gives me an idea of the uncompressed format bitrate....)
 

fatoldgit

Active Member
Joined
Feb 29, 2020
Messages
295
Likes
344
I'd use metaflac to get the bit depth and sample rate:

find . -iname "*.flac" -print0 | xargs -0 metaflac --show-sample-rate --show-bps | sort > sample_rate+bps.txt

That will find all files ending in .flac (case-insensitive) under the current directory and write the filenames, bit depths and sample rates to a file.

The above reminded me that not everyone would use lower case "flac" so I modded my stuff to use case insensitive greps

The only "issue" (not trolling!!!!!) with your example is you get the bit depth and sample rate on two different lines... see below.. (where as "file" will give it on one line) but yes, for a newbie, your example would be easier to run.

./rips/flac/George Smith/[1969]Blues With a Feeling/11 - Too Late.flac:16
./rips/flac/George Smith/[1969]Blues With a Feeling/11 - Too Late.flac:44100


Once they have the output file, as per above, then cat sample_rate+bps.txt | grep xxxx | grep xxx will help with refining whatever additional searches are needed (if any)

They could also use cat sample_rate+bps.txt | grep xxxx | grep xxx | wc -l to get count of various searches
 

fatoldgit

Active Member
Joined
Feb 29, 2020
Messages
295
Likes
344
Curious, will that show the flac bitrate or the original format? On the gear I've got I only see the bit rate of the compressed file with flac, altho it definitely gives me an idea of the uncompressed format bitrate....)

Running "find . -iname "*.flac" -print0 | xargs -0 metaflac --show-sample-rate --show-bps | sort" on the small number of flac files I have on my desktop system, it returns the original WAV file values NOT the compression and VBS rate of the flac file
 

Eetu

Addicted to Fun and Learning
Forum Donor
Joined
Mar 11, 2020
Messages
763
Likes
1,180
Location
Helsinki
PlexAmp shows the bit depth, sample rate and codec. OP probably means statistics/filtering compassing the entire library, not on an album/track -level.
IMG_20221013_175332.jpg
 

ernestcarl

Major Contributor
Joined
Sep 4, 2019
Messages
3,110
Likes
2,327
Location
Canada
JRiver (works in linux and mac besides windows) has a customizable simple file list and chart view display where you can apply filter(s) by file path, genre, sample rate, bit depth, file type etc.

example:

1665677585575.jpeg
 
Top Bottom