📄 sbc8.m
字号:
function sbc8
% function of subbands coding;
% accomplish 8 subbands coding of voice-signals;
% DPCM use [8 8 4 4 4 4 4 4] bits within eath subband ;
clear;close all;
a=input('PLease input the bits vecter of the subband of 8 subband-coding:');
[m,n]=size(a);
%a=input('PLease input the bits vecter of the 2 subband-coding:');
a=input('请选择长度为8的字长向量,任一字长不能小于4。\n字长向量为:');
[m,n]=size(a);
if n~=8||mean(a)<6||mean(a)>16
error('输入错误,重请试!\n你必须信息按照提示进行输入!','k');
%error('You have input a error number,try again!\nYou must input according the requirement!','k');
return;
end
tic;
[x1,fs,nb]=wavread('E:\MATLAB6p5\work\2006\manspeech.wav');
wc=3400;wc=wc/fs;[m,n]=size(x1);
y=lowpass(x1,wc);
wavwrite(x1,fs/3,nb,'E:\manspeech1.wav');
[x,fs,nb]=wavread('E:\manspeech1.wav');
[y1,y2]=bandpass(x);m1=y1;m2=y2;
[a1,a2]=bandpass(m1);[a3,a4]=bandpass(m2);
[y1,y2]=bandpass(a1);[y3,y4]=bandpass(a2);[y5,y6]=bandpass(a3);[y7,y8]=bandpass(a4);
y1=code(y1,a(1));y2=code(y2,a(2));y3=code(y3,a(3));y4=code(y4,a(4));
y5=code(y5,a(5));y6=code(y6,a(6));y7=code(y7,a(7));y8=code(y8,a(8));
dec=decode(y1,a(1));y1=dec;dec=decode(y2,a(2));y2=dec;
dec=decode(y3,a(3));y3=dec;dec=decode(y4,a(4));y4=dec;
dec=decode(y5,a(5));y5=dec;dec=decode(y6,a(6));y6=dec;
dec=decode(y7,a(7));y7=dec;dec=decode(y8,a(7));y8=dec;
[yy1,yy2]=restructor(y1,y2);[yy3,yy4]=restructor(y3,y4);
f1=result(yy1,yy2);f2=result(yy3,yy4);
[yy1,yy2]=restructor(y5,y6);[yy3,yy4]=restructor(y7,y8);
f3=result(yy1,yy2);f4=result(yy3,yy4);
[yy1,yy2]=restructor(f1,f2);[yy3,yy4]=restructor(f3,f4);
ff1=result(yy1,yy2);ff2=result(yy3,yy4);
[yy1,yy2]=restructor(ff1,ff2);
re=result(yy1,yy2);
re=re/max(re);
wavwrite(re,3*fs,max(a),'E:\manspeech_8.wav');
toc,
error=abs(sum((re(1:m)-x1))/sum(x1))
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -