Internal Device Error when playing sound after plugging/unplugging headphones - (R2018b 9.5.0.944444)
Show older comments
Device used: Macbook Pro 2018 10.14.3
Matlab version: R2018b 9.5.0.944444
I am encoutering an error when using the sound/soundsc functions in Matlab, after plugging in (or unplugging) headphones. Matlab properly plays sound prior to plugging/unplugging them, but will throw the following error after, even if I began with them unplugged, and later plug them back in. Restarting Matlab fixes the issue with headphones in OR out, until plugging/unplugging headphones again.
My code:
fsamp = 11025;
dt = 1/fsamp;
dur = 1.8;
tt = 0:dt:dur;
psi = 2*pi*(500*tt.*tt + 200*tt);
xx = real(7.7*exp(1j*psi));
soundsc(xx,fsamp);
Error:
Error using sound (line 76)
Device Error: Internal Device Error
Error in soundsc (line 55)
sound(varargin{:});
Debugging the sound function shows me that the exception is thrown from line 74 in sound:
play(playerObj(end));
But I am unable to figure it out beyond this. I have checked the audioplayer and audioDeviceWriter objects, and they properly update when the headphones are plugged/unplugged. I'm not sure how related they are to this issue, and am wondering if this could be a Mac issue?
Any help or direction is appreciated,
E Blagg
16 Comments
Walter Roberson
on 23 Feb 2019
Are those regular headphones or are they USB headphones ?
Ethan Blagg
on 23 Feb 2019
ed
on 2 Sep 2019
I have the same probblem in Matlab 2019a, update5, running in OS X Mojave.
Steven Fenton
on 18 Oct 2019
Edited: Steven Fenton
on 18 Oct 2019
I have the same issue. In 2019b, running OS X Mojave.
If you restart Matlab, with your Headphones plugged into the 3.5mm Jack, this will fix the issue in that Matlab will play to the Headphones rather than the internal speakers.
This must be something to do with the change in enumeration of playback hardware introduced in Mojave. Pretty easy to sort by Mathworks I'd think.
Tom Shlomo
on 31 Jan 2020
I also have the same issue, 2019b update 3, macOS Mojave.
Fred Wagen
on 7 Oct 2020
I also have the same issue, 2020b (9.9.0.1467703), macOS Mojave.
Michael Rarela
on 3 Jun 2021
I have the same issue too with "9.10.0.1649659 (R2021a) Update 1" on macOS Catalina, when I unplugged my headphones. Replugging my headphones in again did not help.
Luis Eduardo Cofré Lizama
on 6 Jun 2021
Same here, have you got any answer/ solution?
Ji hoon Han
on 6 Jun 2021
Yeah need help on this one macOS BigSur
Jimmy Eadie
on 28 Aug 2021
I am getting same error:
Error using sound (line 79)
Device Error: Internal Device error
play(playerObj(end));
catch exception
throw(exception);
end
Walter Roberson
on 29 Aug 2021
Is this only associated with having unplugged headphones?
Jimmy Eadie
on 29 Aug 2021
Edited: Jimmy Eadie
on 29 Aug 2021
I am not using headphones, only speakers, have never used the 3.5 input/outout for headphones.
Sishi Liao
on 13 Jan 2022
Same here: MATLAB 2021b on MacOS Monterey 12.1.
Seems like a problem with MacOS 😂
lu xin jie
on 4 May 2022
Same. MATLAB 2021b MacOS Big Sur 11.6.4
Sarah Mann
on 18 Jul 2022
also battling with this! MacOS Monterey 12.4 :(
Hugo Hugo
on 24 Nov 2022
Why is this issue still present in 2022a after 4 years? MacOS Ventura 13.0.1
The only workaround I have so far is to get the first device that's not bugged via audiodevinfo(0, 44100, 24, 1)
Answers (2)
Jon Nissenbaum
on 11 Dec 2022
3 votes
I don't know if others are still facing this issue. Previously I was plagued by it all the time and the only recourse was to quit and restart Matlab. More recently (version R2022a, MacOS 12.4), I no longer seem to get the error, but Matlab still does not recognize when I plug in headphones. In case this is happening to anyone else, I am now able to solve this problem by typing audiodevreset
2 Comments
Hugo Hugo
on 11 Dec 2022
Interesting, I’m still getting it with 2022a and MacOS 13.0.1. I’ll see if audiodevreset solves the bug.
Emily King
on 13 Nov 2023
Thank you! This is still an issue with 2023b and MacOS 14.1.1, but your solution fixes it.
Rishabh Gupta
on 4 Mar 2019
2 votes
Hi Ethan,
I think the issue requires some detail investigation. I would suggest you to contact MathWorks Technical Support.
Thanks
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!