First, the way to obtain the code
Get the code 1: by subscribing to the paid column of purple Pole Shenguang blog, you can get this code with payment voucher, private letter bloggers.
Access code 2: Open CSDN membership through the homepage of CSDN blog, and the code can be obtained by payment voucher and private letter bloggers.
[pitch frequency] pitch matlab pitch frequency calculation [matlab source code 1384 issue]
Note: For CSDN membership, only one code can be obtained free of charge (valid within three days from the date of opening); Subscribe to the paid column of purple Pole Shenguang blog, you can get 2 copies of the code for free (valid for three days from the subscription date);
Two, some source code
a=audioread('sound.wav'); L=length(a); % Determine the length of speech m= Max (a);for i=1:L a(i)=a(i)/m; End % Find the maximum and minimum values of the normalized data m= Max (a); % find the maximum positive value n=min(a); % Find the minimum negative value % in order to ensure that the amplitude is axisymmetric with the abscissa, the calculation formula is n+(m-n)/2, are combined into (m+n)/2
for i=1:L; % data center downshift retention and horizontal axis symmetry A (I)=a(I)-ht;end
figure(1); % Draw the first plot subplot(2.1.1); % first subgraph plot(a,'k');
%axis([0.1711.- 1.1]); % Determine the horizontal and vertical range title('Central Clipping Front Speech Waveform'); % graph title xlabel(Sample count); % ylabel('幅度'); % ordinatefor k=1:L ; % center clippingif a(k)>=th0
a(k)=a(k)-th0;
elseif a(k)<=(-th0);
a(k)=a(k)+th0;
else
a(k)=0;
end
end
m=max(a);
for i=1:L; Amplitude normalization of % center clipping functionend
subplot(2.1.2); % second subgraph plot(a,'k');
%axis([0.1711.- 1.1]); % Determine the horizontal and vertical range title('Speech waveform after Central clipping'); % graph title xlabel(Sample count); % ylabel('幅度'); % fCLOSE (FID); % close file b = a; b1 = a((0.8*16000) : (0.8*16000+2*0.02*16000));
%b1 = a((0.05*16000) : (0.05*16000+2*0.02*16000));
N = zc;
for k = 1:N
sum = 0;
for m = 1:N;
sum = sum + abs(b1(m)-b1(m+k- 1));
%sum = sum + b1(m)*b1(m+k- 1);
end
A(k) = sum;
end
figure;
subplot 211;
plot(b1(1: (0.02*16000)));
subplot 212;
plot(A);
Copy the code
3. Operation results
Matlab version and references
1 matlab version 2014A
[1] Han Jiqing, Zhang Lei, Zheng Tieran. Speech Signal Processing (3rd edition) [M]. Tsinghua University Press, 2019. [2] LIU Ruobian. Deep Learning: Practice of Speech Recognition Technology [M]. Tsinghua University Press, 2019.