added diagrams, started writing up results

This commit is contained in:
aj 2020-11-07 18:35:24 +00:00
parent 05dd7680b6
commit 4910c2c20d
16 changed files with 2543 additions and 27 deletions

23
lpss.m
View File

@ -5,16 +5,16 @@
close all;clear all;clc;
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
WINDOW_NUMBER = 10; % number of windows for spectrogram
WINDOW_OVERLAP = 5; % ms
SYNTH_WINDOW_NUMBER = 100; % number of windows for spectrogram
SYNTH_WINDOW_OVERLAP = 10; % ms
WINDOW_OVERLAP = 10; % ms
SYNTH_WINDOW_NUMBER = 60; % number of windows for spectrogram
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 = 600; % children
@ -36,8 +36,9 @@ ORIG_LPC_T_COMPARE = false;
ORIG_SPECTROGRAM = true;
SYNTH_SPECTROGRAM = true;
SYNTHESISED_SOUND_LENGTH = 500; % ms
SYNTHESISED_SOUND_LENGTH = 1000; % ms
WRITE = false;
PLAY = false;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -128,7 +129,7 @@ if PREEMPHASIS
prefilter_plot = plot(prefilter_freqs, 20*log10(abs(prefilter_vals)), 'g');
prefilter_plot.Color(4) = 0.8;
prefilter_plot.LineWidth = 1;
prefilter_plot.LineWidth = 1.5;
end
%% PLOT
@ -191,7 +192,7 @@ maxima_plot.MarkerSize = 8;
maxima_plot.LineWidth = 1.5;
grid
xlabel('Quefrency')
xlabel('Quefrency (samples)')
ylabel('ceps(x[n])')
xlim([0 L / 2])
title('Speech Signal Cepstrum')
@ -202,7 +203,7 @@ end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% CEPSTRUM
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)
else
disp('pitch periods not identified')
@ -216,7 +217,9 @@ if exist('fundamental_freq')
synth_sound = filter(1, a, excitation);
if WRITE
audiowrite('out.wav', synth_sound, Fs);
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

View File

@ -15,8 +15,12 @@ DISPLAY_SAMPLES = min([DISPLAY_SAMPLES L]);
% CALCULATE FFT
[freq_dom_freqs, freq_dom_vals] = fft_(y, Fs);
index = 1;
for ITER=1:5:ORDER
subplot(4, 2, index);
% LPC
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);
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)))
hold off
grid
xlabel('Frequency (Hz)')
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
% est_y = filter(0.02, a, y);
@ -43,7 +91,6 @@ for ITER=1:5:ORDER
% ylabel('Amplitude')
% legend('Original signal','LPC estimate')
pause(0.5)
index = index + 1;
end

View File

@ -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}
}

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 320 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

BIN
resources/hood_m_gram.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 192 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 334 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 447 KiB