forked from julik43/Online-Identification-of-New-Speakers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
change_m4a_to_flac.sh
executable file
·66 lines (54 loc) · 1.2 KB
/
change_m4a_to_flac.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
usage (){
echo "Usage: bash change_corpus_sr.sh corpus_location new_corpus_location sample_rate"
}
if [ -z "$1" ]
then
echo "No corpus location was given."
usage
exit
fi
if [ -z "$2" ]
then
echo "No new corpus location was given."
usage
exit
fi
DIRS=$1/*
for d in $DIRS
do
if [ -d "$d" ]
then
echo "Processing 1st level $d ..."
DIRS2=$d/*
for d2 in $DIRS2
do
if [ -d "$d2" ]
then
echo "Processing 2nd level $d2 ..."
DIRS3=$d2/*
for d3 in $DIRS3
do
if [ -d "$d3" ]
then
echo "Processing 3rd level $d3 ..."
NEWDIRBASE="$2/$(basename $d)/$(basename $d2)/$(basename $d3)"
mkdir -p $NEWDIRBASE
FILES=$d3/*.m4a
#echo $FILES
for f in $FILES
do
echo "Processing file $f ..."
new_f=${f/%m4a/flac}
avconv -i "$f" "$new_f"
NEWF="$NEWDIRBASE/$(basename $new_f)"
echo " moving to $NEWF ..."
mv "$new_f" $NEWF
done
fi
done
fi
done
fi
done
echo "done."