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

📄 ti_e_zcr.m

📁 这是一个用于语音信号处理的工具箱
💻 M
字号:
%
% Callback function for Energy and ZCR  button in the  Time Analysis window
% Author Karthik

clear energy;
clear zcr;

% Set position and size of analysis window

PV=[270 44 515 268];
s2 = 'Time domain Analysis - Output';

% Open analysis window	

while exist('time_out_win_h')==1
   try1 = 'get(time_out_win_h,''position'');';
   eval(try1,catch2);
   if check ==0
      clear time_out_win_h;
      check = 1;
      break;
   end
   s1 = get(time_out_win_h,'Position');
   if ~strcmp(s1,s2)
      clear time_out_win_h;
      break;
   end;
   figure(time_out_win_h);
   break;
end;

if exist('time_out_win_h') ~= 1
   	time_out_win_h=figure('Position',PV,...
		'Resize','on',...
		'Numbertitle','off',...
		'Name',s2);
end



signal=SPEECH;

% Normalize the amplitude of the analyzing signal

AMAX=max(abs(signal));
signal=14000/AMAX*signal;

% Remove components around d.c.
signal=filtfilt([1 -1],[1 -.99],signal);

%Energy Calculation

len_of_window  = time_frame_len - time_overlap;
len_of_signal = length(signal);

if time_frame_len > len_of_signal
   disp('Please choose a shorter window length');
else
   no_of_windows = floor(len_of_signal/len_of_window)+1;
   energy = zeros(1,no_of_windows);
   zcr = zeros(1,no_of_windows);
   
   for z = 1:no_of_windows
      start_sample = (z-1)*len_of_window + 1;
      if start_sample + time_frame_len -1 > len_of_signal
         end_sample = len_of_signal;
      else
         end_sample = start_sample+ time_frame_len-1;
      end
         
      frame = signal(start_sample:end_sample);
      energy(z) = sum(frame.^2);
      zcr(z) = zcr_cnt(frame,thresh);
      subplot(211);
      plot(energy);
      title('Energy');
      subplot(212);
      plot(zcr);
      title('Zero-crossing rate');
   pause(0.01);
   end;

end;




⌨️ 快捷键说明

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