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

📄 ti_win.m

📁 这是一个用于语音信号处理的工具箱
💻 M
字号:
%Callback for the window button in the window analysis
%Written on 05/12/97
%%%%%%%%%%%%%%%%%%%%%%%%
%  create message window and write message in that window also
   message_window=figure('Unit','normalized',...
           'Position',[0.05 0.2 0.5 0.2],...
           'Resize','off',...
           'Color',BACK_COLOR,...
           'Numbertitle','off',...
           'Name','Message');
axis('off');        
ss=sprintf('Calculating the widowed data.  Please wait until');
text(-0.05,1,ss,'color',[0 0 1],'FontSize',10);
ss=sprintf('the middle pane re-displays all of the windows.');
text(-0.05,5/6,ss,'color',[0 0 1],'FontSize',10);
pause(5.);        
close(message_window);
clear message_window;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% 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,'Name');
   if ~strcmp(s1,s2)
      clear time_out_win_h;
      break;
   end
   figure(time_out_win_h);
   hold off;
   clf;
   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;

if window_type == 1
	win = hamming(time_frame_len);	   % Window type
elseif window_type == 2
	win = hanning(time_frame_len);	   % Window type
elseif window_type == 3
	beta=0.5;
	win = kaiser(time_frame_len,beta);	% Window type
elseif window_type == 4
	win = triang(time_frame_len);	      % Window type
elseif window_type == 5
	win = bartlett(time_frame_len);	   % Window type
elseif window_type == 6
	win = blackman(time_frame_len);	   % Window type
elseif window_type == 7
	win = boxcar(time_frame_len);	      % Window type
elseif window_type == 8
	rdb=3;
	win = chebwin(time_frame_len,rdb);	% Window type
end
%%%%%%%%%%%%%%%%%%%%



%Window the signal;
len_of_signal = length(signal);
len_of_window = time_frame_len - time_overlap;
if time_frame_len > len_of_signal
   disp('Please choose a shorter window length');
else
   no_of_windows = fix(len_of_signal/len_of_window)+1;
   subplot(3,1,1);
   plot(signal);
   title('Original Signal');
   AXIS = axis;
   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
      win1 = zeros(size(signal));
      frame = signal(start_sample:end_sample);
      win1(start_sample:end_sample) = win(1:length(frame));
      win2(:,z) = win1;
      windowed_frame(start_sample:end_sample) = frame.*win1(start_sample:end_sample);
      subplot(3,1,2);
      plot(win1);
      title('Window');
      axis([1 length(signal) 0 1.2]);
      subplot(3,1,3);
      plot(windowed_frame);
      title('The windowed signal');
      axis(AXIS);
      pause(0.01);
   end;
   for z = 1:no_of_windows
      subplot(312)
      plot(win2(:,z));
      axis([1 length(signal) 0 1.2]);
      hold on;
   end
   hold off;
   clear window win1  win2 frame windowed_frame  
end;



   

⌨️ 快捷键说明

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