DSPRelated.com
Forums

Stereo audio and Equalizer

Started by snigdha March 17, 2006
Hi,

  I am doing my study on graphic and parametric equalizers. I read through
some of the previous posts on this site and was really helpful. I have one
small question though.

  When I am presented with a stereo audio signal, would it be advisable
for me to process the two channels using two separate IIR filter bands? Or
just assuming the data to be continuous, can I just use one filter? This
question arises the usage of two sets of delay buffers. Is that
warranted?

  Also, assuming that I have a .wav file, does any part of the header
suggest whether the data of the stereo signal is interleaved
(L-R-L-R-....) or is in buffers (L-L-L.....R-R-R....)?

Regards,
Snigdha


snigdha wrote:
> When I am presented with a stereo audio signal, would it be advisable > for me to process the two channels using two separate IIR filter bands? Or > just assuming the data to be continuous, can I just use one filter? This > question arises the usage of two sets of delay buffers. Is that > warranted?
Assuming your L-R data is interleaved, I guess you could use a single filter structure to filter both channels, if you use two delay elements between each tap (i.e. z^-2); this will give you an interleaved filtered output. However, this will require the same amount of buffer space as two separate filters. -- Oli
>Hi, > > I am doing my study on graphic and parametric equalizers. I read
through
>some of the previous posts on this site and was really helpful. I have
one
>small question though. > > When I am presented with a stereo audio signal, would it be advisable >for me to process the two channels using two separate IIR filter bands?
Or
>just assuming the data to be continuous, can I just use one filter? This >question arises the usage of two sets of delay buffers. Is that >warranted? > > Also, assuming that I have a .wav file, does any part of the header >suggest whether the data of the stereo signal is interleaved >(L-R-L-R-....) or is in buffers (L-L-L.....R-R-R....)? > >Regards, >Snigdha > > >
Looking at the aesthetic sense, and if you are not too strict about the output numbers.... you could possibly get away using a single filter. But, the scenario changes, if the stereo signal is made from two mono signals, i.e. two different audio signals in either channel. In that case, you would probably need two filters. And, I believe that the stereo signal of a wave file is interleaved. Thanks, ~ R K
snigdha wrote:
..
> When I am presented with a stereo audio signal, would it be advisable > for me to process the two channels using two separate IIR filter bands? Or > just assuming the data to be continuous, can I just use one filter? This > question arises the usage of two sets of delay buffers. Is that > warranted? >
You absolutely have to apply a separate filter instance to each channel (you can in any case make no assumptions about the contents of each channel). Structurally, each channel is an independent entity, though in a "musical" stereo signal the content seems to be a single sound, but located within the stereo field. The data on each channel will still be very different, according to such things as panning, reverb, etc. Of course, the filters must be identical.
> Also, assuming that I have a .wav file, does any part of the header > suggest whether the data of the stereo signal is interleaved > (L-R-L-R-....) or is in buffers (L-L-L.....R-R-R....)? >
All standard audio file formats present an interleaved stream. Many audio applications (e.g. VST and other plugin formats) de-interleave the data into separate buffers for processing. The output is then re-interleaved for streaming to the soundcard or writing to disk. Richard Dobson
rkthebad wrote:

   ...

> And, I believe that the stereo signal of a wave file is interleaved.
How could it be otherwise? One doesn't necessarily know the file size when recording begins. What offset could you use for the second buffer? Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
>rkthebad wrote: > > ... > >> And, I believe that the stereo signal of a wave file is interleaved. > >How could it be otherwise? One doesn't necessarily know the file size >when recording begins. What offset could you use for the second buffer? > >Jerry >-- >Engineering is the art of making what you want from things you can get. >����������������������������������������������������������������������� >
Thanks everyone. My questions have been answered. Good day, Snigdha.
in article LbOdnUM22pblQofZRVn-iw@giganews.com, rkthebad at
raviyenduri@gmail.com wrote on 03/17/2006 11:10:

>> I am doing my study on graphic and parametric equalizers. I read through >> some of the previous posts on this site and was really helpful. I have one >> small question though. >> >> When I am presented with a stereo audio signal, would it be advisable >> for me to process the two channels using two separate IIR filter bands? Or >> just assuming the data to be continuous, can I just use one filter? This >> question arises the usage of two sets of delay buffers. Is that >> warranted? >> >> Also, assuming that I have a .wav file, does any part of the header >> suggest whether the data of the stereo signal is interleaved >> (L-R-L-R-....) or is in buffers (L-L-L.....R-R-R....)? >>
it's interleaved. there is someplace in one of the header chunks that tells you how many channels and how wide the word width is.
> Looking at the aesthetic sense, and if you are not too strict about the > output numbers.... you could possibly get away using a single filter.
i can't see that as helping aesthetically.
> But, the scenario changes, if the stereo signal is made from two mono > signals, i.e. two different audio signals in either channel. In that case, > you would probably need two filters.
definitely 2 filters. the code and likely the coefficients would be the same, but the structure (or "record" or whatever term one uses) that contains the filter states would be different for each filter.
> And, I believe that the stereo signal of a wave file is interleaved.
it is and the user needs to de-interleave the channels. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
"robert bristow-johnson" <rbj@audioimagination.com> wrote in message 
news:C040D454.10D8C%rbj@audioimagination.com...
> in article LbOdnUM22pblQofZRVn-iw@giganews.com, rkthebad at > raviyenduri@gmail.com wrote on 03/17/2006 11:10: > >> But, the scenario changes, if the stereo signal is made from two mono >> signals, i.e. two different audio signals in either channel. In that case, >> you would probably need two filters. > > definitely 2 filters. the code and likely the coefficients would be the > same, but the structure (or "record" or whatever term one uses) that > contains the filter states would be different for each filter. > >> And, I believe that the stereo signal of a wave file is interleaved. > > it is and the user needs to de-interleave the channels.
...unless the code is structured to deal with interleaved signals naturally. For example, on the SHARC using SIMD, processing interleaved stereo material can be done almost transparently in the same number of cycles as a single stream without having to de-interleave the audio. Your filter delay buffers would also be interleaved in this scenario. This doesn't apply to the OP since he is working on a PC, but I thought I'd mention it. Of course, the filtering is still done with 2 separate filters conceptually, regardless of the implementation.
robert bristow-johnson wrote:

   ...

> definitely 2 filters. the code and likely the coefficients would be the > same, but the structure (or "record" or whatever term one uses) that > contains the filter states would be different for each filter.
I guess you're thinking if IIR filters. For transversal FIRs, a double-length circular buffer traversed with a stride of two works alternately on the left and right samples. Jerry -- Engineering is the art of making what you want from things you can get. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
in article Ru-dnd90tJ-tgoHZRVn-iA@rcn.net, Jerry Avins at jya@ieee.org wrote
on 03/18/2006 09:54:

> robert bristow-johnson wrote: > > ... > >> definitely 2 filters. the code and likely the coefficients would be the >> same, but the structure (or "record" or whatever term one uses) that >> contains the filter states would be different for each filter. > > I guess you're thinking if IIR filters. For transversal FIRs, a > double-length circular buffer traversed with a stride of two works > alternately on the left and right samples.
yeah, you're right (i was thinking IIR, but not specifically). actually, you could do this interlaced thingie with both input and output streams in the Direct Form 1 IIR also. (but i still think it's ugly and not very useful.) -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge." Q: Okay, so why is that bad? A: Because it messes up the order in which people normally read text. Q: Why is it such a bad thing? A: Top-posting. Q: What is one of the most annoying things on USENET and in e-mail?