Converting code to use wavread to audioread

조회 수: 9 (최근 30일)
AndyLAB
AndyLAB 2017년 5월 3일
댓글: Santosh Xavier 2019년 6월 14일
In new versions of MATLAB wavread is no longer supported. This could be used to get information from the additional information sections of the file, including custom fields.
[y, Fs, nbits, opts] = wavread(filename) returns a structure opts of additional information contained in the WAV file. The content of this structure differs from file to file. Typical structure fields include opts.fmt (audio format information) and opts.info (text that describes the title, author, etc.).
audioread has no such facility and audioinfo is very ridged and limited (not allowing the read of custom fields).
What is the way around this, as I am trying to get some pre-existing code working in the new version?
  댓글 수: 3
AndyLAB
AndyLAB 2017년 5월 4일
The files I am reading have some custom fields (the files are written by us and read by us). These custom fields provide extra information about how the data was created (its all custom stuff).
wavread conveniently returns all that information but is no longer supported.
I am not an expert on MATLAB (or programming) and am simply trying to use some preexisting code to perform a task.
Louise Wilson
Louise Wilson 2019년 4월 30일
Hi AndyLAB,
Did you resolve this? I am now having the same issue, using code that a previous student wrote to batch analyse audio files.
I can get Fs with audioread, but not nbits.
Thanks!

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

답변 (1개)

Sachin Kumar
Sachin Kumar 2017년 5월 9일
While writing data to your audio file, you can write your custom data/info as comment and you can read the same info in comment section using audioinfo() function. Check this example:
  댓글 수: 1
Santosh Xavier
Santosh Xavier 2019년 6월 14일
Faced same issue, resolved it using the following steps to get nbits
aInfo = audioinfo(wavfilename);
nbits = aInfo.BitsPerSample;

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

카테고리

Help CenterFile Exchange에서 Audio and Video Data에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by