-
Notifications
You must be signed in to change notification settings - Fork 4
/
newstft.asv
executable file
·77 lines (55 loc) · 1.84 KB
/
newstft.asv
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
%FILE DEL PROGETTO DI TATA
%prova stft e risintesi di un segnale audio
%
% CALCOLO DEL NUMERO DI SPLICE:
% numero_splice=1+((length(signal)-length(win))/(length(win)/2))
%
%
clear all;
close all;
%creazione finestra
win=hamming(512);
%definita anche la frequenza di campionamnto per come viene importato il file audio
[signal1,Fs1]=wavread('Urlo22.wav');
[signal2,Fs2]=wavread('Toms_diner22.wav');
[signal3,Fs3]=wavread('nonmisomiglia22.wav');
%%
%MICROFONO2
%Ritardo dei segnali (in numero di campioni)
rit1=160;
rit2=560;
rit3=800;
%definizione segnali
signal1r=[zeros(rit1,1); signal1];
signal2r=[zeros(rit2,1); signal2];
signal3r=[zeros(rit3,1); signal3];
%calcolo la lunghezza massima
lunghezzar=max(length(signal1r),length(signal2r));
lunghezzar=max(lunghezzar,length(signal3r));
%%
%PADDING
signal1=[signal1; zeros((lunghezzar-length(signal1)),1)];
signal2=[signal2; zeros((lunghezzar-length(signal2)),1)];
signal3=[signal3; zeros((lunghezzar-length(signal3)),1)];
signal1r=[signal1r; zeros((lunghezzar-length(signal1r)),1)];
signal2r=[signal2r; zeros((lunghezzar-length(signal2r)),1)];
signal3r=[signal3r; zeros((lunghezzar-length(signal3r)),1)];
%Spettri
[f1,f2,f3]=OLAfft(signal1,signal2,signal3,win);
%Rappresentazione
fk1=22000/512*(0:256);
tk1=linspace(0,4.965,425);
figure(1), imagesc(tk1,fk1,abs(f1([1:256],:)));
figure(2), imagesc(tk1,fk1,abs(f2([1:256],1)));
figure(3), imagesc(tk1,fk1,abs(f3([1:256],1)));
%Segnali somma ai 2 mic (Assenza riverberazioni e dunque risposta impulsiva nel tempo del canale, banda piatta,unici ritardi quelli di propagaz)
som1=signal1+signal2+signal3;
som2=signal1r+signal2r+signal3r;
%Spettri
[fsum1,fsum2,fsum3]=OLAfft(som1,som2,0,win);
clear fsum3;
% %Rappresentazione
% figure(4); imagesc(abs(fsum1));
% figure(5); imagesc(abs(fsum2));
%Creazione spazio delle features
[feat1,feat2]=spfeat(fsum1,fsum2);