-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSpeech_Analyzer_Mainpage.m
1978 lines (1506 loc) · 77.7 KB
/
Speech_Analyzer_Mainpage.m
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
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
function varargout = Speech_Analyzer_Mainpage(varargin)
% SPEECH_ANALYZER_MAINPAGE MATLAB code for Speech_Analyzer_Mainpage.fig
% SPEECH_ANALYZER_MAINPAGE, by itself, creates a new SPEECH_ANALYZER_MAINPAGE or raises the existing
% singleton*.
%
% H = SPEECH_ANALYZER_MAINPAGE returns the handle to a new SPEECH_ANALYZER_MAINPAGE or the handle to
% the existing singleton*.
%
% SPEECH_ANALYZER_MAINPAGE('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in SPEECH_ANALYZER_MAINPAGE.M with the given input arguments.
%
% SPEECH_ANALYZER_MAINPAGE('Property','Value',...) creates a new SPEECH_ANALYZER_MAINPAGE or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before Speech_Analyzer_Mainpage_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to Speech_Analyzer_Mainpage_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help Speech_Analyzer_Mainpage
% Last Modified by GUIDE v2.5 26-Jun-2019 16:57:20
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @Speech_Analyzer_Mainpage_OpeningFcn, ...
'gui_OutputFcn', @Speech_Analyzer_Mainpage_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before Speech_Analyzer_Mainpage is made visible.
function Speech_Analyzer_Mainpage_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to Speech_Analyzer_Mainpage (see VARARGIN)
% Choose default command line output for Speech_Analyzer_Mainpage
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes Speech_Analyzer_Mainpage wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = Speech_Analyzer_Mainpage_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
function sample_filepath_txt_Callback(hObject, eventdata, handles)
% hObject handle to sample_filepath_txt (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of sample_filepath_txt as text
% str2double(get(hObject,'String')) returns contents of sample_filepath_txt as a double
% --- Executes during object creation, after setting all properties.
function sample_filepath_txt_CreateFcn(hObject, eventdata, handles)
% hObject handle to sample_filepath_txt (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on button press in browse_btn.
function browse_btn_Callback(hObject, eventdata, handles)
% hObject handle to browse_btn (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
[FileName,FilePath]=uigetfile('*.wav','File Selector');
FullFilePath = strcat(FilePath, FileName);
handles.sample_filepath_txt.String = FullFilePath;
handles.activex7.URL = FullFilePath;
% --- Executes on button press in speech_recognition_svm_btn.
function speech_recognition_svm_btn_Callback(hObject, eventdata, handles)
% hObject handle to speech_recognition_svm_btn (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%----------------------------MFCC---------------------------------------------
wav_file2=handles.sample_filepath_txt.String;
[PSTATES,STATES,TRANS,EMIS,seq,states,N] = hmm_model_language_disorder(wav_file2);
[Status] = comparison(wav_file2);
handles.recognition_result_text.String = Status;
% --- Executes on button press in pitch_btn.
function pitch_btn_Callback(hObject, eventdata, handles)
% hObject handle to pitch_btn (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
wav_file=handles.sample_filepath_txt.String;
[Pitch_Contour_min,Pitch_Contour_max,Pitch_Contour_mean,pitch_freq] = pitch_contour_extract( wav_file );
set(handles.result_text,'string',' Average Pitch Contour:');
set(handles.result_text,'string',Pitch_Contour_mean);
set(handles.unit_text,'string','Hz');
% --- Executes on button press in format_btn.
function format_btn_Callback(hObject, eventdata, handles)
% hObject handle to format_btn (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%get a section of vowel
wav_file=handles.sample_filepath_txt.String;
[ ffreq ] = formant_extract( wav_file );
set(handles.result_text,'string','Formant Frequency :');
set(handles.result_text,'string',ffreq);
set(handles.unit_text,'string','Hz');
% --- Executes on button press in intensity_btn.
function intensity_btn_Callback(hObject, eventdata, handles)
% hObject handle to intensity_btn (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
wav_file=handles.sample_filepath_txt.String;
[Intensity_of_Sound,f]= intensity_extraction(wav_file);
%intensity= mean(magnitude);
Rate_of_Intensity_of_Sound= mean(Intensity_of_Sound);
set(handles.result_text,'string','Average Intensity:');
set(handles.result_text,'string',Rate_of_Intensity_of_Sound);
set(handles.unit_text,'string','W/m^2');
figure,plot(Intensity_of_Sound);
legend('Intensity');
ylabel(' Intensity of Sound (Watt/m^2');
xlabel('Distance from Source (m)');
%stem(f,magnitude)
%ylabel ('Magnitude (dB)');
%xlabel ('Frequency (Hz)');
% --- Executes on button press in mfcc_btn.
function mfcc_btn_Callback(hObject, eventdata, handles)
% hObject handle to mfcc_btn (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
wav_file = handles.sample_filepath_txt.String; % input audio filename
[ MFCCs, FBEs, frames] = melfcc( wav_file );
% EOF
% --- Executes on button press in rastaplp_btn.
function rastaplp_btn_Callback(hObject, eventdata, handles)
% hObject handle to rastaplp_btn (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Load a speech waveform
%[d,sr] = readwav(sample_filepath_txt.Field);
wav_file=handles.sample_filepath_txt.String;
[del,ddel,cepDpDD] = rastaplpfunction( wav_file );
% --- Executes on button press in acceleration_btn.
function acceleration_btn_Callback(hObject, eventdata, handles)
% hObject handle to acceleration_btn (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
wav_file=handles.sample_filepath_txt.String;
[acceleration1,velocity1,t,t1,rate_of_acceleration]= acceleration_extraction(wav_file);
set(handles.result_text,'string','Rate of Acceleration');
set(handles.result_text,'string',rate_of_acceleration);
set(handles.unit_text,'string','m/s^2');
% --- Executes on button press in time_btn.
function time_btn_Callback(hObject, eventdata, handles)
% hObject handle to time_btn (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in help_btn.
function help_btn_Callback(hObject, eventdata, handles)
% hObject handle to help_btn (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in about_btn.
function about_btn_Callback(hObject, eventdata, handles)
% hObject handle to about_btn (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in waveform.
function waveform_Callback(hObject, eventdata, handles)
% hObject handle to waveform (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
wav_file=handles.sample_filepath_txt.String;
[Frequency,t,x,f,magnitude,q,amplitude] = frequency( wav_file );
figure('Position', [30 30 800 600], 'PaperPositionMode', 'auto', ...
'color', 'w', 'PaperOrientation', 'landscape', 'Visible', 'on' );
subplot(3,1,1);
%subplot(300);
plot(t,x);
legend('Waveform');
xlabel('Time(s)');
ylabel('Amplitude');
handles.result_tag_txt.String= 'Peak Frequency';
handles.result_text.String=Frequency;
handles.unit_txt.String='gHz';
% --- Executes on button press in datacorpus_btn.
function datacorpus_btn_Callback(hObject, eventdata, handles)
% hObject handle to datacorpus_btn (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in exit_btn.
function exit_btn_Callback(hObject, eventdata, handles)
% hObject handle to exit_btn (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in lpcc_btn.
function lpcc_btn_Callback(hObject, eventdata, handles)
% hObject handle to lpcc_btn (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
wav_file=handles.sample_filepath_txt.String;
p=128;
[LPCCs_Coeff,LPCSs,LPCCscepDpDD]= lpccs(wav_file,p);[d,sr] = readwav(wav_file);
figure;
subplot(311);
specgram(d, 256, sr);
title('Original Spectrogram');
subplot(312)% .. and plot them
imagesc(10*log10(LPCSs)); % Power spectrum, so dB is 10log10
% Set color map to grayscale
title('LPC Spectra Features');
subplot(313);
imagesc(LPCCs_Coeff);
title('LPC cepstra Features');
figure;
subplot(211)% .. and plot them
plot(mean(LPCSs)); % Power spectrum, so dB is 10log10
% Set color map to grayscale
title('Average LPC Spectra Features');
subplot(212);
plot(mean(LPCCs_Coeff));
title('Average LPC cepstra Features');
% --- Executes on button press in save_btn.
function save_btn_Callback(hObject, eventdata, handles)
% hObject handle to save_btn (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in pushbutton32.
% --- Executes on button press in search_btn.
function search_btn_Callback(hObject, eventdata, handles)
% hObject handle to search_btn (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in edit_btn.
function edit_btn_Callback(hObject, eventdata, handles)
% hObject handle to edit_btn (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in open_db_btn.
function open_db_btn_Callback(hObject, eventdata, handles)
% hObject handle to open_db_btn (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in checkbox1.
function checkbox1_Callback(hObject, eventdata, handles)
% hObject handle to checkbox1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of checkbox1
% --- Executes on button press in checkbox2.
function checkbox2_Callback(hObject, eventdata, handles)
% hObject handle to checkbox2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of checkbox2
% --- Executes on button press in checkbox3.
function checkbox3_Callback(hObject, eventdata, handles)
% hObject handle to checkbox3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of checkbox3
% --- Executes on button press in checkbox4.
function checkbox4_Callback(hObject, eventdata, handles)
% hObject handle to checkbox4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of checkbox4
% --- Executes on button press in lpc_btn.
function lpc_btn_Callback(hObject, eventdata, handles)
% hObject handle to lpc_btn (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in datacorpus_btn.
function fft_btn_Callback(hObject, eventdata, handles)
% hObject handle to datacorpus_btn (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in mfdwc_btn.
function mfdwc_btn_Callback(hObject, ~, handles)
% hObject handle to mfdwc_btn (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in autocorrelation_btn.
function autocorrelation_btn_Callback(hObject, eventdata, handles)
% hObject handle to autocorrelation_btn (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
wav_file=handles.sample_filepath_txt.String;
[rmax,PFr] = autocorrelation(wav_file);
handles.result_tag_txt.String= 'Frequency';
handles.result_text.String=rmax;
handles.unit_txt.String='g';
handles.result1_tag_txt.String= 'Peak Frequency';
handles.result1_txt.String=PFr;
handles.unit1_txt.String='gHz';
% --- Executes on button press in htk_mfcc_btn.
function htk_mfcc_btn_Callback(hObject, eventdata, handles)
% hObject handle to htk_mfcc_btn (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function activex2_Error(hObject, eventdata, handles)
% hObject handle to activex2 (see GCBO)
% eventdata structure with parameters passed to COM event listener
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in pushbutton43.
function pushbutton43_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton43 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in pushbutton44.
function pushbutton44_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton44 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in kmeans_btn.
function kmeans_btn_Callback(hObject, eventdata, handles)
% hObject handle to kmeans_btn (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
function result_text_Callback(hObject, eventdata, handles)
% hObject handle to result_text (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of result_text as text
% str2double(get(hObject,'String')) returns contents of result_text as a double
% --- Executes during object creation, after setting all properties.
function result_text_CreateFcn(hObject, eventdata, handles)
% hObject handle to result_text (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edit5_Callback(hObject, eventdata, handles)
% hObject handle to edit5 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit5 as text
% str2double(get(hObject,'String')) returns contents of edit5 as a double
% --- Executes during object creation, after setting all properties.
function edit5_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit5 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on button press in spectrum_btn.
function spectrum_btn_Callback(hObject, eventdata, handles)
% hObject handle to spectrum_btn (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
wav_file=handles.sample_filepath_txt.String;
[Frequency,t,x,f,magnitude,q,amplitude] = frequency( wav_file );
figure('Position', [30 30 800 600], 'PaperPositionMode', 'auto', ...
'color', 'w', 'PaperOrientation', 'landscape', 'Visible', 'on' );
subplot(3,1,1);
plot(f,magnitude);
legend('Spectrum');
xlabel('Frequency (Hz)');
ylabel('Magnitude (dB)');
% --- Executes on button press in ceptrum_btn.
function ceptrum_btn_Callback(hObject, eventdata, handles)
% hObject handle to ceptrum_btn (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
wav_file=handles.sample_filepath_txt.String;
[Frequency,t,x,f,magnitude,q,amplitude] = frequency( wav_file );
figure('Position', [30 30 800 600], 'PaperPositionMode', 'auto', ...
'color', 'w', 'PaperOrientation', 'landscape', 'Visible', 'on' );
subplot(3,1,1);
plot(q,amplitude);
legend('Cepstrm');
xlabel('Quefrency (S)');
ylabel('Amplitude');
% --- Executes on button press in short_term_analysis_btn.
function short_term_analysis_btn_Callback(hObject, eventdata, handles)
% hObject handle to short_term_analysis_btn (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
wav_file=handles.sample_filepath_txt.String;;
[x,Fs]=readwav(wav_file);
sampling_rate = Fs;
windowsize_s = 0.020;
windowsize = sampling_rate*windowsize_s;
framesize_s = 0.010;
framesize = sampling_rate*framesize_s;
[result, nframes] = windowize(x, windowsize, framesize);
[Average_Energy] = average_energy(result);
figure('Position', [30 30 800 600], 'PaperPositionMode', 'auto', ...
'color', 'w', 'PaperOrientation', 'landscape', 'Visible', 'on' );
subplot(3,1,1);
plot(Average_Energy);
legend('Spectrum');
title('Average Energy','FontSize',12,'Color','b');
[Rate_Zero_Passages] = rate_zero_passages(result, windowsize);
subplot(3,1,1);
plot(Rate_Zero_Passages);
title('Rate of Passages par Zero','FontSize',12,'Color','b');
[Average_Power] = average_power(result, windowsize);
subplot(3,1,1);
plot(Average_Power);
title('Average Power','FontSize',12,'Color','b');
% --- Executes on button press in homomorphic_analysis_btn.
function homomorphic_analysis_btn_Callback(hObject, eventdata, handles)
% hObject handle to homomorphic_analysis_btn (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in synthesis_btn.
function synthesis_btn_Callback(hObject, eventdata, handles)
% hObject handle to synthesis_btn (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in prediction_btn.
function prediction_btn_Callback(hObject, eventdata, handles)
% hObject handle to prediction_btn (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in analysis_by_frames_btn.
function analysis_by_frames_btn_Callback(hObject, eventdata, handles)
% hObject handle to analysis_by_frames_btn (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in decision_voice_btn.
function decision_voice_btn_Callback(hObject, eventdata, handles)
% hObject handle to decision_voice_btn (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in pushbutton57.
function pushbutton57_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton57 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in frequency_btn.
function frequency_btn_Callback(hObject, eventdata, handles)
% hObject handle to frequency_btn (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
wav_file=handles.sample_filepath_txt.String;
[Frequency,t,x,f,magnitude,q,amplitude] = frequency( wav_file );
set(handles.result_text,'string',' Frequency :');
set(handles.result_text,'string',Frequency);
set(handles.unit_text,'string','Hz');
% --- Executes on button press in speech_recognition_btn.
function speech_recognition_btn_Callback(hObject, eventdata, handles)
% hObject handle to speech_recognition_btn (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
wav_file=handles.sample_filepath_txt.String;
data = getappdata(gcbf, 'metricdata');
Classification_Model=data.Classification_Model;
%if(Classification_Model==1) end
%if(Classification_Model==2)
%[SVM_Result,SVM_Score,SVM_Cost] = svm_classification(wav_file);
%[rn1,cn1]=find(strcmp(SVM_Result,'Normal'));
%[rn2,cn2]=find(strcmp(SVM_Result,'Special'));
%Normal=sum(rn1); Special=sum(rn2);
%Normal_Percentage= (Normal/12)*100;
%Special_Percentage= (Special/12)*100;
%Percentage=[Normal_Percentage;Special_Percentage];
%set(handles.result_seldar_text,'string',Percentage);
%end
if(Classification_Model==3)
set(handles.speech_recognition_result_txt,'string',Percentage);
%if(Classification_Model==4)
end
% --- Executes on button press in frequency_domain_analysis_btn.
function frequency_domain_analysis_btn_Callback(hObject, eventdata, handles)
% hObject handle to frequency_domain_analysis_btn (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
wav_file=handles.sample_filepath_txt.String;
[Frequency,t,x,f,magnitude,q,amplitude] = frequency( wav_file );
%figure('Position', [30 30 800 600], 'PaperPositionMode', 'auto', ... 'color', 'w', 'PaperOrientation', 'landscape', 'Visible', 'on' );
%subplot(3,1,1);
%subplot(300);
%plot(t,x);
%legend('Waveform');
%xlabel('Time(s)');
%ylabel('Amplitude');
handles.result_tag_txt.String= 'Peak Frequency';
handles.result_text.String=Frequency;
handles.unit_txt.String='gHz';
% --- Executes on button press in pushbutton73.
function pushbutton73_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton73 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on selection change in lpc_val.
function lpc_val_Callback(hObject, eventdata, handles)
% hObject handle to lpc_val (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns lpc_val contents as cell array
% contents{get(hObject,'Value')} returns selected item from lpc_val
% --- Executes during object creation, after setting all properties.
function lpc_val_CreateFcn(hObject, eventdata, handles)
% hObject handle to lpc_val (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: popupmenu controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on button press in spectrogram_btn.
function spectrogram_btn_Callback(hObject, eventdata, handles)
% hObject handle to spectrogram_btn (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
wav_file=handles.sample_filepath_txt.String;
[x,Fs,bits]=wavread(wav_file);
figure('Position', [30 30 800 600], 'PaperPositionMode', 'auto', ...
'color', 'w', 'PaperOrientation', 'landscape', 'Visible', 'on' );
spectrogram(x,Fs,bits);
%spectrogram(x,Fs);
function operation_val_Callback(hObject, eventdata, handles)
% hObject handle to operation_val (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
operation = get(hObject,'Value');
data = getappdata(gcbf, 'metricdata');
data.operation= operation;
setappdata(gcbf, 'metricdata', data);
% --- Executes on button press in real_ceptrum.
function real_ceptrum_Callback(hObject, eventdata, handles)
% hObject handle to real_ceptrum (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
wav_file=handles.sample_filepath_txt.String;
[x,Fs]=readwav(wav_file);
data = getappdata(gcbf, 'metricdata');
operation_val=data.operation;
ms1=Fs/1000;
ms20=Fs/50;
if operation_val==1
Y=fft(x.*hamming(length(x)));
end
if operation_val==2
Y=fft(x.*hann(length(x)));
end
if operation_val==3
Y=fft(x.*bartlett(length(x)));
end
if operation_val==4
Y=fft(x.*blackman(length(x)));
end
C=fft(log(abs(Y)+eps));
q=(ms1:ms20)/Fs;
figure('Position', [30 30 800 600], 'PaperPositionMode', 'auto', ...
'color', 'w', 'PaperOrientation', 'landscape', 'Visible', 'on' );
subplot(3,1,1);
plot(q,abs(C(ms1:ms20)));
legend('Cepstre');
xlabel('Quefrence (s)','fontsize',14);
ylabel('Amplitude','fontsize',14);
[c,fx]=max(abs(C(ms1:ms20)));
%set(handles.fondamentale,'string',);
handles.result_tag_txt.String= 'Initial Frequency';
handles.result_text.String=Fs/(ms1+fx-1);
handles.unit_txt.String='Hz';
% --- Executes on button press in timeline_btn.
function timeline_btn_Callback(hObject, eventdata, handles)
% hObject handle to timeline_btn (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
wav_file=handles.sample_filepath_txt.String;
[x,Fs]=readwav(wav_file);
Length=size(x);
t = (1:Length(1))/Fs;
figure('Position', [30 30 800 600], 'PaperPositionMode', 'auto', ...
'color', 'w', 'PaperOrientation', 'landscape', 'Visible', 'on' );
subplot(3,1,1);
plot(t,x);zoom xon;
xlabel(['Time [s]'],'FontSize',14,'Color','b');
ylabel(['Amplitude'],'FontSize',14,'Color','b');
legend('product');
% --- Executes on button press in fourier_transform_btn.
function fourier_transform_btn_Callback(hObject, eventdata, handles)
% hObject handle to fourier_transform_btn (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
wav_file=handles.sample_filepath_txt.String;
[x,Fs]=readwav(wav_file);
Y=fft(x.*hamming(length(x)));
hz5000=5000*length(Y)/Fs;
f=(0:hz5000)*Fs/length(Y);
figure('Position', [30 30 800 600], 'PaperPositionMode', 'auto', ...
'color', 'w', 'PaperOrientation', 'landscape', 'Visible', 'on' );
plot(f,20*log10(abs(Y(1:length(f)))+eps));
legend('Spectrum');
title('Fourier Transform','FontSize',12,'Color','b');
xlabel('Frequence (Hz)');
ylabel('Magnitude (dB)');
% --- Executes on button press in pushbutton72.
function pushbutton72_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton72 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in average_energy_btn.
function average_energy_btn_Callback(hObject, eventdata, handles)
% hObject handle to average_energy_btn (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
wav_file=handles.sample_filepath_txt.String;
[Average_Energy]= logenergy(wav_file);
figure('Position', [30 30 800 600], 'PaperPositionMode', 'auto', ...
'color', 'w', 'PaperOrientation', 'landscape', 'Visible', 'on' );
subplot(3,1,1);
plot(Average_Energy);
legend('Spectrum');
title('Average Energy','FontSize',12,'Color','b');
% --- Executes on button press in rate_of_passages_btn.
function rate_of_passages_btn_Callback(hObject, ~, handles)
% hObject handle to rate_of_passages_btn (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
wav_file=handles.sample_filepath_txt.String;
[Rate_Zero_Passages] = rate_zero_passages(wav_file);
figure;
plot(Rate_Zero_Passages);
title('Rate of Passages par Zero','FontSize',12,'Color','b');
% --- Executes on button press in average_power_btn.
function average_power_btn_Callback(hObject, eventdata, handles)
% hObject handle to average_power_btn (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
wav_file=handles.sample_filepath_txt.String;
[son,Fs]=readwav(wav_file);
sampling_rate = Fs;
windowsize_s = 0.020;
windowsize = sampling_rate*windowsize_s;
framesize_s = 0.010;
framesize = sampling_rate*framesize_s;
[result, nframes] = windowize(son, windowsize, framesize);
[Average_Power] = average_power(result, windowsize);
figure; plot(Average_Power);
title('Average Power','FontSize',12,'Color','b');
% --- Executes on button press in radiobutton1.
function radiobutton1_Callback(hObject, eventdata, handles)
% hObject handle to radiobutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of radiobutton1
% --- Executes on selection change in num_coeff_val.
function num_coeff_val_Callback(hObject, eventdata, handles)
% hObject handle to num_coeff_val (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)choice=get(hObject,'Value');
num_coeff = get(hObject,'Value');
data = getappdata(gcbf, 'metricdata');
data.num_coeff= num_coeff;
setappdata(gcbf, 'metricdata', data);
% --- Executes on button press in lpcc_analysis_btn.
function lpcc_analysis_btn_Callback(hObject, eventdata, handles)
% hObject handle to lpcc_analysis_btn (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
wav_file=handles.sample_filepath_txt.String;
data = getappdata(gcbf, 'metricdata');
p=data.num_coeff;
[lpc_data ]= lpc_function( wav_file, p );
% Hints: contents = cellstr(get(hObject,'String')) returns num_coeff_val contents as cell array
% contents{get(hObject,'Value')} returns selected item from num_coeff_val
% --- Executes during object creation, after setting all properties.
function num_coeff_val_CreateFcn(hObject, eventdata, handles)
% hObject handle to num_coeff_val (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: popupmenu controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on selection change in operation_val.
% Hints: contents = cellstr(get(hObject,'String')) returns operation_val contents as cell array
% contents{get(hObject,'Value')} returns selected item from operation_val
% --- Executes during object creation, after setting all properties.
function operation_val_CreateFcn(hObject, eventdata, handles)
% hObject handle to operation_val (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: popupmenu controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes during object creation, after setting all properties.
function lpcc_analysis_btn_CreateFcn(hObject, eventdata, handles)
% hObject handle to lpcc_analysis_btn (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% --- Executes on button press in pushbutton80.
function pushbutton80_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton80 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in log_power_btn.
function train_path_txt_Callback(hObject, eventdata, handles)
% hObject handle to train_path_txt (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of train_path_txt as text
% str2double(get(hObject,'String')) returns contents of train_path_txt as a double
% --- Executes during object creation, after setting all properties.
function train_path_txt_CreateFcn(hObject, eventdata, handles)
% hObject handle to train_path_txt (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on button press in browse_train_file_btn.
function browse_train_file_btn_Callback(hObject, eventdata, handles)
% hObject handle to browse_train_file_btn (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
set(handles.training_progress_text,'string','Add Data..');
[FileName,FilePath]=uigetfile('*.wav','File Selector');
FullFilePath = strcat(FilePath, FileName);
handles.train_path_txt.String = FullFilePath;
handles.activex9.URL = FullFilePath;
data = getappdata(gcbf, 'metricdata');
data.TrainFilename=FileName; data.TrainFilePath=FullFilePath;
setappdata(gcbf, 'metricdata', data);
% --- Executes on selection change in train_data_list.
function train_data_list_Callback(hObject, eventdata, handles)
% hObject handle to train_data_list (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns train_data_list contents as cell array
% contents{get(hObject,'Value')} returns selected item from train_data_list
[status] = train_data(audio_folder);
% --- Executes during object creation, after setting all properties.
function train_data_list_CreateFcn(hObject, eventdata, handles)
% hObject handle to train_data_list (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: listbox controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end