speechcoder1.m

来自「用MATLAB编写的LPC编码器及解码器源代码」· M 代码 · 共 47 行

M
47
字号
%Plain LPC vocoder

%Main file

function [ outspeech ] = speechcoder1( inspeech )

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Speech Coding using Linear Predictive Coding (LPC)
% The desired order can be selected in the system constants section.
% For the excitation impulse-trains are used. The result does not sound very
% well but with this solution it is possible to achieve a low bitrate!
%
% 
% Parameters: 
% inspeech : wave data with sampling rate Fs
% (Fs can be changed underneath if necessary)
% 
% Returns:
% outspeech : wave data with sampling rate Fs
% (coded and resynthesized)
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%
% arguments check
% ---------------
if ( nargin ~= 1)
error('argument check failed');
end;

%
% system constants
% ----------------
Fs = 16000; % sampling rate in Hertz (Hz)
Order = 10; % order of the model used by LPC

%
% main
% ----

% encoded the speech using LPC
[aCoeff, resid, pitch, G, parcor, stream] = proclpc(inspeech, Fs, Order);

% decode/synthesize speech using LPC and impulse-trains as excitation
outspeech = synlpc(aCoeff, pitch, Fs, G);

⌨️ 快捷键说明

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