Error using audioread function in MATLAB. It gives error while using .wav or .mp3.
You are now following this question
- You will see updates in your followed content feed.
- You may receive emails, depending on your communication preferences.
An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
Show older comments
>> [y,Fs] = audioread('C:\Users\sat33\Documents\MATLAB\audio1.wav')
*** audioread: problem reading C:\Users\sat33\Documents\MATLAB\audio1.wav - returning empty waveform
y =
[]
Fs =
0
3 Comments
Walter Roberson
on 10 Dec 2018
Which MATAB release are you using, and which operating system? You appear to be using some Windows version but I am not sure which.
Hi Walter,
I am using MATLAB 2018b & Windows 10 OS.
I am able to run audioinfo(), just incase it helps-
>> info = audioinfo('audio1.wav')
info =
struct with fields:
Filename: 'C:\Users\sat33\Documents\MATLAB\audio1.wav'
CompressionMethod: 'Uncompressed'
NumChannels: 1
SampleRate: 8000
TotalSamples: 14522333
Duration: 1.8153e+03
Title: '20Label'
Comment: []
Artist: []
BitsPerSample: 16
Walter Roberson
on 10 Dec 2018
Edited: Walter Roberson
on 10 Dec 2018
Can you attach the .wav file for us to test?
Also check in case there are permission problems with the file.
Accepted Answer
Astha Singh
on 12 Dec 2018
Hello Satwik,
This error might be the result of a third-party "audioread" function available on the internet, which is possibly shadowing the built-in MATLAB "audioread" function.
Verify you are using the built-in “audioread” function by executing the following line in the MATLAB Command Window:
>> which('audioread', '-all')
The only path displayed should be:
matlabroot\toolbox\matlab\audiovideo\audioread.m
Note that "matlabroot" in the path shown above will be replaced by the path of the folder where MATLAB is installed in your system.
If more than one path is displayed, a third-party function is taking precedence over the built-in "audioread" function.
If you want to return to using the built-in function, you must remove the third-party function from your MATLAB search path by executing the following lines in the Command Window:
>> rmpath(fileparts(which('audioread')))
>> savepath
17 Comments
Satwik Dutta
on 12 Dec 2018
Thank you so much Astha. This was exactly the case.
Alejandro Gonzalez
on 2 Feb 2022
After performing this action I get this error : Undefined function or variable 'audioread'. Help me! please.
Walter Roberson
on 3 Feb 2022
You would only do that rmpath() if you had a third-party audioread.m .
That said, audioread() was introduced in R2012b, so if you are using a version older than that, we would need to know your version in order to advise you what to use.
Alejandro Gonzalez
on 3 Feb 2022
Thanks for answering. The version I use is R2016a
Alejandro Gonzalez
on 3 Feb 2022
In fact other functions like: audiorecorder, wavread, wayplay, etc... also don't work come out as undefined
I suspect that you messed up your MATLAB path. Try using
restoredefaultpath
rehash toolboxcache
savepath
when i run the code audioread
it gives me this error
Error using audioread (line 135)
Error: File: Channel.m Line: 352 Column: 17
Unexpected MATLAB expression.
Walter Roberson
on 3 Feb 2022
Which MATLAB release are you using?
In current versions, audioread() line 135 has nothing to do with channel, work, but at about line 168 there is a call to asyncio.Channel . It is plausible that in a sufficiently early release that call might have been line 135.
Alejandro Gonzalez
on 3 Feb 2022
Edited: Alejandro Gonzalez
on 3 Feb 2022
The version of matlab that I use is shown here:
>> ver
----------------------------------------------------------------------------------------------------
MATLAB Version: 9.0.0.341360 (R2016a)
MATLAB License Number: *****
Operating System: Microsoft Windows 10 Home Version 10.0 (Build 18362)
Java Version: Java 1.7.0_60-b19 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
----------------------------------------------------------------------------------------------------
MATLAB Version 9.0 (R2016a)
Simulink Version 8.7 (R2016a)
Aerospace Blockset Version 3.17 (R2016a)
Aerospace Toolbox Version 2.17 (R2016a)
Antenna Toolbox Version 2.0 (R2016a)
Audio System Toolbox Version 1.0 (R2016a)
Bioinformatics Toolbox Version 4.6 (R2016a)
Communications System Toolbox Version 6.2 (R2016a)
Computer Vision System Toolbox Version 7.1 (R2016a)
Curve Fitting Toolbox Version 3.5.3 (R2016a)
DO Qualification Kit Version 3.1 (R2016a)
DSP System Toolbox Version 9.2 (R2016a)
Data Acquisition Toolbox Version 3.9 (R2016a)
Database Toolbox Version 6.1 (R2016a)
Datafeed Toolbox Version 5.3 (R2016a)
Econometrics Toolbox Version 3.4 (R2016a)
Embedded Coder Version 6.10 (R2016a)
Filter Design HDL Coder Version 3.0 (R2016a)
Financial Instruments Toolbox Version 2.3 (R2016a)
Financial Toolbox Version 5.7 (R2016a)
Fixed-Point Designer Version 5.2 (R2016a)
Fuzzy Logic Toolbox Version 2.2.23 (R2016a)
Global Optimization Toolbox Version 3.4 (R2016a)
HDL Coder Version 3.8 (R2016a)
HDL Verifier Version 5.0 (R2016a)
IEC Certification Kit Version 3.7 (R2016a)
Image Acquisition Toolbox Version 5.0 (R2016a)
Image Processing Toolbox Version 9.4 (R2016a)
Instrument Control Toolbox Version 3.9 (R2016a)
LTE System Toolbox Version 2.2 (R2016a)
MATLAB Coder Version 3.1 (R2016a)
MATLAB Compiler Version 6.2 (R2016a)
MATLAB Compiler SDK Version 6.2 (R2016a)
MATLAB Distributed Computing Server Version 6.8 (R2016a)
MATLAB Report Generator Version 5.0 (R2016a)
Mapping Toolbox Version 4.3 (R2016a)
Model Predictive Control Toolbox Version 5.2 (R2016a)
Model-Based Calibration Toolbox Version 5.1 (R2016a)
Neural Network Toolbox Version 9.0 (R2016a)
OPC Toolbox Version 4.0.1 (R2016a)
Optimization Toolbox Version 7.4 (R2016a)
Parallel Computing Toolbox Version 6.8 (R2016a)
Partial Differential Equation Toolbox Version 2.2 (R2016a)
Phased Array System Toolbox Version 3.2 (R2016a)
Polyspace Bug Finder Version 2.1 (R2016a)
Polyspace Code Prover Version 9.5 (R2016a)
RF Toolbox Version 3.0 (R2016a)
Robotics System Toolbox Version 1.2 (R2016a)
Robust Control Toolbox Version 6.1 (R2016a)
Signal Processing Toolbox Version 7.2 (R2016a)
SimBiology Version 5.4 (R2016a)
SimEvents Version 5.0 (R2016a)
SimRF Version 5.0 (R2016a)
Simscape Version 4.0 (R2016a)
Simscape Driveline Version 2.10 (R2016a)
Simscape Electronics Version 2.9 (R2016a)
Simscape Fluids Version 2.0 (R2016a)
Simscape Multibody Version 4.8 (R2016a)
Simscape Power Systems Version 6.5 (R2016a)
Simulink 3D Animation Version 7.5 (R2016a)
Simulink Code Inspector Version 2.5 (R2016a)
Simulink Coder Version 8.10 (R2016a)
Simulink Control Design Version 4.3 (R2016a)
Simulink Design Optimization Version 3.0 (R2016a)
Simulink Design Verifier Version 3.1 (R2016a)
Simulink Desktop Real-Time Version 5.2 (R2016a)
Simulink PLC Coder Version 2.1 (R2016a)
Simulink Real-Time Version 6.4 (R2016a)
Simulink Report Generator Version 5.0 (R2016a)
Simulink Test Version 2.0 (R2016a)
Simulink Verification and Validation Version 3.11 (R2016a)
Spreadsheet Link Version 3.2.5 (R2016a)
Stateflow Version 8.7 (R2016a)
Statistics and Machine Learning Toolbox Version 10.2 (R2016a)
Symbolic Math Toolbox Version 7.0 (R2016a)
System Identification Toolbox Version 9.4 (R2016a)
Trading Toolbox Version 3.0 (R2016a)
Vehicle Network Toolbox Version 3.1 (R2016a)
Vision HDL Toolbox Version 1.2 (R2016a)
WLAN System Toolbox Version 1.1 (R2016a)
Wavelet Toolbox Version 4.16 (R2016a)
Alejandro Gonzalez
on 4 Feb 2022
Help me! please
I had a look at the R2016a code... and I think you need to reinstall MATLAB itself (but not the toolboxes)
Around line 95 of your version is the code
channel = asyncio.Channel( ...
readPlugin,...
PluginManager.getInstance.MLConverter, ...
options, [0, 0]);
and synchio.Channel has its implementation at
toolbox/shared/asynciolib/+asyncio/Channel.m
Notice the + in the directory name: this is a "package" and when you call upon asycio.Channel() that way, it is restricted to finding the Channel.m that is inside the +asyncio folder. In particular, it would not be enough for you to happen to have a Channel.m of your own hanging around. To get the "wrong" Channel.m accidentally, you would have had to have an extra +asyncio folder hanging around -- not impossible, but pretty unlikely. It is more likely that somehow toolbox/shared/asynciolib/+asyncio/Channel.m got corrupted.
You could try using
restoredefaultpath; rehash toolboxcache
and see if that solves the problem... I don't think it will, but it is worth the brief test (at lot faster to test that than to reinstall MATLAB itself.)
Alejandro Gonzalez
on 5 Feb 2022
Edited: Alejandro Gonzalez
on 5 Feb 2022
Do the test with the command but the error continues and indeed if the folder is found: toolbox/shared/asynciolib/+asyncio/Channel.m at that address, on line 95 of audioread. Channel.m not found.
% Create Channel object
channel = asyncio.Channel( ...
readPlugin,...
PluginManager.getInstance.MLConverter, ...
options, [0, 0]);
Walter Roberson
on 5 Feb 2022
Sounds like the Channel.m file at that location is corrupt. If you have backups you could try restoring the file, but otherwise you will need to reinstall matlab itself.
SAI BHARATH R
on 13 Jun 2022
walter, i have similar error but im using r2021b and uninstall also not happening
Walter Roberson
on 13 Jun 2022
Please post a complete copy of the error message that you received. The details of line numbers are important for this purpose
hanin t
on 6 Oct 2023
how if 'audioread' not found? how to fix it?
Walter Roberson
on 7 Oct 2023
audioread was added to basic MATLAB (no toolbox needed) in R2012b.
If audioread() cannot be found in your system, there are several possibilities:
- you might be using R2012a or earlier; or
- your MATLAB installation might be corrupt or your MATLAB path might have removed some important paths. If either of these are true you are probably going to end up re-installing MATLAB; or
- perhaps what you are passing to audioread() is not a string or character vector (or numeric value, or cell array) and is instead a class object, and the real complaint is not about audioread() not being found but rather saying no method audioread for that particular class. However, when I tested this, I was not able to get such an error: the way audioread() is designed it should be found on the path for any class (and then when called, audioread() checks whether the input is valid)
More Answers (0)
Categories
Find more on Audio I/O and Waveform Generation in Help Center and File Exchange
Tags
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)