基于matlab的数字音效处理器(7)

2020-03-29 14:01

率和阻带截止频率

handles.wp1=2*handles.fp1/handles.Fs;

handles.ws1=2*handles.fs1/handles.Fs;handles.rp=1;handles.as=100;

[N1,wp1]=ellipord(handles.wp1,handles.ws1,handles.rp,handles.as); %计算椭圆低通模拟滤波器的阶数和通带边界频率

[B,A]=ellip(N1,handles.rp,handles.as,wp1); %计算低通滤波器模拟滤波器系统函数系数

handles.y1=filter(B,A,handles.y);

handles.lowstrong=2*handles.y1+handles.y; %handles.f=2*handles.Fs;

sound(handles.lowstrong,handles.Fs); else end;

% --- Executes on button press in huisheng.

function huisheng_Callback(hObject, eventdata, handles) % hObject handle to huisheng (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) %if get(hObject,'Enable')

yanshi=[zeros(8000,2);handles.y];%声音延时

new_y=[handles.y;zeros(8000,2)];%使原声音长度与延时后相等 huisheng=yanshi*0.6+new_y; handles.h=huisheng;

sound(handles.h,handles.Fs); %else %end;

% --- Executes on button press in lingcun.

function lingcun_Callback(hObject, eventdata, handles) % hObject handle to lingcun (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) Fs=handles.Fs;

[sel,ok]=listdlg('ListString',{'默认频率','6000','8000','11025','16000','22050','32000','44100','48000','96000'},...

'name','选择保存的频率', 'OKstring','确定', ...

'Cancelstring','取消', 'SelectionMode','single','ListSize',[240 120]);

data_frequency=[Fs,6000,8000,11025,16000,22050,32000,44100,48000,

96000];

if ok==1

fs=data_frequency(sel);

[filename]=uiputfile({'*.wav'},'文件保存'); yanshi=[zeros(8000,2);handles.y];%声音延时

new_y=[handles.y;zeros(8000,2)];%使原声音长度与延时后相等 huisheng=yanshi*0.6+new_y;

handles.h=huisheng;%why add these

wavwrite(handles.h,fs,filename);úta表示声音数据 else end;

% --- Executes on button press in bfluyinwenjian.

function bfluyinwenjian_Callback(hObject, eventdata, handles) % hObject handle to bfluyinwenjian (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if get(hObject,'Enable')

set(handles.record,'Value',0);

set(handles.recordtime,'Enable','off'); set(handles.startrecord,'Enable','off'); set(handles.openfile,'Enable','off'); set(handles.open,'Value',0);

%set(handles.bofangpinlv,'Enable','on'); %set(handles.bofangqueding,'Enable','on'); set(handles.frequency,'Enable','off');

%playspeed=str2double(get(handles.speed,'String')); %handles.Fs=playspeed * handles.Fs ;

wavplay(handles.y,handles.Fs,'sync');%同步方式播放

% wavplay(handles.y,handles.Fs,'async');%非同步方式播放 else end;

% --- Executes on button press in wanquandaoxu.

function wanquandaoxu_Callback(hObject, eventdata, handles) % hObject handle to wanquandaoxu (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if get(hObject,'Enable')

wqdx=flipud(handles.y); sound(wqdx,handles.Fs); else end;

% --- Executes on button press in bufendaoxu.

function bufendaoxu_Callback(hObject, eventdata, handles) % hObject handle to bufendaoxu (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if get(hObject,'Enable') x=handles.y;

kong=zeros(400000,2);%定义一个矩阵 N=length(x); for i=1:400000

kong(i,:)=x(i,:); end

x1=reshape(kong,20000,40); %分成了20段 x2=x1';

x3=flipud(x2); x4=x3';

x5=reshape(x4,400000,2); sound(x5,handles.Fs); else end;

% --- Executes on button press in huixuan.

function huixuan_Callback(hObject, eventdata, handles) % hObject handle to huixuan (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if get(hObject,'Enable')

kong=zeros(400000,2);%定义一个矩阵 x=handles.y; x(:,2)=x(:,1); %N=length(x); for i=1:400000

kong(i,:)=x(i,:); end

x1=reshape(kong,40000,20); %分成了20段 for i=1:2:10 x1(:,i)=0; end

for i=12:2:20 x1(:,i)=0; end

x5=reshape(x1,400000,2); sound(x5,handles.Fs); else end;

% --- Executes on button press in beijing.

function beijing_Callback(hObject, eventdata, handles) % hObject handle to beijing (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if get(hObject,'Enable')

[filename pathname]=uigetfile({'*.wav','ALL FILES(*.*)'},'选择声音文件');

if isequal([filename pathname],[0,0]) return; end

str=[pathname filename];%选择的声音文件路径和文件名

[temp Fs]=wavread(str); % temp表示声音数据 Fs表示频率 z=temp;handles.Fs=Fs; handles.xuanze=2;

guidata(hObject,handles); d=handles.y;

N=length(handles.y);

temp2=zeros(N,2);%定义一个矩阵 for i=1:N

temp2(i,:)=z(i,:); end

z=d+temp2;

sound(z,handles.Fs); else end

% --- Executes on button press in zishiying.

function zishiying_Callback(hObject, eventdata, handles) % hObject handle to zishiying (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) %if get(hObject,'Enable')

set(hObject,'string','处理中...'); pause(0.1);

w=handles.y;

N=length(w); %N是文件的长度,即点数即wavread中的第二个变量x=zeros(N,1);%定义单列矩阵,

x=w(:,1); %提取单声道元素,用于后面的运算 y=zeros(N,1);%定义单列矩阵,

y=w(:,1); %找到关键点后,利用关键点对原矩阵运算 L=N;

%消除噪音

for i=1:N-1

if abs(x(i))<0.075; x(i)=0; end end

%=====定义标志量,用于插值运算 flag1=0; flag2=0; flag3=0;

%============================================================= for i=8000:N-8000 for m=1:1000

if ((x(i)==0)&((x(i-m)~=0))) flag1=1; end

if ((x(i)==0)&((x(i+m)~=0))) flag2=1; end

flag3=flag1+flag2; if (flag3==2) x(i)=0.03; end

flag1=0; flag2=0; flag3=0; end end

%====寻找关键点 c=1;

num=zeros(1000,1);%定义一个矩阵 for i=1000:N-1000

if (((x(i)==0)&(x(i+1)~=0))|((x(i)~=0)&(x(i+1)==0)))


基于matlab的数字音效处理器(7).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:苍马山旅游度假区总规修编情况 -

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: