Question

I would like to get the sample-rate of a given audio file using sox. Couldn't find the commandline to do that.

Was it helpful?

Solution

just use:

soxi <filename>

or

sox --i <filename>

to produce output such as:

Input File     : 'final.flac'
Channels       : 4
Sample Rate    : 44100
Precision      : 16-bit
Duration       : 00:00:11.48 = 506179 samples = 860.849 CDDA sectors
File Size      : 2.44M
Bit Rate       : 1.70M
Sample Encoding: 16-bit FLAC
Comment        : 'Comment=Processed by SoX'

The latter one is in case you're using the win32 version that doesn't include soxi, by default. To grab the sample rate only, just use:

soxi -r <filename>

or

sox --i -r <filename>

which will return the sample rate alone.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top