- Note: Where y is single or double and the BitsPerSample is 32 or 64, values in y might exceed −1.0 or +1.0.
How do I read data as it is in a wave file, without any normalizations.
6 views (last 30 days)
Show older comments
I use a data analysis software via which I export measured data like vibration, pressure, force, etc into wav files. I wish to read these files in MATLAB. The files consist of floating point data, whose range goes beyond -1 to +1. However, wavread, by default normalizes it to -1 to +1, or to –32768 to +32767, if I use the 'native' option. What can I do to output the data in its original form? Thanks.
0 Comments
Answers (1)
Star Strider
on 20 Dec 2014
The wavread function normalises to [-1,+1], but according to the documentation audioread does not. At least that is my impression.
From the documentation for audioread (under ‘Output Arguments’ -> y — Audio data):
I suggest you save your data in a .mat file instead of a sound file if at all possible, and as added security, save the maximum and minimum for your data so you can re-scale it if necessary.
2 Comments
Star Strider
on 20 Dec 2014
The limitations of wavwrite limits your ability to get around the scaling problem. There doesn’t seem to be a way to attach meta-data to a wavwrite file that would allow you to include the scaling data.
My only suggestion is to save each .wav file with the scaling data together in a .mat file. That way, everything is in one file and you don’t lose anything. With identical formats for each .mat file, you can likely automate the entire subsequent reading and processing and not have to intervene further.
I don’t know what you’re doing or the other software you’re using, so I cannot suggest anything more specific.
See Also
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!