A list,
Based on matlab speech signal mathematical model
Ii. Source code
clc
clear all
close all
T1=5; %5ms
T2=3; %3ms
fs=8; %8kHz
N1=T1*fs;
N2=T2*fs;
n1=1:N1- 1;
n2=N1:N1+N2;
g=zeros(1.20*fs);
t=(1:20*fs)/fs;
g(1:N1- 1) =0.5* (1-cos(pi*n1/N1));
g(N1:N1+N2)=cos(pi*(n2-N1)/(2*N2));
plot(t,g)
ylim([0.4.1.2])
line([0 20], [0 0])
line([5 5], [0 1].'LineStyle'.The '-')
xlabel('time/ms')
ylabel('g(n)')
title('(a) Time domain waveform ')
figure
N=length(g);
f=(0:N- 1)*fs/N;
fftg=fft(g);
disg=20*log10(abs(fftg));
plot(f(1:N/2+1),disg(1:N/2+1))
line([0 fs/2], [0 0])
xlabel('frequency/kHz')
= [500 1500 2500];
sampleRate = 8000;
pitch = 100;
f1=f(1); f2=f(2); f3=f(3); Impulse function yt=zeros(1.8000);
yt(1) =1;
if f1 > 0
cft = f1/sampleRate;
bw = 50;
q = f1/bw;
rho = exp(-pi * cft / q);
theta = 2 * pi * cft * sqrt(1- 1/ (4 * q*q));
a2 = 2 -*rho*cos(theta);
a3 = rho*rho;
y=filter([1+a2+a3],[1,a2,a3],yt);
end;
figure
N=length(y);
fn=(0:N- 1)*sampleRate/N;
fftg=fft(y);
disg=20*log10(abs(fftg));
plot(fn(1:N/2+1),disg(1:N/2+1))
% line([0 sampleRate/2], [0 0])
xlabel('frequency/Hz')
ylabel('amplitude/dB')
title('(a) Second order resonator of the first formant 'According to the specified formant frequency and bandwidth (50Hz) modeling the formant of speech signal % second formantif f2 > 0
cft = f2/sampleRate;
bw = 50;
q = f2/bw;
rho = exp(-pi * cft / q);
theta = 2 * pi * cft * sqrt(1- 1/ (4 * q*q));
a2 = 2 -*rho*cos(theta);
a3 = rho*rho;
y=filter([1+a2+a3],[1,a2,a3],y);
end;
figure
N=length(y);
fn=(0:N- 1)*sampleRate/N;
fftg=fft(y);
disg=20*log10(abs(fftg));
plot(fn(1:N/2+1),disg(1:N/2+1))
% line([0 sampleRate/2], [0 0])
xlabel('frequency/Hz')
Copy the code
3. Operation results
Fourth, note
Version: 2014 a