[LAU] Discovering file format

Dave Phillips dlphillips at woh.rr.com
Sat Sep 19 20:26:08 UTC 2015


On 09/19/2015 04:13 PM, Will Godfrey wrote:
> I have about 150 uncompressed audio files that I want to properly categorise,
> relatively quickly.
>
> The very oldest were recorded as 16bit 44.1k, more recent ones were 16bit, 48k
> and the latest ones 24bit 48k.
>
> I've moved them all into the same directory, so is there a simple script I can
> run that will scan this and list the name and details of each file?
>
> I can find plenty of programs that can change the format, but can't find any
> that will just tell me what it is :(
>

Maybe this :

     $ file bunting.wav
     bunting.wav: RIFF (little-endian) data, WAVE audio, Microsoft PCM, 
16 bit, mono 44100 Hz

It works with wildcards.

     $file *.*

And you can redirect the output.

     $file *.* > mylist

The sfinfo utility is even better :

     $ sfinfo bunting.wav
     File Name      bunting.wav
     File Format    Microsoft RIFF WAVE Format (wave)
     Data Format    16-bit integer (2's complement, little endian)
     Audio Data     4398656 bytes begins at offset 44 (2c hex)
                    1 channel, 2199328 frames
     Sampling Rate  44100.00 Hz
     Duration       49.871 seconds

Also works with wildcards and redirection.

HTH,

dp


More information about the Linux-audio-user mailing list