image thumbnail
from Penarayuz by Ozgur Emekli
Tool (GUI) for music audio transcription

penarayuz(varargin)
function varargout = penarayuz(varargin)
% PENARAYUZ M-file for penarayuz.fig
%      PENARAYUZ, by itself, creates a new PENARAYUZ or raises the existing
%      singleton*.
%
%      H = PENARAYUZ returns the handle to a new PENARAYUZ or the handle to
%      the existing singleton*.
%
%      PENARAYUZ('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in PENARAYUZ.M with the given input arguments.
%
%      PENARAYUZ('Property','Value',...) creates a new PENARAYUZ or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before penarayuz_OpeningFunction gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to penarayuz_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 penarayuz

% Last Modified by GUIDE v2.5 04-Sep-2006 16:32:19

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @penarayuz_OpeningFcn, ...
                   'gui_OutputFcn',  @penarayuz_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


% --- Executes just before penarayuz is made visible.
function penarayuz_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to penarayuz (see VARARGIN)

% Choose default command line output for penarayuz
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes penarayuz wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = penarayuz_OutputFcn(hObject, eventdata, handles) 
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
varargout{1} = handles.output;


% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% 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)


% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

data=seskayit(str2double(get(handles.edit1,'String')));


minpen=str2double(get(handles.minpen,'String'));
w=str2double(get(handles.w,'String'));
[onset ostidx oftidx]=penfrekall_tv2(3,w,minpen,8000,data);
[fd,nad,acc]=fbul(ostidx,oftidx,w,8000,data);
midiciz(ostidx,oftidx,nad,fd,w,8000,data);
pencal(ostidx,oftidx,fd,w);



function edit1_Callback(hObject, eventdata, handles)
% hObject    handle to edit1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit1 as text
%        str2double(get(hObject,'String')) returns contents of edit1 as a double


% --- Executes during object creation, after setting all properties.
function edit1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end





function tempo_Callback(hObject, eventdata, handles)
% hObject    handle to tempo (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of tempo as text
%        str2double(get(hObject,'String')) returns contents of tempo as a double


% --- Executes during object creation, after setting all properties.
function tempo_CreateFcn(hObject, eventdata, handles)
% hObject    handle to tempo (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


% --- Executes on selection change in notatur.
function notatur_Callback(hObject, eventdata, handles)
% hObject    handle to notatur (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: contents = get(hObject,'String') returns notatur contents as cell array
%        contents{get(hObject,'Value')} returns selected item from notatur
tempo=str2double(get(handles.tempo,'String'));
notaturlist=[1 1/2 1/4 1/8 1/16 1/32 1/64]
notatur=notaturlist(get(handles.notatur,'Value'));
set(handles.notasure,'String',[num2str(60/tempo*notatur) 'sn.']);



% --- Executes during object creation, after setting all properties.
function notatur_CreateFcn(hObject, eventdata, handles)
% hObject    handle to notatur (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: popupmenu controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end




% --------------------------------------------------------------------
function dosya1_Callback(hObject, eventdata, handles)
% hObject    handle to dosya1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
[filename, pathname] = uigetfile({'*.wav'});
  if filename~=0
handles.filename=filename;
handles.pathname=pathname;
guidata(hObject,handles);
set(handles.text14,'String',[pathname filename]);
veri=importdata([handles.pathname handles.filename]);

if min(length(veri.data))>=2
    veri.data=veri.data(:,1);
end

handles.fz=figure('position',[ 33    50   790   227]);
guidata(hObject,handles);
plot(veri.data);
xlabel('Samples');
ylabel('Sound Level (Volts)');

  end
% --------------------------------------------------------------------
function dosya_Callback(hObject, eventdata, handles)
% hObject    handle to dosya (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)




% --- Executes on selection change in minpen.
function minpen_Callback(hObject, eventdata, handles)
% hObject    handle to minpen (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: contents = get(hObject,'String') returns minpen contents as cell array
%        contents{get(hObject,'Value')} returns selected item from minpen


% --- Executes during object creation, after setting all properties.
function minpen_CreateFcn(hObject, eventdata, handles)
% hObject    handle to minpen (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: popupmenu controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end





function w_Callback(hObject, eventdata, handles)
% hObject    handle to w (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of w as text
%        str2double(get(hObject,'String')) returns contents of w as a double


% --- Executes during object creation, after setting all properties.
function w_CreateFcn(hObject, eventdata, handles)
% hObject    handle to w (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end




% --------------------------------------------------------------------
function islem_Callback(hObject, eventdata, handles)
% hObject    handle to islem (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


% --------------------------------------------------------------------
function islem1_Callback(hObject, eventdata, handles)
% hObject    handle to islem1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
disp('Analiz balyor');
veri= importdata([handles.pathname handles.filename]);
%minpen=round(1/veri.fs*get(str2double(handles.notasure,'String')));
minpen=str2double(get(handles.minpen,'String'));
w=str2double(get(handles.w,'String'));

if min(length(veri.data))>=2
    veri.data=veri.data(:,1);
end


if (get(handles.checkbox1,'Value')==get(handles.checkbox1,'Max'))
    figure(handles.fz);
    [x,y]=ginput(2);
    %x=round(x);
    %y=round(y);
    noise=std(veri.data(x(1):x(2))-...
    min(veri.data(x(1):x(1)))); 
else
    noise=[];
end
profile on
[onset ostidx oftidx]=penfrekall_tv2(3,w,minpen,44100,veri.data,noise);
[fd,nad,acc]=fbul(ostidx,oftidx,w,44100,veri.data);
profile off
midiciz(ostidx,oftidx,nad,fd,w,44100,veri.data);
pencal(ostidx,oftidx,fd,w)



% --- Executes on button press in checkbox1.
function checkbox1_Callback(hObject, eventdata, handles)
% hObject    handle to checkbox1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of checkbox1


Contact us at files@mathworks.com