Skip to content

Commit 76c9d31

Browse files
committed
done with results.json
1 parent 4f65168 commit 76c9d31

35 files changed

+173
-60
lines changed
6.2 KB
Loading
7.22 KB
Loading

Database/Testing/WAV/TEST1.wav

-191 KB
Binary file not shown.

Database/Testing/WAV/TEST10.wav

73.1 KB
Binary file not shown.

Database/Testing/WAV/TEST11.wav

20.6 KB
Binary file not shown.

Database/Testing/WAV/TEST12.wav

137 KB
Binary file not shown.

Database/Testing/WAV/TEST13.wav

-24.4 KB
Binary file not shown.

Database/Testing/WAV/TEST14.wav

-18.8 KB
Binary file not shown.

Database/Testing/WAV/TEST15.wav

-30 KB
Binary file not shown.

Database/Testing/WAV/TEST16.wav

-65.6 KB
Binary file not shown.

Database/Testing/WAV/TEST17.wav

-16.9 KB
Binary file not shown.

Database/Testing/WAV/TEST18.wav

-182 KB
Binary file not shown.

Database/Testing/WAV/TEST2.wav

-14.8 KB
Binary file not shown.

Database/Testing/WAV/TEST20.wav

-236 KB
Binary file not shown.

Database/Testing/WAV/TEST21.wav

-197 KB
Binary file not shown.

Database/Testing/WAV/TEST22.wav

-116 KB
Binary file not shown.

Database/Testing/WAV/TEST23.wav

-180 KB
Binary file not shown.

Database/Testing/WAV/TEST3.wav

5.42 KB
Binary file not shown.

Database/Testing/WAV/TEST4.wav

-12.9 KB
Binary file not shown.

Database/Testing/WAV/TEST5.wav

-128 KB
Binary file not shown.

Database/Testing/WAV/TEST6.wav

-41.5 KB
Binary file not shown.

Database/Testing/WAV/TEST7.wav

-3.75 KB
Binary file not shown.

Database/Testing/WAV/TEST8.wav

-3.55 KB
Binary file not shown.

Database/Testing/WAV/TEST9.wav

-126 KB
Binary file not shown.
+54-20
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,60 @@
11
### status of test WAV files
22

3-
######1 YES
4-
######2 NO
5-
######3 YES
6-
######4 YES
3+
######2 YES
4+
######3 NO
5+
######4 YES
76
######5 YES
8-
######6 YES
9-
######7 YES
7+
######6 NO
8+
######7 NO
109
######8 NO
11-
######9 NO
12-
######10 NO
10+
######9 YES
11+
######10 YES
1312
######11 YES
1413
######12 YES
15-
######13 YES
16-
######14 YES
17-
######15 YES
18-
######16 YES
19-
######17 YES
20-
######18 NO
21-
######19 NO
22-
######20 NO
23-
######21 NO
24-
######22 NO
25-
######23 NO
26-
######24 NO
14+
######13 NO
15+
######14 NO
16+
######15 NO
17+
######16 NO
18+
######17 NO
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+
######5 YES X X
52+
######7 YES X X
53+
######11 YES X X
54+
######13 YES X X
55+
######13 NO X
56+
##17 YES X X
57+
######18 NO X
58+
59+
60+
5,7,11,13,17

Database/Training/TEST11.wav

206 KB
Binary file not shown.

Database/Training/TEST13.wav

206 KB
Binary file not shown.
File renamed without changes.

Database/Training/TEST17.wav

197 KB
Binary file not shown.
File renamed without changes.

Database/Training/TEST5 (2).wav

227 KB
Binary file not shown.

Database/Training/TEST5.wav

341 KB
Binary file not shown.

Database/Training/TEST7.wav

219 KB
Binary file not shown.

src/results.json

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
[
2+
{
3+
"Has the sylabbus of the course been completed successfully?": "YES",
4+
},
5+
{
6+
"Do you think that you are able to understand the real life applications regarding this subject?": "NO",
7+
},
8+
{
9+
"Has the sylabbus of the course been completed successfully?": "YES",
10+
},
11+
{
12+
"Do you think that you are able to understand the real life applications regarding this subject?": "YES",
13+
},
14+
{
15+
"Has the sylabbus of the course been completed successfully?": "NO",
16+
},
17+
{
18+
"Do you think that you are able to understand the real life applications regarding this subject?": "NO",
19+
},
20+
{
21+
"Do you think that you are able to understand the real life applications regarding this subject?": "NO",
22+
},
23+
{
24+
"Do you think that you are able to understand the real life applications regarding this subject?": "YES",
25+
},
26+
{
27+
"Do you think that you are able to understand the real life applications regarding this subject?": "YES",
28+
},
29+
{
30+
"Do you think that you are able to understand the real life applications regarding this subject?": "YES",
31+
},
32+
{
33+
"Do you think that you are able to understand the real life applications regarding this subject?": "YES",
34+
},
35+
{
36+
"Do you think that you are able to understand the real life applications regarding this subject?": "NO",
37+
},
38+
{
39+
"Do you think that you are able to understand the real life applications regarding this subject?": "NO",
40+
},
41+
{
42+
"Do you think that you are able to understand the real life applications regarding this subject?": "NO",
43+
},
44+
{
45+
"Do you think that you are able to understand the real life applications regarding this subject?": "NO",
46+
},
47+
{
48+
"Do you think that you are able to understand the real life applications regarding this subject?": "NO",
49+
}
50+
]

src/test.py

+69-40
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,18 @@
66
"""
77

88
import wave
9+
import json
910
from scipy.fftpack import fft
1011
import matplotlib.pyplot as plt
1112
#print("import success")
1213

14+
### method to convert list to json
15+
def to_json(q,r):
16+
d={}
17+
for i in range(len(q)):
18+
d[q[i]]=r[i]
19+
with open('results.json', 'w') as fp:
20+
json.dump(d, fp)
1321

1422
### method to compute absolute value of vector
1523
def absolute_value_of_vector(vector):
@@ -44,18 +52,18 @@ def recognize_yes_or_no(N,fs,wav):
4452
#print("inside f(x)")
4553
#print("N=",N," fs=",fs)
4654
# threshold frequency
47-
F=2.1
55+
F=1.88
4856

4957
# length of samples
50-
#k1=round(N*5100/fs)
51-
#k2=round(N*11125/fs)
52-
k1=10000
53-
k2=20000
58+
k1=round(N*5100/fs)
59+
k2=round(N*11125/fs)
60+
#k1=10000
61+
#k2=20000
5462

5563
#print("values of k1,k2 are:",k1,k2)
5664

5765
X=absolute_value_of_vector(ff(wav,N))
58-
66+
#print(X)
5967
#avgx = sum(X)/len(X)
6068
#N_list.append(avgx)
6169

@@ -73,10 +81,12 @@ def recognize_yes_or_no(N,fs,wav):
7381
# k2_list.append(k2)
7482
#
7583
#
76-
# if f<F:
77-
# print("IVR RESPONSE = YES")
78-
# else:
79-
# print("IVR RESPONSE = NO")
84+
if f<F:
85+
#print("IVR RESPONSE = YES")
86+
result.append("YES")
87+
else:
88+
#print("IVR RESPONSE = NO")
89+
result.append("NO")
8090
return
8191

8292

@@ -146,11 +156,26 @@ def test_fft(file_path):
146156
N_list=[]
147157
k1_list=[]
148158
k2_list=[]
159+
result=[]
160+
quest = ["Has the sylabbus of the course been completed successfully?",
161+
"Do you think that you are able to understand the real life applications regarding this subject?",
162+
"Has the sylabbus of the course been completed successfully?",
163+
"Do you think that you are able to understand the real life applications regarding this subject?",
164+
"Has the sylabbus of the course been completed successfully?",
165+
"Do you think that you are able to understand the real life applications regarding this subject?",
166+
"Do you think that you are able to understand the real life applications regarding this subject?",
167+
"Do you think that you are able to understand the real life applications regarding this subject?",
168+
"Do you think that you are able to understand the real life applications regarding this subject?",
169+
"Do you think that you are able to understand the real life applications regarding this subject?",
170+
"Do you think that you are able to understand the real life applications regarding this subject?",
171+
"Do you think that you are able to understand the real life applications regarding this subject?",
172+
"Do you think that you are able to understand the real life applications regarding this subject?"
173+
]
149174

150175
### start reading and fft
151176

152177
if inp=='*':
153-
for i in range(1,25):
178+
for i in range(2,18):
154179
file_path=read_wav(i)
155180
test_fft(file_path)
156181
else:
@@ -165,52 +190,53 @@ def test_fft(file_path):
165190

166191
yes_f=[]
167192
yes_f.append(f_list[0])
168-
yes_f.extend(f_list[2:7])
169-
yes_f.append(f_list[10])
170-
yes_f.extend(f_list[11:17])
193+
yes_f.extend(f_list[2:4])
194+
yes_f.extend(f_list[7:11])
171195

172196
#
173197
#
174198
no_f=[]
175199
no_f.append(f_list[1])
176-
no_f.extend(f_list[7:10])
177-
no_f.extend(f_list[17:25])
200+
no_f.extend(f_list[4:7])
201+
no_f.extend(f_list[11:])
178202

179203

180204

181205
#
182206
##print(len(yes_f),len(no_f))
183207

184-
#s=1.0
185-
#bins=[]
186-
#bins.append(s)
187-
#for i in range(20):
188-
# s=s+0.05
189-
# bins.append(s)
208+
s=1.5
209+
bins=[]
210+
bins.append(s)
211+
for i in range(15):
212+
s=s+0.05
213+
bins.append(s)
190214
#
191215
#print(bins)
192216

217+
218+
193219
#### histogram
194220
#
195221

196-
#plt.hist(yes_f, bins, histtype='bar', rwidth=0.5)
197-
##plt.hist(no_f, bins, histtype='bar', rwidth=0.3)
198-
##plt.hist(X, bins, histtype='bar', rwidth=0.05)
199-
#plt.xlabel('x')
200-
#plt.ylabel('y')
201-
#plt.title('yes list histogram')
202-
#plt.legend()
203-
#plt.show()
204-
205-
206-
##plt.hist(yes_f, bins, histtype='bar', rwidth=0.3)
207-
#plt.hist(no_f, bins, histtype='bar', rwidth=0.5)
208-
##plt.hist(X, bins, histtype='bar', rwidth=0.05)
209-
#plt.xlabel('x')
210-
#plt.ylabel('y')
211-
#plt.title('no list histogram')
212-
#plt.legend()
213-
#plt.show()
222+
plt.hist(yes_f, bins, histtype='bar', rwidth=0.5)
223+
#plt.hist(no_f, bins, histtype='bar', rwidth=0.3)
224+
#plt.hist(X, bins, histtype='bar', rwidth=0.05)
225+
plt.xlabel('x')
226+
plt.ylabel('y')
227+
plt.title('yes list histogram')
228+
plt.legend()
229+
plt.show()
230+
231+
232+
#plt.hist(yes_f, bins, histtype='bar', rwidth=0.3)
233+
plt.hist(no_f, bins, histtype='bar', rwidth=0.5)
234+
#plt.hist(X, bins, histtype='bar', rwidth=0.05)
235+
plt.xlabel('x')
236+
plt.ylabel('y')
237+
plt.title('no list histogram')
238+
plt.legend()
239+
plt.show()
214240

215241
#
216242
#### save as png
@@ -221,3 +247,6 @@ def test_fft(file_path):
221247
#
222248
#
223249

250+
251+
### convert to json
252+
to_json(quest,results)

0 commit comments

Comments
 (0)