Tbs - 04 - Aplikasi Pengolahan Sinyal Digital - Short-Time Analysis of Speech - 2
Tbs - 04 - Aplikasi Pengolahan Sinyal Digital - Short-Time Analysis of Speech - 2
Bagian 2
Short-time Energy
Secara matematik dimodelkan sebagai:
En xmwn m x 2 mw2 n m
2
m m
En x 2 nhe n
n n
0.3
voiced
unvoiced
0.2
0.1
magnitude
-0.1
-0.2
-0.3
-0.4
0 2000 4000 6000 8000 10000 12000 14000 16000 18000
sample ke-n
Short time Energy & Zero Crossing Rate
Ambil satu frame sampel pada daerah unvoiced (sampel ke 2001 s/d
2320), lakukan penghitungan nilai energinya
Ambil satu frame sampel pada daerah voiced (sampel ke 3001 s/d 3320),
lakukan penghitungan nilai energinya
[y,Fs]=wavread('ada.wav');
y1=y(2001:2320);
e_y1=sum(y1.^2)
y2=y(3001:3320);
e_y2=sum(y2.^2)
Z n 0.5 sgn xm sgn xm 1wn m
m
Note : n n
1 ;x 0
di mana : sgn n
1 ;x 0
Contoh program Matlab
%File Name: zero_cross_01.m
[y,Fs]=wavread('ada.wav');
figure(1);
plot(y);
title('Sinyal wicara kata "ada"')
xlabel('sample ke-n');ylabel('magnitude')
y1=y(2001:2320);
zeros1 = find( (y1(1:end-1) ./ y1(2:end)) <= 0 );
figure(2)
t=2001:2320;
title('Zero Crossing pada Unvoiced')
y2=y(3001:3320);
plot(t,y1,'b', t(zeros1), 0, 'ro'); zeros2 = find( (y2(1:end-1) ./ y2(2:end)) <= 0 );
title('Zero Crossing pada Unvoiced') figure(3)
xlabel('sample ke-n');ylabel('magnitude') t=3001:3320;
length(zeros1) plot(t,y2,'b', t(zeros2), 0, 'ro');
title('Zero Crossing pada Voiced')
xlabel('sample ke-n');ylabel('magnitude')
length(zeros2)
Short time Energy & Zero Crossing Rate
2
magnitude
-2
-4
-6
2000 2050 2100 2150 2200 2250 2300 2350
sample ke-n
0.05
0
magnitude
-0.05
-0.1
-0.15
3000 3050 3100 3150 3200 3250 3300 3350
sample ke-n
Pada contoh lain (Buku Rabiner) ditunjukkan bahwa short time energy dan
zero crossing pada suatu sampel sinyal wicara dengan window hamming
sepanjang 20 ms dan frekuensi sampling 16 kHz, didapatkan hasil bahwa:
Daerah Unvoiced:
- zero crossing rate tinggi
- energy relatif rendah
Daerah Voiced:
- zero crossing rendah
- energy relatif tinggi
3. Short Time Autocorrelation Function
n l x mx m l
n n (8)
m
di mana n n
Short time Autocorrelation Function
0.3
voiced
unvoiced
0.2
0.1
magnitude
-0.1
-0.2
-0.3
-0.4
0 2000 4000 6000 8000 10000 12000 14000 16000 18000
sample ke-n
Short time Autocorrelation Function
Program Matlab
%File Name: korelasi_01.m
[y,Fs]=wavread('ada.wav');
y1=y(1801:2440);
y1_c=xcorr(y1);yy=length(y1_c);
t=-yy/2:(yy/2)-1;length(t);
figure(1);plot(y1,'linewidth',2);grid on;axis([0 640 -.1 .1]);title('Unvoiced');
figure(2);plot(t,y1_c,'linewidth',2);grid on;axis([-yy/2 yy/2 -.1 .1]);
title('Korelasi Unvoiced');
y2=y(2501:3140);y2_c=xcorr(y2);
t=-yy/2:(yy/2)-1;length(t);
figure(3);plot(y2,'linewidth',2);grid on;
axis([0 640 -.1 .1]);title('Voiced');
figure(4);plot(t,y2_c,'linewidth',2);grid on;
axis([-yy/2 yy/2 -.5 1.1]); title('Korelasi Voiced');
Short time Autocorrelation Function
Segmen 0.1
Unvoiced
sinyal
0.08
0.06
0.04
0.02
Sinyal Unvoiced 0
Voiced
0.1 -0.02
-0.04
0.08
-0.06
0.06 -0.08
0.04 -0.1
0 100 200 300 400 500 600
0.02
-0.02
Sinyal-0.04
Voiced
-0.06
-0.08
-0.1
0 100 200 300 400 500 600
Short time Autocorrelation Function
Korelasi Unvoiced
Hasil 0.1
0.08
0.06
Autokorelasi 0.04
0.02
Unvoiced -0.02
-0.04
-0.06
-0.08
-0.1
-600 -400 -200 0 200 400 600
Korelasi Voiced
Voiced
0.5
-0.5
-600 -400 -200 0 200 400 600
4. Short time Fourier Transform
Untuk sinyal waktu diskrit, secara matematik
dituliskan sebagai:
sinyal dengan window tergeser
e xmwn me
j j m 9
X n
m
y1=y(1801:2440);
Y_1=20*log10(abs(fft(y1)));
ff=length(Y_1);
f=1:ff;
figure(1);plot((f/ff)*Fs,Y_1,'linewidth',2);
axis([0 Fs/2 -70 30]);
title('STFT Unvoiced');xlabel('frekuensi Hz');
ylabel('Mamgnitudo dB');grid on;
y2=y(2501:3140);
Y_2=20*log10(abs(fft(y2)));
f=1:length(Y_2);
figure(2);plot((f/ff)*Fs,Y_2,'linewidth',2);
axis([0 Fs/2 -70 30]);
title('STFT Voiced');xlabel('frekuensi Hz');
ylabel('Mamgnitudo dB');grid on;
Short time Fourier Transform
STFT Unvoiced
30
20
10
Mamgnitudo dB
-10
-20
-30
-10
-20
-30
-40
STFT Segmen Voiced
-50
-60
-70
0 1000 2000 3000 4000 5000 6000 7000 8000
frekuensi Hz
5. Spectrogram Sinyal Wicara
Spectrogram merupakan suatu tampilan sederhana pada magnitudo STF.
Secara spesifik, gambar disamping merupakan gambaran dari sebuah fungsi
matematik berikut ini:
Dimana
sb-x: domain waktu
tr=rRT
Frekuensi
Magnitudo
Waktu
Spectrogram Sinyal Wicara
clear all;
Fs=10000;
[y,Fs]=wavread('ada.wav');
y_res=resample(y,16000,Fs);
figure(1) 1
plot(y_res) 0.9
axis off; 0.8
0.7
figure(2)
0.6
specgram(y_res)
Frequency
0.5
0.4
0.3
0.2
0.1
0
1000 2000 3000 4000 5000 6000 7000 8000
Time
Tugas
Buat sebuah perekaman untuk kalimat saya mahasiswa politeknik
elektronika negeri surabaya. Ucapkan dengan prosodi normal,
sehingga lawan bicara anda merasa jela waktu mendengarkannya.
Lakukan pembentukan frame-frame dalam hal ini durasi satu frame
20 ms dan tanpa overlapping antar frame
Lakukan pemilahan voice dan silent/unvoice dengan menggunakan
teknik zero crossing. Hitung berapa prosentase waktu yang berisi
voice? Berapa prosentase waktu berisi unvoice/silent?
Ambil salah satu frame yang brerisi sinyal voice, lakukan proses
autokorelasi, dan hitung jarak antar dua puncak berdekatan.
Lakukan hal yang sama untuk sinyal unvoice, dan amati perbedaan
mendasar dari hasil proses autokorelasi terhadap dua kondisi sinyal
tersebut.