jeff
jeff

Reputation: 13673

How to read a 2-channel audio file in MATLAB

When I read an audio file with [y, Fs] = wavread(filename), it returns an Nx2 matrix. What are the meanings of these "channels"? Are they left & right? And if so, how should I combine them? I would have averaged them but an external code uses x(:,1) and I couldn't understand why.

So how can I read this signal correctly?

Thanks for any help!

Upvotes: 1

Views: 3687

Answers (1)

Daniel
Daniel

Reputation: 36720

Luis Mendo is right. I was unable to find this information in doc wavread but if you check out doc sound it documents that x(:,1) is the left and x(:,2) is the right channel.

If you are using a recent version of matlab, conciser switching to audioread

In many cases the left channel is used because you may experience strange effects when mixing stereo channels. The phase-shift differs for each frequency and some frequency may get lost when averaging. Especially when analysing sound properties, use only one channel.

Upvotes: 3

Related Questions