• 17Hz
    了解作者
  • matlab
    开发工具
  • 313KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • 10 积分
    下载积分
  • 1
    下载次数
  • 2020-05-18 22:49
    上传日期
以matlab为平台,基于倒谱、自相关性进行基因检测。
pitch_detection.zip
  • pitch_detection
  • pitch_all
  • pr8_7_1.m
    3KB
  • Set_II.m
    198B
  • Wavelet_corrm1.m
    944B
  • pr8_4_2.m
    842B
  • F_weijunjie_a_sxbf_1m_s_09.wav
    62.5KB
  • ACF_clip.m
    1.3KB
  • pr8_3_1.m
    1.4KB
  • CAMDF_1.m
    1.4KB
  • simplesubspec.m
    1.2KB
  • Extoam.m
    1.2KB
  • ACF_corrbpa.m
    3.6KB
  • ACF_threelevel.m
    1.5KB
  • pr8_2_2.m
    1.8KB
  • snn27.wav
    684B
  • pr8_5_1.m
    1.5KB
  • pr8_1_1.m
    750B
  • OverlapAdd2.m
    2.4KB
  • whnh.wav
    155KB
  • ACFAMDF_corr.m
    1.1KB
  • pr8_7_2.m
    3.5KB
  • ACF_corr.m
    839B
  • enframe.m
    830B
  • pr8_2_1.m
    1.4KB
  • freqz_m.m
    234B
  • linsmoothm.m
    564B
  • sepct.m
    597B
  • pr9_2_1.m
    1.5KB
  • pitfilterm1.m
    398B
  • pr8_5_2.m
    2.3KB
  • findmaxesm3.m
    655B
  • M_liujunyi_a_sxbf_1m_s_02.wav
    61.3KB
  • pr8_4_1.m
    1.2KB
  • SNR_singlech.m
    400B
  • AMDF_mod.m
    1KB
  • Gnoisegen.m
    645B
  • CAMDF_mod.m
    1.1KB
  • AMDF_1.m
    1.3KB
  • pitch_vads.m
    2.4KB
  • pitch_vad1.m
    1.3KB
  • findSegment.m
    753B
  • Part_II.m
    632B
  • frame2time.m
    136B
  • self
  • Set_II.m
    177B
  • cepstral_pitch.m
    1.5KB
  • autocorrelation_pitch.m
    1.4KB
  • enframe.m
    830B
  • pitch_vads.m
    2.4KB
  • pitch_vad1.m
    1.3KB
  • findSegment.m
    753B
  • Part_II.m
    632B
  • frame2time.m
    136B
  • tone4.wav
    53.2KB
  • gui
  • A_Short_time_spectrum.fig
    81.9KB
  • A_Short_time_spectrum.m
    14.5KB
内容介绍
function varargout = A_Short_time_spectrum(varargin) % A_SHORT_TIME_SPECTRUM MATLAB code for A_Short_time_spectrum.fig % A_SHORT_TIME_SPECTRUM, by itself, creates a new A_SHORT_TIME_SPECTRUM or raises the existing % singleton*. % % H = A_SHORT_TIME_SPECTRUM returns the handle to a new A_SHORT_TIME_SPECTRUM or the handle to % the existing singleton*. % % A_SHORT_TIME_SPECTRUM('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in A_SHORT_TIME_SPECTRUM.M with the given input arguments. % % A_SHORT_TIME_SPECTRUM('Property','Value',...) creates a new A_SHORT_TIME_SPECTRUM or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before A_Short_time_spectrum_OpeningFcn gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to A_Short_time_spectrum_OpeningFcn via varargin. % % *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one % instance to run (singleton)". % % See also: GUIDE, GUIDATA, GUIHANDLES % Edit the above text to modify the response to help A_Short_time_spectrum % Last Modified by GUIDE v2.5 30-Mar-2020 12:19:55 % Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @A_Short_time_spectrum_OpeningFcn, ... 'gui_OutputFcn', @A_Short_time_spectrum_OutputFcn, ... 'gui_LayoutFcn', [] , ... 'gui_Callback', []); if nargin && ischar(varargin{1}) gui_State.gui_Callback = str2func(varargin{1}); end if nargout [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); else gui_mainfcn(gui_State, varargin{:}); end % End initialization code - DO NOT EDIT function pushbutton3_Callback(hObject, eventdata, handles) % hObject handle to pushbutton3 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) global h x Fs h2 width wlen_h point player flag filename; % hObject handle to pushbutton1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) wlen_h=400; [FileName,PathName] = uigetfile('.wav','选择音频文件'); filename=[PathName FileName]; [x,Fs]=audioread(filename); player=audioplayer(x,Fs);flag=0; x=x(:,1);N=length(x);xmax=max(x);xmin=min(x); t=(0:N-1)/Fs; plot(handles.axes1,t,x); axes(handles.axes1); h=line([3 3],[xmin xmax],... 'color','red',...a 'linewidth',4,... 'ButtonDownFcn',{@startDragFcn,handles}); point=round(3*Fs);subinval=(point-500):(point+500); xx=x(subinval,1);tt=subinval/Fs; windowl=(point-wlen_h)/Fs;windowr=(point+wlen_h)/Fs; width=windowr-windowl; axes(handles.axes2); plot(tt,xx); xxrange=ylim; hold on h2=patch([windowl windowl windowr windowr],[xxrange(2) xxrange(1) xxrange(1) xxrange(2)],... 'red','FaceAlpha',.5,... 'ButtonDownFcn',{@startDragFcn2,handles}); hold off % --- Executes just before A_Short_time_spectrum is made visible. function A_Short_time_spectrum_OpeningFcn(hObject, eventdata, handles, varargin) % Choose default command line output for A_Short_time_spectrum handles.output = hObject; % Update handles structure guidata(hObject, handles); % UIWAIT makes A_Short_time_spectrum wait for user response (see UIRESUME) % uiwait(handles.figure1); function startDragFcn(hObject, eventdata, handles) set(gcbf,'WindowButtonMotionFcn',{@draggingFcn,handles}); set(gcbf,'WindowButtonUpFcn',''); function draggingFcn(hObject, eventdata, handles) global h x Fs h2 width wlen_h point N pt=get(handles.axes1,'CurrentPoint'); set(h,'ButtonDownFcn',{@stopDragFcn,handles}); set(h,'Xdata',pt(1)*[1 1]); point=round(pt(1)*Fs);subinval=(point-500):(point+500);xx=x(subinval,1);tt=subinval/Fs; windowl=(point-wlen_h)/Fs;windowr=(point+wlen_h)/Fs; width=2*wlen_h/Fs; axes(handles.axes2); plot(tt,xx); xxrange=ylim; hold on h2=patch([windowl windowl windowr windowr],[xxrange(2) xxrange(1) xxrange(1) xxrange(2)],... 'red','FaceAlpha',.5,... 'ButtonDownFcn',{@startDragFcn2,handles}); hold off sub=(round((windowl*Fs)):round((windowr*Fs)));N=length(sub); fn=(0:N/2-1); xx=x(sub,1); xx1=xx.*hanning(N); ff=fn*Fs/N; yy1=abs(fft(xx1)); plot(handles.axes3,ff,yy1(fn+1)); a=yy1(fn+1); Peak_x=find(diff(sign(diff(a)))==-2)+1; [~,max_po]=max(a(Peak_x)); a(Peak_x(max_po))=min(a(Peak_x)); [~,Smax_po]=max(a(Peak_x)); if max_po<=Smax_po f1=ff(Peak_x(max_po)); f2=ff(Peak_x(Smax_po)); else f1=ff(Peak_x(Smax_po)); f2=ff(Peak_x(max_po)); end % y4=xcorr(xx1); % y4=fftshift(y4);n=length(y4); % plot(handles.axes4,0:round(n/2)-1,y4(1:round(n/2))); lmin=fix(Fs/500); % 基音周期的最小值 lmax=fix(Fs/60); % 基音周期的最大值 y4=rceps(xx1); n=length(y4); for s=1:n if y4(s)<-2 y4(s)=0; end end [R,K]=max(y4(lmin:lmax)); plot(handles.axes4,1:n/2,y4(1:n/2)); set(handles.text3,'string',[num2str((lmin+K)/Fs) 's']); set(handles.text13,'string',[num2str(Fs/(lmin+K)) 'Hz']); function stopDragFcn(hObject, eventdata, handles) global h set(h,'ButtonDownFcn',{@startDragFcn,handles}); set(gcbf,'WindowButtonMotionFcn',''); function startDragFcn2(hObject, eventdata, handles) global delt h2 click=get(handles.axes2,'CurrentPoint'); leftside=get(h2,'Xdata'); delt=click(1)-leftside(1); set(gcbf,'WindowButtonMotionFcn',{@draggingFcn2,handles}); function draggingFcn2(hObject, eventdata, handles) global h2 delt width x Fs xx ff fn yy N val_window pt=get(handles.axes2,'CurrentPoint'); left=pt(1)-delt;right=left+width; set(h2,'Xdata',[left left right right]); set(gcbf,'WindowButtonUpFcn',{@stopDragFcn2,handles}); sub=(round((left*Fs)):round((right*Fs)));N=length(sub); fn=(0:N/2-1); xx=x(sub,1);ff=fn*Fs/N; switch val_window case 1 xx1=xx.*hanning(N); case 2 xx1=xx.*hamming(N); case 3 xx1=xx.*boxcar(N); end yy=abs(fft(xx)); yy1=abs(fft(xx1)); axes(handles.axes3); plot(handles.axes3,ff,yy(fn+1),'--b'); hold on plot(handles.axes3,ff,yy1(fn+1),'r'); hold off xlim([0 8000]) a=yy1(fn+1); Peak_x=find(diff(sign(diff(a)))==-2)+1; [~,max_po]=max(a(Peak_x)); a(Peak_x(max_po))=min(a(Peak_x)); [~,Smax_po]=max(a(Peak_x)); if max_po<=Smax_po f1=ff(Peak_x(max_po)); f2=ff(Peak_x(Smax_po)); else f1=ff(Peak_x(Smax_po)); f2=ff(Peak_x(max_po)); end % y4=xcorr(xx1);n=length(y4); % y4=fftshift(y4);y4=y4(1:round(n/2)); % plot(handles.axes4,0:round(n/2)-1,y4); lmin=fix(Fs/500); % 基音周期的最小值 lmax=fix(Fs/60); % 基音周期的最大值 y4=rceps(xx1); n=length(y4); for s=1:n if y4(s)<-2 y4(s)=0; end end [~,K]=max(y4(lmin:lmax)); plot(handles.axes4,1:n/2,y4(1:n/2)); set(handles.text3,'string',[num2str((lmin+K)/Fs) 's']); set(handles.text13,'string',[num2str(Fs/(lmin+K)) 'Hz']); function stopDragFcn2(hObject, eventdata, handles) global h2 set(h2,'ButtonDownFcn',{@startDragFcn2,handles}); set(gcbf,'WindowButtonMotionFcn',''); % --- Outputs from this function are returned to the command line. function varargout = A_Short_time_spectrum_OutputFcn(hObject, eventdata, handles) % varargout cell array for returning output args (see VARARGOUT); % hObject handle to figure % eventdata reserv
评论
    相关推荐