Error using audioread function in MATLAB. It gives error while using .wav or .mp3.
이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
이전 댓글 표시
>> [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
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
2018년 12월 10일
편집: Walter Roberson
2018년 12월 10일
Can you attach the .wav file for us to test?
Also check in case there are permission problems with the file.
채택된 답변
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
Thank you so much Astha. This was exactly the case.
After performing this action I get this error : Undefined function or variable 'audioread'. Help me! please.
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.
Thanks for answering. The version I use is R2016a
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.
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.
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)
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.)
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]);
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.
walter, i have similar error but im using r2021b and uninstall also not happening
Please post a complete copy of the error message that you received. The details of line numbers are important for this purpose
how if 'audioread' not found? how to fix it?
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)
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Audio I/O and Waveform Generation에 대해 자세히 알아보기
태그
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- 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)
