A list,

Pitch period estimation based on MATLAB

Ii. Source code

% pitch period detection endpoint detection algorithm CLC; close all; clear all; wlen=320; inc=80; % Frame length and frame shift T1=0.05; % set pitch endpoint detection parameter [x,fs]=wavread('C4_2_y.wav'); X =x-mean(x); % Dc component x=x/ Max (abs(x)); [voiceseg,vosl,SF,Ef]=pitch_vad(x,wlen,inc,T1); % pitch endpoint detection fn=length(SF); time = (0 : length(x)- 1)/fs; % frameTime = FrameTimeC(fn, wlen, inc, fs); % Calculate the corresponding time coordinates of each frame plot(time,x,'k');  title('Speech signal')
axis([0 max(time) - 1 1]); ylabel('value');
xlabel('time/s'); % Bandpass filter design clear all; clc; close all; fs=8000; fs2=fs/2; % sampling frequency Wp=[60 500]/fs2; % filter passband Ws=[20 1500]/fs2; % Filter stopband Rp=1; Rs=40; % Ripple of passband and attenuation of stopband [n,Wn]= Ellipord (Wp,Ws,Rp,Rs); % Calculate the order of filter [b,a]= Ellip (n,Rp,Rs,Wn); % Calculates the filter's coefficientsfprintf('b=%5.6f % 5.6F %5.6f %5.6f %5.6f %5.6f\n',b)
fprintf('a=%5.6f % 5.6F %5.6f %5.6f %5.6f %5.6f\n',a) [db, mag, pha, grd,w]=freqz_m(b,a); % Obtain the frequency response curve plot(w/ PI *fs/2,db,'k'); % drawing grid; ylim([- 90. 10]); CLC was detected by % cepstrum pitched period. close all; clear all; wlen=320; inc=80; % Frame length and frame shift T1=0.05; % set pitch endpoint detection parameter [x,fs]=wavread('C4_2_y.wav'); X =x-mean(x); % Dc component x=x/ Max (abs(x)); % amplitude normalization [voiceseg vosl, SF, Ef, period] = pitch_Ceps (x, wlen, inc, T1, fs); Pitch detection based on cepstrum method fn=length(SF); time = (0 : length(x)- 1)/fs; % frameTime = FrameTimeC(fn, wlen, inc, fs); % Calculate the time coordinates of each frame % plot subplot211, plot(time,x,'k');  title('Speech signal')
axis([0 max(time) - 1 1]); ylabel('value');
subplot 212; plot(frameTime,period,'k');
xlim([0 max(time)]); title('Cepstrum detection of pitch period'); 
xlabel('time/s'); ylabel(Sample count);
for k=1Nx1 =voiceseg(k).begin; nx2=voiceseg(k).end; nxl=voiceseg(k).duration;fprintf('%4d %4d %4d %4d\n',k,nx1,nx2,nxl); CLC was detected by autocorrelation method. close all; clear all; wlen=320; inc=80; % Frame length and frame shift T1=0.05; % set pitch endpoint detection parameter [x,fs]=wavread('C4_2_y.wav'); X =x-mean(x); % Dc component x=x/ Max (abs(x)); % amplitude normalization [voiceseg vosl, SF, Ef, period] = pitch_Corr (x, wlen, inc, T1, fs); % Pitch detection based on autocorrelation method fn=length(SF); time = (0 : length(x)- 1)/fs; % frameTime = FrameTimeC(fn, wlen, inc, fs); % Calculate the time coordinate subplot of each frame211, plot(time,x,'k');  title('Speech signal')
axis([0 max(time) - 1 1]); grid;  ylabel('value');
subplot 212; plot(frameTime,period,'k'); hold on;
xlim([0 max(time)]); title('Autocorrelation pitch period detection'); 
grid; xlabel('time/s'); ylabel(Sample count);
for k=1 : vosl
    nx1=voiceseg(k).begin;
    nx2=voiceseg(k).end;
    nxl=voiceseg(k).duration;
    fprintf('%4d %4d %4d %4d\n',k,nx1,nx2,nxl);
    subplot 211
    line([frameTime(nx1) frameTime(nx1)],[- 1 1].'color'.'r'.'linestyle'.The '-');
    line([frameTime(nx2) frameTime(nx2)],[- 1 1].'color'.'b'.'linestyle'.The '-');
    subplot 212
Copy the code

3. Operation results







Fourth, note

Version: 2014 a