Hello, I'm doing a GUI where I want to use a Play and a Stop button. I'm using the sound command, but the command clear sound doesn't work, I'm using Matlab online, so I cannot use the audioplayer command because it doesn't work. I don't know why the clear sound doesn't work, it used to work well in the matlab offline, but my teacher is going to usea the online ver, so I need to fix it.
sound(Final,SampleR);
clear sound;

댓글 수: 9

Geoff Hayes
Geoff Hayes 2020년 4월 21일
Lina - I've seen some posts about using clear playsnd instead..though I'm not sure how valid it is (it won't work in my R2014a). Out of curiosity, why doesn't the audio player work on MATLAB Online? What error message do you observe?
When using audioplayer in Matlab Online a warning comes out
Warning:Unable to play audio because no audio outputs were found.
Also clear playsnd doesn't work
Adam Danz
Adam Danz 2020년 4월 22일
Matlab online cannot interact with most hardware.
I believe clear sound was undocumented.
If your teacher expects students to use Matlab Online with sounds, you can point him/her to the link I shared above.
Thank you so much!!
Rik
Rik 2020년 4월 22일
편집: Rik 2020년 4월 22일
I have several releases installed, but not enough to pinpoint when this was introduced. clear sound works in R2013b and later (test in R2019a and R2015a), but fails in R2011a. In that latter release clear playsnd seems to work.
%start playback
S=load('handel.mat');sound(S.y,S.Fs);
%stop playback on any release I could find
%'clear sound playsnd' to remove potential variables with those names
clear sound playsnd,clear sound,clear playsnd
%confirmed: R2019a, R2015a, R2013b, R2011a, R13 (v6.5)
Curious thing to leave undocumented.
Adam Danz
Adam Danz 2020년 4월 22일
편집: Adam Danz 2020년 4월 22일
I just tested it in r2020a and you can add that to the confirmed list (it works).
However it does not stop the sound from playing on Matlab Online
% matlab online
------------------------------------------------------------------------------------------------------
MATLAB Version: 9.8.0.1340451 (R2020a) Update 1
MATLAB License Number:
Operating System: Linux 4.14.174-0414174-generic #202003200742 SMP Fri Mar 20 11:45:37 UTC 2020 x86_64
Java Version: Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
------------------------------------------------------------------------------------------------------
Rik
Rik 2020년 4월 22일
Speculation time: based on this comment by Walter it could be OS-specific. (I can only test it on Windows, since I'm not planning on installing Matlab in an Ubuntu VM just to test this)
Adam Danz
Adam Danz 2020년 4월 22일
That very well may be the case. Windows user here so I can't test that either.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Audio I/O and Waveform Generation에 대해 자세히 알아보기

태그

댓글:

2020년 4월 22일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by