Problem with playing audio file from App Designer
조회 수: 5 (최근 30일)
이전 댓글 표시
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
채택된 답변
Ameer Hamza
2020년 6월 2일
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.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Audio and Video Data에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!