read single channel of multi-channel wav file
21 views (last 30 days)
Show older comments
Hi there. I have 2- and 4-channel wav files that I need to read in to Matlab, but I only need channel 1. The files are too large to load with a single wavread. I could load in chunks, but that will require a lot of changes to the rest of the code to only deal with partial data. And this is something that is supposed to be done in a couple of days... in my spare time...
I've been searching around for awhile now, hoping that there is a simple script that someone else has come up with to read a single channel from a multi-channel wav. But so far no luck. I thought I'd ask the question, in case someone else has come across something appropriate and can steer me in the right direction.
Suggestions would be very much appreciated. Thanks so much for your help.
Michael
0 Comments
Accepted Answer
Walter Roberson
on 16 Jan 2013
There is no supplied method to do this.
You can write your own routine and would not need to make many changes to your code. Call it wavread1.m or something like that. Make it a wrapper that loops reading chunks of data and throwing away the extra channels, until you get to the end.
Or if you need higher efficiency, then you will find that wavread is MATLAB source; you can trace through the parts of it that are actually used for your files, and edit those parts to not read in the extra channels (if that makes sens for the chunk) or to throw away the extra (if necessary for that kind of chunk.)
2 Comments
Walter Roberson
on 16 Jan 2013
And if you create a function that does that for you, the code change would be easy.
More Answers (0)
See Also
Categories
Find more on Audio I/O and Waveform Generation 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!