Problem with playing audio file from App Designer
5 views (last 30 days)
Show older comments
Temirkhan Amanzhanov
on 1 Jun 2020
Commented: Temirkhan Amanzhanov
on 2 Jun 2020
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);
0 Comments
Accepted Answer
Ameer Hamza
on 2 Jun 2020
I think you have named your own app "audioplayer". You can check it using
which audioplayer
If it shows the path your .mlapp file, then rename it.
More Answers (0)
See Also
Categories
Find more on Audio and Video Data in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!