added diagrams, started writing up results
23
lpss.m
@ -5,16 +5,16 @@
|
|||||||
close all;clear all;clc;
|
close all;clear all;clc;
|
||||||
|
|
||||||
SEGMENT_LENGTH = 100; % ms
|
SEGMENT_LENGTH = 100; % ms
|
||||||
SEGMENT_OFFSET = 0; % ms from start
|
SEGMENT_OFFSET = 20; % ms from start
|
||||||
|
|
||||||
LPC_ORDER = 20;
|
LPC_ORDER = 25;
|
||||||
AC_DISP_SAMPLES = 1000; % autocorrelation display samples
|
AC_DISP_SAMPLES = 1000; % autocorrelation display samples
|
||||||
WINDOW_NUMBER = 10; % number of windows for spectrogram
|
WINDOW_NUMBER = 10; % number of windows for spectrogram
|
||||||
WINDOW_OVERLAP = 5; % ms
|
WINDOW_OVERLAP = 10; % ms
|
||||||
SYNTH_WINDOW_NUMBER = 100; % number of windows for spectrogram
|
SYNTH_WINDOW_NUMBER = 60; % number of windows for spectrogram
|
||||||
SYNTH_WINDOW_OVERLAP = 10; % ms
|
SYNTH_WINDOW_OVERLAP = 20; % ms
|
||||||
|
|
||||||
PREEMPHASIS_COEFFS = [1 -0.8]; % first order zero coeff for pre-emphasis
|
PREEMPHASIS_COEFFS = [1 -0.9]; % first order zero coeff for pre-emphasis
|
||||||
|
|
||||||
F0 = 60; % low-pitched male speech
|
F0 = 60; % low-pitched male speech
|
||||||
% F0 = 600; % children
|
% F0 = 600; % children
|
||||||
@ -36,8 +36,9 @@ ORIG_LPC_T_COMPARE = false;
|
|||||||
ORIG_SPECTROGRAM = true;
|
ORIG_SPECTROGRAM = true;
|
||||||
SYNTH_SPECTROGRAM = true;
|
SYNTH_SPECTROGRAM = true;
|
||||||
|
|
||||||
SYNTHESISED_SOUND_LENGTH = 500; % ms
|
SYNTHESISED_SOUND_LENGTH = 1000; % ms
|
||||||
|
|
||||||
|
WRITE = false;
|
||||||
PLAY = false;
|
PLAY = false;
|
||||||
|
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
@ -128,7 +129,7 @@ if PREEMPHASIS
|
|||||||
|
|
||||||
prefilter_plot = plot(prefilter_freqs, 20*log10(abs(prefilter_vals)), 'g');
|
prefilter_plot = plot(prefilter_freqs, 20*log10(abs(prefilter_vals)), 'g');
|
||||||
prefilter_plot.Color(4) = 0.8;
|
prefilter_plot.Color(4) = 0.8;
|
||||||
prefilter_plot.LineWidth = 1;
|
prefilter_plot.LineWidth = 1.5;
|
||||||
end
|
end
|
||||||
|
|
||||||
%% PLOT
|
%% PLOT
|
||||||
@ -191,7 +192,7 @@ maxima_plot.MarkerSize = 8;
|
|||||||
maxima_plot.LineWidth = 1.5;
|
maxima_plot.LineWidth = 1.5;
|
||||||
|
|
||||||
grid
|
grid
|
||||||
xlabel('Quefrency')
|
xlabel('Quefrency (samples)')
|
||||||
ylabel('ceps(x[n])')
|
ylabel('ceps(x[n])')
|
||||||
xlim([0 L / 2])
|
xlim([0 L / 2])
|
||||||
title('Speech Signal Cepstrum')
|
title('Speech Signal Cepstrum')
|
||||||
@ -202,7 +203,7 @@ end
|
|||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
% CEPSTRUM
|
% CEPSTRUM
|
||||||
if CEPSTRUM_PLOT && length(cep_maxima_times) >= 1
|
if CEPSTRUM_PLOT && length(cep_maxima_times) >= 1
|
||||||
pitch_period = cep_maxima_times(c == max(c));
|
pitch_period = cep_maxima_times(c == max(c))
|
||||||
fundamental_freq = 1 / (pitch_period / Fs)
|
fundamental_freq = 1 / (pitch_period / Fs)
|
||||||
else
|
else
|
||||||
disp('pitch periods not identified')
|
disp('pitch periods not identified')
|
||||||
@ -216,8 +217,10 @@ if exist('fundamental_freq')
|
|||||||
|
|
||||||
synth_sound = filter(1, a, excitation);
|
synth_sound = filter(1, a, excitation);
|
||||||
|
|
||||||
|
if WRITE
|
||||||
audiowrite('out.wav', synth_sound, Fs);
|
audiowrite('out.wav', synth_sound, Fs);
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
%% SPECTROGRAM
|
%% SPECTROGRAM
|
||||||
|
55
lpss_lpc.m
@ -15,8 +15,12 @@ DISPLAY_SAMPLES = min([DISPLAY_SAMPLES L]);
|
|||||||
% CALCULATE FFT
|
% CALCULATE FFT
|
||||||
[freq_dom_freqs, freq_dom_vals] = fft_(y, Fs);
|
[freq_dom_freqs, freq_dom_vals] = fft_(y, Fs);
|
||||||
|
|
||||||
|
index = 1;
|
||||||
|
|
||||||
for ITER=1:5:ORDER
|
for ITER=1:5:ORDER
|
||||||
|
|
||||||
|
subplot(4, 2, index);
|
||||||
|
|
||||||
% LPC
|
% LPC
|
||||||
a = lpc(y,ITER); % signal, filter order
|
a = lpc(y,ITER); % signal, filter order
|
||||||
|
|
||||||
@ -24,12 +28,56 @@ for ITER=1:5:ORDER
|
|||||||
[h, filter_freqs] = freqz(1, a, length(freq_dom_freqs), Fs);
|
[h, filter_freqs] = freqz(1, a, length(freq_dom_freqs), Fs);
|
||||||
|
|
||||||
figure(1)
|
figure(1)
|
||||||
plot(freq_dom_freqs, 20*log10(freq_dom_vals), 'r', filter_freqs, 20*log10(abs(h)), 'b')
|
%% SIGNAL FFT RESPONSE
|
||||||
|
orig_freq_plot = plot(freq_dom_freqs, 20*log10(abs(freq_dom_vals)), 'black');
|
||||||
|
orig_freq_plot.Color(4) = 0.1;
|
||||||
|
orig_freq_plot.LineWidth = 1;
|
||||||
|
hold on
|
||||||
|
|
||||||
|
%% LPC FILTER RESPONSE
|
||||||
|
[filter_vals, filter_freqs] = freqz(1, a, length(freq_dom_freqs), Fs);
|
||||||
|
filter_vals_db = 20*log10(abs(filter_vals));
|
||||||
|
|
||||||
|
lpc_freq_plot = plot(filter_freqs, filter_vals_db, 'b');
|
||||||
|
lpc_freq_plot.LineWidth = 2;
|
||||||
|
|
||||||
|
%% ARYULE FILTER RESPONSE
|
||||||
|
ary = aryule(y, ITER);
|
||||||
|
[filter_vals, filter_freqs] = freqz(1, ary, length(freq_dom_freqs), Fs);
|
||||||
|
filter_vals_db = 20*log10(abs(filter_vals));
|
||||||
|
|
||||||
|
lpc_freq_plot = plot(filter_freqs, filter_vals_db, 'r');
|
||||||
|
lpc_freq_plot.LineWidth = 1;
|
||||||
|
|
||||||
|
%% ARCOV FILTER RESPONSE
|
||||||
|
arc = arcov(y, ITER);
|
||||||
|
[filter_vals, filter_freqs] = freqz(1, arc, length(freq_dom_freqs), Fs);
|
||||||
|
filter_vals_db = 20*log10(abs(filter_vals));
|
||||||
|
|
||||||
|
lpc_freq_plot = plot(filter_freqs, filter_vals_db, 'g');
|
||||||
|
lpc_freq_plot.LineWidth = 1;
|
||||||
|
|
||||||
|
% % MAXIMA
|
||||||
|
% % estimate formant frequencies from maxima of LPC filter freq response
|
||||||
|
% maxima = islocalmax(filter_vals_db);
|
||||||
|
% maxima_freqs = filter_freqs(maxima)
|
||||||
|
% maxima_db = filter_vals_db(maxima);
|
||||||
|
%
|
||||||
|
% if length(maxima_freqs) ~= 0
|
||||||
|
% maxima_plot = plot(maxima_freqs, maxima_db, 'rx');
|
||||||
|
% maxima_plot.MarkerSize = 12;
|
||||||
|
% maxima_plot.LineWidth = 2;
|
||||||
|
% end
|
||||||
|
|
||||||
|
% plot(freq_dom_freqs, 20*log10(freq_dom_vals), 'r', filter_freqs, 20*log10(abs(h)), 'b')
|
||||||
% plot(w/pi, 20*log10(abs(h)))
|
% plot(w/pi, 20*log10(abs(h)))
|
||||||
|
hold off
|
||||||
grid
|
grid
|
||||||
xlabel('Frequency (Hz)')
|
xlabel('Frequency (Hz)')
|
||||||
ylabel('Magnitude (dB)')
|
ylabel('Magnitude (dB)')
|
||||||
legend('Original Signal', 'LPC Filter')
|
% legend('Original Signal', 'LPC Filter', 'Local Maxima')
|
||||||
|
legend('Original Signal', 'LPC Filter', 'Aryule LPC Filter', 'Arcov LPC Filter')
|
||||||
|
title(strcat(['LPC Spectra: Order ' num2str(ITER)]));
|
||||||
|
|
||||||
% COMPARE TWO SIGNALS TIME DOMAIN
|
% COMPARE TWO SIGNALS TIME DOMAIN
|
||||||
% est_y = filter(0.02, a, y);
|
% est_y = filter(0.02, a, y);
|
||||||
@ -43,7 +91,6 @@ for ITER=1:5:ORDER
|
|||||||
% ylabel('Amplitude')
|
% ylabel('Amplitude')
|
||||||
% legend('Original signal','LPC estimate')
|
% legend('Original signal','LPC estimate')
|
||||||
|
|
||||||
|
index = index + 1;
|
||||||
pause(0.5)
|
|
||||||
|
|
||||||
end
|
end
|
@ -0,0 +1,12 @@
|
|||||||
|
@article{formant-frequencies,
|
||||||
|
author = {Scherer, Stefan and Lucas, Gale and Gratch, Jonathan and Rizzo, Albert and Morency, Louis-Philippe},
|
||||||
|
doi = {10.1109/TAFFC.2015.2440264},
|
||||||
|
journal = {IEEE Transactions on Affective Computing},
|
||||||
|
month = {01},
|
||||||
|
pages = {1--1},
|
||||||
|
title = {Self-Reported Symptoms of Depression and PTSD Are Associated with Reduced Vowel Space in Screening Interviews},
|
||||||
|
url = {https://www.researchgate.net/publication/279164505_Self-Reported_Symptoms_of_Depression_and_PTSD_Are_Associated_with_Reduced_Vowel_Space_in_Screening_Interviews},
|
||||||
|
volume = {7},
|
||||||
|
year = {2015}
|
||||||
|
}
|
||||||
|
|
2480
report/report.lyx
BIN
resources/head_f_rcep_smooth.png
Normal file
After Width: | Height: | Size: 112 KiB |
BIN
resources/head_f_rcep_smooth_X.png
Normal file
After Width: | Height: | Size: 108 KiB |
BIN
resources/head_f_rcep_~smooth.png
Normal file
After Width: | Height: | Size: 105 KiB |
BIN
resources/head_f_spect_25.png
Normal file
After Width: | Height: | Size: 320 KiB |
BIN
resources/hood_m_ccep_~smooth.png
Normal file
After Width: | Height: | Size: 80 KiB |
BIN
resources/hood_m_gram.png
Normal file
After Width: | Height: | Size: 133 KiB |
BIN
resources/hood_m_gram_synth.png
Normal file
After Width: | Height: | Size: 192 KiB |
BIN
resources/hood_m_lpc_tile.png
Normal file
After Width: | Height: | Size: 1.1 MiB |
BIN
resources/hood_m_rcep_smooth_X.png
Normal file
After Width: | Height: | Size: 111 KiB |
BIN
resources/hood_m_rcep_~smooth.png
Normal file
After Width: | Height: | Size: 109 KiB |
BIN
resources/hood_m_spect_25.png
Normal file
After Width: | Height: | Size: 334 KiB |
BIN
resources/hood_m_spect_25_premph_0.9.png
Normal file
After Width: | Height: | Size: 447 KiB |