📄 e_zoom.m
字号:
%Callback function for the zoom button by Karthik May 25 1997
%To zoom a segment of speech, click the left mouse button on the beginning and end points
%To zoom out, click the left and right mouse buttons in any order(but not together)
%To exit the zooming function, click the right mouse button twice
%
%Modified by D. G. Childers
%
if exist('left_line_h') == 1
clear left_line_h right_line_h
end
figure(ana_wav_win_h);
AXIS = axis;
button = [1 1];
while button(1)~=3 | button(2)~=3
[xx,yy,button] = ginput(2);
xx=round(xx);
if button(1)== 1 & button(2) ==1
LEFT1(zoom_level) = LEFT;
RIGHT1(zoom_level) = RIGHT;
zoom_level = zoom_level + 1;
if (xx(2)>xx(1))
LEFT = round(xx(1));
RIGHT = round(xx(2));
else
LEFT = round(xx(2));
RIGHT = round(xx(1));
end
axis1 = LEFT:RIGHT;
subplot(2,1,1);
plot(axis1,SPEECH_OLD(LEFT:RIGHT));
axis([LEFT RIGHT AXIS(3) AXIS(4)]);
axis2=axis;
subplot(2,1,2);
plot(SPEECH_OLD);
hold on;
plot([xx(1) xx(1)]);
hold on;
plot([xx(2) xx(2)]);
hold on;
axis([1 LEN AXIS(3) AXIS(4)]);
elseif (button(1)==1 & button(2) ==3)|(button(1) == 3 & button(2) ==1)
zoom_level = zoom_level -1;
if zoom_level <=0
zoom_level = 1;
end;
LEFT = LEFT1(zoom_level);
RIGHT = RIGHT1(zoom_level);
axis1 = LEFT:RIGHT;
subplot(2,1,1);
plot(axis1,SPEECH_OLD(LEFT:RIGHT));
axis([LEFT RIGHT AXIS(3) AXIS(4)]);
axis2=axis;
subplot(2,1,2);
plot(SPEECH_OLD);
axis([1 LEN AXIS(3) AXIS(4)]);
elseif button(1) ==3 & button(2) ==3
if zoom_level==1
figure(ana_wav_win_h);
subplot(1,1,1);
plot(SPEECH_OLD);
LEFT=1;
LEN=length(SPEECH_OLD);
RIGHT=LEN;
end;
break;
end
end;
clc;
SPEECH = SPEECH_OLD(LEFT:RIGHT);
disp('Exiting the zooming function');
clear xx
return;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -