⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 spmain.m

📁 自己写的关于lpc分析与合成的Demo程序
💻 M
字号:
% spmain.m
OrderP=10;
FrameLen=20             % 20 ms per Frame;
NPoint=FrameLen*8;       %

[Y,Fs,Bits]=wavread('bj.wav');
DataInP1=Y(1:17/20*length(Y));
DataInP2=DataInP1(1:length(DataInP1)/5);


%{
set (0, 'DefaultAxesFontSize', 8, ... 
        'DefaultAxesFontName', 'Times'); 
figure(1); 
set (gcf, 'Units', 'centimeter'); 
pos = get (gcf, 'Position'); 
pos(3) = 10; 
pos(4) = 8; 
set (gcf, 'Position', pos);   
set (gca, 'Units', 'centimeter'); 
set (gca, 'Position', [1.5 1.2 8 6]); 

subplot(211);
plot((1:length(DataInP1))/Fs,DataInP1);
xlabel('Time, s');ylabel('Amplitude');title('Waveform');  
subplot(212);
plot((1:length(DataInP2))/Fs,DataInP2);
xlabel('Time, s');ylabel('Amplitude');title('Waveform');

set (gcf, 'PaperPositionMode', 'auto');   
print -depsc  bjwavform.eps; 
%}

DataInWin=DataInP2.*window(@hamming,length(DataInP2));
Dfft=fft(DataInP2);
plotlen=floor(length(Dfft)/2);


TotalPoint = length(DataIn);
NFrame = floor(TotalPoint/NPoint);

for i=4:4:4
    
DataF = DataIn(NPoint*i+1:NPoint*(i+1));
DataWin = DataF.*window(@hamming,NPoint);
DataFFT = fft(DataWin);

A = lpc(DataWin,OrderP);
[H1]=freqz(1,A,160);

%{
set (0, 'DefaultAxesFontSize', 8, ... 
        'DefaultAxesFontName', 'Times'); 
figure(2); 
set (gcf, 'Units', 'centimeter'); 
pos = get (gcf, 'Position'); 
pos(3) = 10; 
pos(4) = 8; 
set (gcf, 'Position', pos);   
set (gca, 'Units', 'centimeter'); 
set (gca, 'Position', [1.5 1.2 8 6]); 

plotlen=floor(length(DataFFT)/2);
plot(4000*(1:plotlen)/plotlen,10*log10(abs(DataFFT(1:plotlen))/max(abs(DataFFT))));grid;
hold on;
plot((1:160)/160*4000,10*log10(abs(H1)/max(abs(H1))),'-.');
xlabel('Frequency, Hz');ylabel('Normlized Amplitude /dB');
set (gcf, 'PaperPositionMode', 'auto');   
print -depsc  bjSpetrum.eps; 
%}


%{
set (0, 'DefaultAxesFontSize', 8, ... 
        'DefaultAxesFontName', 'Times'); 
figure(3); 
set (gcf, 'Units', 'centimeter'); 
pos = get (gcf, 'Position'); 
pos(3) = 10; 
pos(4) = 8; 
set (gcf, 'Position', pos);   
set (gca, 'Units', 'centimeter'); 
set (gca, 'Position', [1.5 1.2 8 6]); 

zplane([1 0],A);
set (gcf, 'PaperPositionMode', 'auto');   
print -depsc  zplane.eps; 
%}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -