What does the 'audioread' function actually do?
Show older comments
I have a .wav file exported by a vibration analyser Svan 958A. It contains data from 4 channels. The samples are written in hexadecimal representation.
I read the file by executing the following line: [data,fs] = audioread('svan0004.wav','native'). MATLAB correctly organises the data in an 4-column array. Since the file was obtained at 24 bits per sample, the output array elements are of the type int32.
However, there is something wrong with the reading/extraction of the sample values from the .wav file. The first 4 values of each column are known to me, because they include the data definitions for each channel. By looking at those values I realised that somehow MATLAB did not convert the sample hexadecimal numbers as I was expecting. Here is what I get. The following values are the first 4 extracted values for the 4 channels:
Channel 1: [256, 512, 4199168, 0];
Channel 2: [512, 512, 4199168, 0];
Channel 3: [768, 512, 4199168, 0];
Channel 4: [1024, 512, 4452608, 0];
The following values are what should have been read:
Channel 1: [1, 2, 16403, 0];
Channel 2: [2, 2, 16403, 0];
Channel 3: [3, 2, 16403, 0];
Channel 4: [4, 2, 17393, 0];
Could you explain me what does the 'audioread' function actually do? What is the way around this? How can I extract the sample values correctly from my .wav file?
Thank you for the support. Best regards, Pedro Ochôa
1 Comment
José-Luis
on 7 Jul 2016
Divide by 256?
Have you read the documentation on audioread()?
Accepted Answer
More Answers (0)
Categories
Find more on Multirate Signal Processing 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!