% Close the prev figure
% close(hfig);
% The dinmensions of the main window
main_width = 804;
% The pixel height of the main window
main_height = 688;
% The Width and height of the main title in pixels
title_width = 560;
title_height = 100;
% title position
title_width1 = 200;
% The X pixel position of the lower left corner
title_left = (main_width-title_width)/2;
% The Y pixel of the left bottom corner
title_bottom = 150;
% The height of the title
title_height1 = 40;
% create the directories in case they donot exist, if they already exists
% then nothing will happen
WarningFlag = mkdir('test');
WarningFlag = mkdir('moditest');
% The Title string based in the selected radio button
if(ValueButton == 1)
TitleString = 'Speech Recognition System';
DirName = 'test';
else
TitleString = 'Modified MFCC Based System';
DirName = 'modiTest';
end
% Gets the screen size in a matrix that has
% 1. X axis pixel value of the lower left corner
% 2. Y axis pixel value of the lower left corner
% 3. The pixel width of the screens X axis
% 4. The pixel height of the screens Y axis
% In matlab the size of GUI objects is determined by the four factors
% describes above
pos = get(0,'ScreenSize');
% colors
Bg_Color = [0.7 0.7 0.8];
Bg_Color1 = [0.7 0.7 0.8];
Frame_Color2 = [0.9 0.8 0.8];
Frame_Color = [0.8 0.8 0.9];
Button_Color = [0.5 0.8 0.9];
Bg_Color5 = [0.5 0.8 0.8];
Bg_Color4 = [1 0.40 0.5];
% main buttons size
button_width = 160;
button_height = 40;
buttonWidth = 120;
buttonHeight = 20;
button_left = 100;
% main window
% The main figure window comes using the figure command, the different
% values of the different properties can be adjusted by writing the
% property name in the figure and next the value. If nothing is mentioned
% the default values are taken. See help figure for further assistance
% The hfig is the handle to the figure, it can be said as the reference
% number that points to the figure
% handle = figure (the function name that creates figure) ('Property', 'its value' )
hfig2 = figure('Name','Speech Recognition System',...% The name of the figurefigure title
'NumberTitle','off',...% The title appearing on the upper left corner of a window
'Resize','off',...% The resizing option
'Visible','on',...% The visibility of the figure
'Position',[pos(3)/2-main_width/2 pos(4)/2-main_height/2-5 main_width main_height+20],...% The position of the figure
'MenuBar','none', ...% Menu bar
'Color', Bg_Color);% The back ground color
% The text displaying the main title,
% uicontrol is the GUI making function of the matlab, depending on the
% style of the uicontrol it can be a edit box, a text box, a button, a drop
% down etc etc. The Title is the reference number to the figure. The
% properties of the uicontrol can be adjusted or changed just as that of
% the figure.
Title = uicontrol(hfig2,...
'style','text',...
'position',[title_left-15 title_bottom+250 title_width title_height],... % [from_left from_bottom width height]
'BackgroundColor',Bg_Color,...
'Fontweight','bold',...
'FontSize',20,...
'string', TitleString);
% Retreiving the file names of the current database files from the system
% The dir command is the DOS based command that reads files from the
% current directory
DirectoryFileList = dir(DirName);
FileNames = char(DirectoryFileList.name);
[rowFN, colFN] = size(FileNames);
if(rowFN <= 2)
FileNamesListBox = [];
else
FileNamesListBox = [FileNames(3:end, :)];
end
TextList = uicontrol(hfig2,...
'style','text',...
'position',[title_left+100 title_bottom+290 buttonWidth buttonHeight],... % [from_left from_bottom width height]
'BackgroundColor',Bg_Color,...
'FontSize',12,...
'string', 'The DataBase Files');
% The listbox for the names of the file in the current database
HList = uicontrol(hfig2, ...
'style', 'listbox', ...
'position', [title_left+100 title_bottom+200 title_width1+100 title_height1+50], ...
'string', FileNamesListBox);
% The button to add to the database
HButtonAdd = uicontrol(hfig2, ...
'style', 'push', ...
'position', [title_left+100 title_bottom+150 buttonWidth buttonHeight], ...
'BackgroundColor', Button_Color, ...
'string', 'Add ...', ...
'callback', 'Add2System' ...
);
% The button to remove from the database
HButtonRem = uicontrol(hfig2, ...
'style', 'push', ...
'position', [title_left+100+buttonWidth title_bottom+150 buttonWidth buttonHeight], ...
'BackgroundColor', Button_Color, ...
'string', 'Remove ...', ...
'callback', 'RemoveFromSystem' ...
);
% The button to initiate the recognition system
HButtonRecog = uicontrol(hfig2, ...
'style', 'push', ...
'position', [title_left+100+2*buttonWidth title_bottom+150 buttonWidth buttonHeight], ...
'BackgroundColor', Button_Color, ...
'string', 'Recognize', ...
'callback', 'RecognizeSys' ...
);
% The Summary button
HButtonSum=uicontrol(hfig2, ...
'style','push', ...
'position',[title_left+100 title_bottom+130 buttonWidth*3 buttonHeight], ...
'BackgroundColor',Button_Color ,...
'string', 'Summary of this session',...
'callback','SummaryGen');
% The EXIT button
HButtonExit=uicontrol(hfig2, ...
'style','push', ...
'position',[title_left+100 title_bottom+110 buttonWidth*3 buttonHeight], ...
'BackgroundColor',Button_Color ,...
'string', 'Exit',...
'callback','close');
% The Title for HELP
HELPTitle = uicontrol(hfig2,...
'style','text',...
'position',[title_left+100 title_bottom-10 title_width1+150 title_height1+80],... % [from_left from_bottom width height]
'BackgroundColor',Bg_Color5,...
'Fontweight','bold',...
'FontSize',10,...
'string',['Press "Add.." to add a speech. Press "Delete" to remove a speaker from the database. '...
'Press "recognize" to test a speech, In that case speech would be recorded as soon as the button '...
'is pressed']);
评论0