MY CODE
classdef taigirl < matlab.apps.AppBase % Properties that correspond to app components properties (Access = public) UIFigure matlab.ui.Figure Button_2 matlab.ui.control.Button Button_4 matlab.ui.control.Button Button_5 matlab.ui.control.Button Button_3 matlab.ui.control.Button UIAxes matlab.ui.control.UIAxes Button matlab.ui.control.Button FreqListBoxLabel matlab.ui.control.Label FreqListBox matlab.ui.control.ListBox end properties (Access = private) fs = 44100; Freq; music; signal; fun; fun1; fun2; end methods (Access = private) % Code that executes after component creation function startupFcn(app) [app.fun1,app.fs] = audioread('HEYY.mp3',[1 1852200]); app.signal = app.fun1; app.fun2 = app.fun1; title(app.UIAxes, 'Freq'); xlabel(app.UIAxes, 'Time(s)'); end % Button pushed function: Button_2 function Button_2Pushed(app, event) switch app.FreqListBox.Value case '0.5x' app.Freq = 0.5 * app.fs ; case '1x' app.Freq = app.fs ; case '2x' app.Freq = 2 * app.fs ; case '5x' app.Freq = 3 * app.fs ; end app.music = audioplayer(app.signal,app.Freq); play(app.music,app.Freq); time = (1:length(app.signal))/app.Freq; plot(app.UIAxes, time, app.signal); end % Button pushed function: Button_4 function Button_4Pushed(app, event) pause(app.music); end % Button pushed function: Button_5 function Button_5Pushed(app, event) resume(app.music); end % Button pushed function: Button_3 function Button_3Pushed(app, event) stop(app.music); end % Button pushed function: Button function ButtonPushed(app, event) switch app.FreqListBox.Value case '0.5x' app.Freq = 0.5 * app.fs ; case '1x' app.Freq = app.fs ; case '2x' app.Freq = 2 * app.fs ; case '5x' app.Freq =5 * app.fs ; end app.music= audioplayer(flipud(app.signal), app.Freq); play(app.music, app.Freq); time = (1:length( app.signal))/app.Freq; plot(app.UIAxes, time, flipud(app.signal)); end end % App initialization and construction methods (Access = private) % Create UIFigure and components function createComponents(app) % Create UIFigure app.UIFigure = uifigure; app.UIFigure.Color = [0.902 0.902 0.902]; app.UIFigure.Position = [100 100 906 407]; app.UIFigure.Name = 'UI Figure'; % Create Button_2 app.Button_2 = uibutton(app.UIFigure, 'push'); app.Button_2.ButtonPushedFcn = createCallbackFcn(app, @Button_2Pushed, true); app.Button_2.BackgroundColor = [0.9412 0.9412 0.9412]; app.Button_2.FontName = 'Book Antiqua'; app.Button_2.FontSize = 36; app.Button_2.FontWeight = 'bold'; app.Button_2.Position = [24 318 76 62]; app.Button_2.Text = '▶'; % Create Button_4 app.Button_4 = uibutton(app.UIFigure, 'push'); app.Button_4.ButtonPushedFcn = createCallbackFcn(app, @Button_4Pushed, true); app.Button_4.BackgroundColor = [0.9412 0.9412 0.9412]; app.Button_4.FontSize = 36; app.Button_4.Position = [99 254 76 65]; app.Button_4.Text = '┃┃'; % Create Button_5 app.Button_5 = uibutton(app.UIFigure, 'push'); app.Button_5.ButtonPushedFcn = createCallbackFcn(app, @Button_5Pushed, true); app.Button_5.BackgroundColor = [1 1 1]; app.Button_5.FontSize = 28; app.Button_5.Position = [24 254 76 65]; app.Button_5.Text = '┃▶'; % Create Button_3 app.Button_3 = uibutton(app.UIFigure, 'push'); app.Button_3.ButtonPushedFcn = createCallbackFcn(app, @Button_3Pushed, true); app.Button_3.BackgroundColor = [1 1 1]; app.Button_3.FontSize = 28; app.Button_3.FontWeight = 'bold'; app.Button_3.Position = [99 318 76 62]; app.Button_3.Text = '▇'; % Create UIAxes app.UIAxes = uiaxes(app.UIFigure); title(app.UIAxes, 'Title') xlabel(app.UIAxes, 'X') ylabel(app.UIAxes, 'Y') app.UIAxes.Position = [215 28 675 352]; % Create Button app.Button = uibutton(app.UIFigure, 'push'); app.Button.ButtonPushedFcn = createCallbackFcn(app, @ButtonPushed, true); app.Button.BackgroundColor = [0.9412 0.9412 0.9412]; app.Button.FontSize = 36; app.Button.FontWeight = 'bold'; app.Button.Position = [24 129 151 126]; app.Button.Text = '↰'; % Create FreqListBoxLabel app.FreqListBoxLabel = uilabel(app.UIFigure); app.FreqListBoxLabel.HorizontalAlignment = 'right'; app.FreqListBoxLabel.Position = [24 83 30 22]; app.FreqListBoxLabel.Text = 'Freq'; % Create FreqListBox app.FreqListBox = uilistbox(app.UIFigure); app.FreqListBox.Items = {'0.5x', '1x', '2x', '5x'}; app.FreqListBox.Position = [69 28 106 79]; app.FreqListBox.Value = '1x'; end end methods (Access = public) % Construct app function app = taigirl % Create and configure components createComponents(app) % Register the app with App Designer registerApp(app, app.UIFigure) % Execute the startup function runStartupFcn(app, @startupFcn) if nargout == 0 clear app end end % Code that executes before app deletion function delete(app) % Delete UIFigure when app is deleted delete(app.UIFigure) end endendMY VIDEO