Problem with playing audio file from App Designer
Mostrar comentarios más antiguos
Hello everyone, I have a problem with playing audio file in App Designer. I have no idea how to solve it. Before today everything was working, but suddenly it has been changed. The error massage: "Error using audioplayer Too many input arguments." Thanks for response! There is my code:
classdef AudioPlayer191 < matlab.apps.AppBase
% Properties that correspond to app components
properties (Access = public)
UIFigure matlab.ui.Figure
MainmenuMenu matlab.ui.container.Menu
OpenafileMenu matlab.ui.container.Menu
EqualizerMenu matlab.ui.container.Menu
PreferencesMenu matlab.ui.container.Menu
Switch matlab.ui.control.Switch
Panel matlab.ui.container.Panel
Previous matlab.ui.control.Button
Stop matlab.ui.control.Button
Slider matlab.ui.control.Slider
Play matlab.ui.control.Button
VolumeFull matlab.ui.control.Button
CurrentSong matlab.ui.control.EditField
Next matlab.ui.control.Button
PlayList matlab.ui.control.EditField
UIAxes matlab.ui.control.UIAxes
ScrollerTrack matlab.ui.control.Slider
Timer matlab.ui.control.EditField
Label matlab.ui.control.Label
end
properties (Access = private)
player
filename
pathname
y
flag
end
properties (Access = public)
vol
end
% Callbacks that handle component events
methods (Access = private)
% Menu selected function: OpenafileMenu
function OpenafileMenuSelected(app, event)
[app.filename, app.pathname] = uigetfile("*.mp3; *.wav; *.m4a; *.flac; *.aac", "Choose a file");
app.CurrentSong.Value = fullfile(app.pathname, app.filename);
[app.y, Fs] = audioread(app.CurrentSong.Value);
app.player = audioplayer(app.y, Fs);
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Audio and Video Data en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!