필터 지우기
필터 지우기

read single channel of multi-channel wav file

조회 수: 18 (최근 30일)
Michael
Michael 2013년 1월 16일
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

채택된 답변

Walter Roberson
Walter Roberson 2013년 1월 16일
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
Michael
Michael 2013년 1월 16일
Thanks for the quick response Walter. I saw that thread, but was hoping someone else had already worked out a function to do it.
Your suggestion is great. I kept thinking that if I only read in a portion of the wav, I would need to put my entire code in a giant loop and make things much more complex. Instead, I'll just loop through the wavread function and drop the channels I don't need right away, and then continue with the rest of the code. Thanks for the idea.
Michael
Walter Roberson
Walter Roberson 2013년 1월 16일
And if you create a function that does that for you, the code change would be easy.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Pulsed Waveforms에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by