[LAU] Discovering file format

Ralf Mardorf ralf.mardorf at alice-dsl.net
Sat Sep 19 22:04:38 UTC 2015


On Sat, 19 Sep 2015 22:12:36 +0100, Will J Godfrey wrote:
>As it was only uncompressed files I was looking at 'file' turned out
>to be the simplest and fastest. I simply redirected the output to
>create a text file, then picked it up with kwrite. As each entry was
>on a single line I bulk replaced the unwanted bits with nothing and
>ended up with a list like this:
>
>The_Long_Years                   24 bit, 44100 Hz
>The_Man_With_The_Hat             16 bit, 44100 Hz
>The_Mystic                       16 bit, 44100 Hz
>The_Piper                        16 bit, 44100 Hz
>The_Storm                        24 bit, 48000 Hz
>...
>Who_Cares                        16 bit, 44100 Hz
>Widow                            16 bit, 44100 Hz
>Wimpole                          16 bit, 48000 Hz
>Wires                            16 bit, 44100 Hz
>Yoshimi_Rides_Home               16 bit, 48000 Hz

You don't need to do it manually, you could use command line to format
the list.

$ printf "%-35s\t\t%s %s\t%s\n" $(file *wav|grep -v link|awk '{print $1" "$9" "$10" "$12}') >~/formated_wav_list.txt

$ cat ~/formated_wav_list.txt 
robo´s_harp-raw_a-1.wav:          		16 bit,	44100
robo´s_harp_raw_a_off-key.wav:    		16 bit,	44100
robo´s_harp_raw_f#_at.wav:        		16 bit,	44100
robo´s_harp-raw´n´syn_a-1.wav:  		16 bit,	44100
robo´s_harp_raw´n´syn_a_off-key.wav:		16 bit,	44100
robo´s_harp_raw´n´syn_f#_at.wav:		16 bit,	44100
robo´s_harp-syn_a-1.wav:          		16 bit,	44100
robo´s_harp_syn_a_off-key.wav:    		16 bit,	44100
robo´s_harp_syn_f#_at.wav:        		16 bit,	44100

$ sed -i s/":"/" "/g ~/formated_wav_list.txt 

$ cat ~/formated_wav_list.txt 
robo´s_harp-raw_a-1.wav           		16 bit,	44100
robo´s_harp_raw_a_off-key.wav     		16 bit,	44100
robo´s_harp_raw_f#_at.wav         		16 bit,	44100
robo´s_harp-raw´n´syn_a-1.wav   		16 bit,	44100
robo´s_harp_raw´n´syn_a_off-key.wav 		16 bit,	44100
robo´s_harp_raw´n´syn_f#_at.wav 		16 bit,	44100
robo´s_harp-syn_a-1.wav           		16 bit,	44100
robo´s_harp_syn_a_off-key.wav     		16 bit,	44100
robo´s_harp_syn_f#_at.wav         		16 bit,	44100

Regards,
Ralf


More information about the Linux-audio-user mailing list