forked from benfmiller/audalign
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_aligns.sh
272 lines (238 loc) · 10.6 KB
/
run_aligns.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
#!/usr/bin/bash
write_file="workj_results.txt"
if test -f "workj_results.txt"; then
cp $write_file workj_results_last.txt
> $write_file
echo "last fingerprints run cleared, new tests"
fi
echo "Starting run" >> $write_file
echo "------------" >> $write_file
num_runs=0
num_processors=6
technique='fingerprints'
sample_rate=44100
files='audio_files/shifts/'
img_width=0.5
volume_threshold=215
files='audio_files/audio_sync/20200602/'
files='audio_files/audio_sync/20201204/'
files='audio_files/audio_sync/segs/'
files='audio_files/audio_sync/time_diff_claps/line/'
files='audio_files/audio_sync/time_diff_claps/rec/'
files='audio_files/audio_sync/trec1/'
files='audio_files/audio_sync/trec2/'
files='audio_files/audio_sync/trecs/'
# gotta test the noise reduced files, too
# this works great but I don't like the arbitrary 999999
# python3 run_align.py -a 1 | tac | grep -F -m1 -B 999999 '}' | head -n -1 | tac
# exptecting 232 matches for fingerprints
files=( 'audio_files/shifts/' 'audio_files/audio_sync/20200602/' )
for file in "${files[@]}"; do
accuracy=( 1 2 3 4 )
hash_style=( "panako_mod" "panako" "base" "base_three" )
freq_threshold=(0 25 50 100 200)
for f in "${freq_threshold[@]}"; do
for h in "${hash_style[@]}"; do
for a in "${accuracy[@]}"; do
((num_runs=num_runs+1))
echo >> $write_file
echo " $(date +"%T"): run number $num_runs------------------------" >> $write_file
echo " '$file', Hash Style '$h', Accuracy '$a', Frequency Threshold '$f'">> $write_file
echo >> $write_file
echo "$(date +"%T"): Running number $num_runs"
echo " '$file', Hash Style '$h', Accuracy '$a', Frequency Threshold '$f'"
result=$(python3 run_align.py -a $a -s $h -r $f -f $file)
echo "$result" | rg "Total fingerprints" >> $write_file
echo >> $write_file
echo "$result" | tac | sed '/}/Q' | tac | rg -N "\S" >> $write_file
done
done
done
locality=( 5 15 )
accuracy=( 2 3 )
hash_style=( "panako_mod" "base" )
freq_threshold=(0 50 100 )
for l in "${locality[@]}"; do
for f in "${freq_threshold[@]}"; do
for h in "${hash_style[@]}"; do
for a in "${accuracy[@]}"; do
((num_runs=num_runs+1))
echo >> $write_file
echo " $(date +"%T"): run number $num_runs------------------------" >> $write_file
echo " '$file', Hash Style '$h', Accuracy '$a', Frequency Threshold '$f', Locality '$l'">> $write_file
echo >> $write_file
echo "$(date +"%T"): Running number $num_runs"
echo " '$file', Hash Style '$h', Accuracy '$a', Frequency Threshold '$f', Locality '$l'"
result=$(python3 run_align.py -a $a -s $h -r $f -l $l -f $file)
echo "$result" | rg "Total fingerprints" >> $write_file
echo >> $write_file
echo "$result" | tac | sed '/}/Q' | tac | rg -N "\S" >> $write_file
done
done
done
done
done
files=( 'audio_files/shifts/' 'audio_files/audio_sync/20200602/' 'audio_files/audio_sync/20201204/' 'audio_files/audio_sync/trec1/' )
for file in "${files[@]}"; do
accuracy=( 4 )
hash_style=( "panako_mod")
freq_threshold=( 50 100 )
for f in "${freq_threshold[@]}"; do
for h in "${hash_style[@]}"; do
for a in "${accuracy[@]}"; do
((num_runs=num_runs+1))
echo >> $write_file
echo " $(date +"%T"): run number $num_runs------------------------" >> $write_file
echo " '$file', Hash Style '$h', Accuracy '$a', Frequency Threshold '$f'">> $write_file
echo >> $write_file
echo "$(date +"%T"): Running number $num_runs"
echo " '$file', Hash Style '$h', Accuracy '$a', Frequency Threshold '$f'"
result=$(python3 run_align.py -a $a -s $h -r $f -f $file)
echo "$result" | rg "Total fingerprints" >> $write_file
echo >> $write_file
echo "$result" | tac | sed '/}/Q' | tac | rg -N "\S" >> $write_file
done
done
done
locality=( 5 15 )
accuracy=( 4 )
hash_style=( "panako_mod" )
freq_threshold=( 50 100 )
for l in "${locality[@]}"; do
for f in "${freq_threshold[@]}"; do
for h in "${hash_style[@]}"; do
for a in "${accuracy[@]}"; do
((num_runs=num_runs+1))
echo >> $write_file
echo " $(date +"%T"): run number $num_runs------------------------" >> $write_file
echo " '$file', Hash Style '$h', Accuracy '$a', Frequency Threshold '$f', Locality '$l'">> $write_file
echo >> $write_file
echo "$(date +"%T"): Running number $num_runs"
echo " '$file', Hash Style '$h', Accuracy '$a', Frequency Threshold '$f', Locality '$l'"
result=$(python3 run_align.py -a $a -s $h -r $f -l $l -f $file)
echo "$result" | rg "Total fingerprints" >> $write_file
echo >> $write_file
echo "$result" | tac | sed '/}/Q' | tac | rg -N "\S" >> $write_file
done
done
done
done
done
# ------------------------------- correlation
# expecting 240 alignments for both correlations in total
write_file="workj_results_correlation.txt"
if test -f $write_file; then
cp $write_file workj_results_last_correlation.txt
> $write_file
echo "last correlation run cleared, new tests"
fi
technique="correlation"
files=( 'audio_files/shifts/' 'audio_files/audio_sync/20200602/' 'audio_files/audio_sync/20201204/' 'audio_files/audio_sync/trec1/' )
for file in "${files[@]}"; do
freq_threshold=( 25 50 100 )
sample_rates=( 4000 8000 16000 44100 )
for r in "${freq_threshold[@]}"; do
for m in "${sample_rates[@]}"; do
((num_runs=num_runs+1))
echo >> $write_file
echo " $(date +"%T"): run number $num_runs------------------------" >> $write_file
echo " '$file', Frequency Threshold '$r', Sample Rate '$m', $technique">> $write_file
echo >> $write_file
echo "$(date +"%T"): Running number $num_runs"
echo " '$file', Frequency Threshold '$r', Sample Rate '$m', $technique"
result=$(python3 run_align.py -t $technique -r $r -m $m -f $file)
echo "$result" | rg "Total fingerprints" >> $write_file
echo >> $write_file
echo "$result" | tac | sed '/}/Q' | tac | rg -N "\S" >> $write_file
done
done
locality=( 5 15 25 )
freq_threshold=( 50 100 )
sample_rates=( 8000 16000 44100 )
for l in "${locality[@]}"; do
for r in "${freq_threshold[@]}"; do
for m in "${sample_rates[@]}"; do
((num_runs=num_runs+1))
echo >> $write_file
echo " $(date +"%T"): run number $num_runs------------------------" >> $write_file
echo " '$file', Frequency Threshold '$r', Sample Rate '$m', Locality '$l', $technique">> $write_file
echo >> $write_file
echo "$(date +"%T"): Running number $num_runs"
echo " '$file', Frequency Threshold '$r', Sample Rate '$m', Locality '$l', $technique"
result=$(python3 run_align.py -t $technique -r $r -m $m -l $l -f $file)
echo "$result" | rg "Total fingerprints" >> $write_file
echo >> $write_file
echo "$result" | tac | sed '/}/Q' | tac | rg -N "\S" >> $write_file
done
done
done
done
# ------------------------------- correlation spectrogram
write_file="workj_results_correlation_spectrogram.txt"
if test -f $write_file; then
cp $write_file workj_results_last_correlation_spectrogram.txt
> $write_file
echo "last correlation spectrogram run cleared, new tests"
fi
technique="correlation_spectrogram"
files=( 'audio_files/shifts/' 'audio_files/audio_sync/20200602/' 'audio_files/audio_sync/20201204/' 'audio_files/audio_sync/trec1/' )
for file in "${files[@]}"; do
freq_threshold=( 25 50 100 )
sample_rates=( 4000 8000 16000 44100 )
for r in "${freq_threshold[@]}"; do
for m in "${sample_rates[@]}"; do
((num_runs=num_runs+1))
echo >> $write_file
echo " $(date +"%T"): run number $num_runs------------------------" >> $write_file
echo " '$file', Frequency Threshold '$r', Sample Rate '$m', $technique">> $write_file
echo >> $write_file
echo "$(date +"%T"): Running number $num_runs"
echo " '$file', Frequency Threshold '$r', Sample Rate '$m', $technique"
result=$(python3 run_align.py -t $technique -r $r -m $m -f $file)
echo "$result" | rg "Total fingerprints" >> $write_file
echo >> $write_file
echo "$result" | tac | sed '/}/Q' | tac | rg -N "\S" >> $write_file
done
done
locality=( 5 15 25 )
freq_threshold=( 50 100 )
sample_rates=( 8000 16000 44100 )
for l in "${locality[@]}"; do
for r in "${freq_threshold[@]}"; do
for m in "${sample_rates[@]}"; do
((num_runs=num_runs+1))
echo >> $write_file
echo " $(date +"%T"): run number $num_runs------------------------" >> $write_file
echo " '$file', Frequency Threshold '$r', Sample Rate '$m', Locality '$l', $technique">> $write_file
echo >> $write_file
echo "$(date +"%T"): Running number $num_runs"
echo " '$file', Frequency Threshold '$r', Sample Rate '$m', Locality '$l', $technique"
result=$(python3 run_align.py -t $technique -r $r -m $m -l $l -f $file)
echo "$result" | rg "Total fingerprints" >> $write_file
echo >> $write_file
echo "$result" | tac | sed '/}/Q' | tac | rg -N "\S" >> $write_file
done
done
done
done
# let time_took = $results | tail -n 1
# echo $now
# echo "$time_took"
# temp_results=$(< workj_temp.txt)
# temp_results=""
# while IFS= read -r line; do
# temp_results=$temp_results$line
# echo "Text read from file: $line"
# done < workj_temp.txt
# $temp_results | grep "took" | cat
# echo $temp_results
# python3 run_align.py -a 1 > workj_temp.txt
# echo $img_width
echo >> $write_file
echo "--------------------" >> $write_file
echo "$num_runs total runs" >> $write_file
echo
echo "--------------------"
echo "$num_runs total runs"
echo
echo "All Done!!"