I am using the following conversion code using SOX for converting all raw files to wav files in 16 KHZ, 16 bits, mono format. I used the following code
I used the following code
#!/bin/bash
OutDir=converted
for input in "$@"
do sox -S $input -r 16000 -c 1 -b 16 -w -s -t raw "$OutDir/$(basename $input)"
done
The following errors are observed although i have mentioned sampling rate -r 16000
bsnayak@ubuntu:~/MLLR/input$ ls
an251-fash-b.raw an254-fash-b.raw cen1-fash-b.raw cen4-fash-b.raw cen7-fash-b.raw convert.sh
an253-fash-b.raw an255-fash-b.raw cen2-fash-b.raw cen5-fash-b.raw converted
bsnayak@ubuntu:~/MLLR/input$ ./convert.sh /home/bsnayak/MLLR/input/*.raw
sox FAIL formats: bad input format for file `/home/bsnayak/MLLR/input/an251-fash-b.raw': sampling rate was not specified
sox FAIL formats: bad input format for file `/home/bsnayak/MLLR/input/an253-fash-b.raw': sampling rate was not specified
sox FAIL formats: bad input format for file `/home/bsnayak/MLLR/input/an254-fash-b.raw': sampling rate was not specified
sox FAIL formats: bad input format for file `/home/bsnayak/MLLR/input/an255-fash-b.raw': sampling rate was not specified
sox FAIL formats: bad input format for file `/home/bsnayak/MLLR/input/cen1-fash-b.raw': sampling rate was not specified
sox FAIL formats: bad input format for file `/home/bsnayak/MLLR/input/cen2-fash-b.raw': sampling rate was not specified
sox FAIL formats: bad input format for file `/home/bsnayak/MLLR/input/cen4-fash-b.raw': sampling rate was not specified
sox FAIL formats: bad input format for file `/home/bsnayak/MLLR/input/cen5-fash-b.raw': sampling rate was not specified
sox FAIL formats: bad input format for file `/home/bsnayak/MLLR/input/cen7-fash-b.raw': sampling rate was not specified
Feel free for suggestions.
Solved using followinf command:
#!/bin/bash
SAVEIF=$IFS
IFS=$(echo -en "\n\b")
for file in $(ls *raw)
do
name=${file%%.raw}
sox -S -V -r 16k -e signed -c 1 -b 16 $name.raw $name.wav
done
IFS=$SAVEIFS