Log in

View Full Version : Dolby "Matrix" Surround Encoding Conundrum


ChrisCoaster
December 20th 10, 11:31 PM
The original Dolby Surround encoding process required the surround
channel be phase shifted +90degrees in one channel and -90 in the
other.

I always thought that when something was "out of phase" the peaks were
180 degrees apart in a signal(as when you miswire one of a pair of
speakers and get that phasey effect).

What the heck is a 90 degree phase shift and how is it accomplished.
Succinctly, in Audacity, what amount of silence(delay in ms) would be
the equivalent of this "90 degree" phase shift? Audacity has an
"Invert" phase effect, but it's the same as switching the leads to one
speaker.

I was attempting to make a surround track from an existing mono track
in my PC, and initially went about it by loading the track three times
into audacity. I inverted one of the three tracks, but realized the
other two were still "sympathetic"(in phase that is!). I tried
delaying the main(mono) track various amounts of milliseconds, but
with unpredictable results - either all surround or just "velveeta"
stereo.

HELP!

-ChrisCoaster

William Sommerwerck
December 20th 10, 11:43 PM
> The original Dolby Surround encoding process required
> the surround channel be phase shifted +90 degrees in
> one channel and -90 in the other [, producing a net 180
> degrees of relative shift].

> I always thought that when something was "out of phase"
> the peaks were 180 degrees apart in a signal (as when you
> miswire one of a pair of speakers and get that phasey effect).

> What the heck is a 90 degree phase shift and how is it
> accomplished. Succinctly, in Audacity, what amount of
> silence (delay in ms) would be the equivalent of this "90
> degree" phase shift?

There is none, because the delay would be inversely proportional to
frequency. Delay is not going to produce what you want.


> Audacity has an "Invert" phase effect, but it's the same as
> switching the leads to one speaker.

> I was attempting to make a surround track from an existing mono
> track in my PC, and initially went about it by loading the track three
> times into Audacity. I inverted one of the three tracks, but realized
> the other two were still "sympathetic"(in phase that is!). I tried
> delaying the main (mono) track various amounts of milliseconds,
> but with unpredictable results - either all surround or just "Velveeta"
> stereo.

> HELP!

Mr Know-it-all will explain...

As you've discovered, it's not easy to produce an absolute phase shift of
+/- 90 degrees (unless you're willing to tolerate a 6db/8ve amplitude
rolloff). What's actually going on is that the 90-degree phase shift in the
rear channels is /relative to/ another phase shift in the front channels.

The front channels are fed through identical all-pass filters that introduce
a varying phase shift that increases with frequency. The rear channels are
fed through all-pass filters that, at any frequency, are 90 degrees ahead of
or behind the filters in the front channels.

This same technique is used in just about every "matrix" system, including
SQ and QS.

Get it? (Got it.) Good.

Mark
December 21st 10, 01:05 AM
On Dec 20, 6:43*pm, "William Sommerwerck" >
wrote:
> > The original Dolby Surround encoding process required
> > the surround channel be phase shifted +90 degrees in
> > one channel and -90 in the other [, producing a net 180
> > degrees of relative shift].
> > I always thought that when something was "out of phase"
> > the peaks were 180 degrees apart in a signal (as when you
> > miswire one of a pair of speakers and get that phasey effect).
> > What the heck is a 90 degree phase shift and how is it
> > accomplished. Succinctly, in Audacity, what amount of
> > silence (delay in ms) would be the equivalent of this "90
> > degree" phase shift?
>
> There is none, because the delay would be inversely proportional to
> frequency. Delay is not going to produce what you want.
>
> > Audacity has an "Invert" phase effect, but it's the same as
> > switching the leads to one speaker.
> > I was attempting to make a surround track from an existing mono
> > track in my PC, and initially went about it by loading the track three
> > times into Audacity. I inverted one of the three tracks, but realized
> > the other two were still "sympathetic"(in phase that is!). I tried
> > delaying the main (mono) track various amounts of milliseconds,
> > but with unpredictable results - either all surround or just "Velveeta"
> > stereo.
> > HELP!
>
> Mr Know-it-all will explain...
>
> As you've discovered, it's not easy to produce an absolute phase shift of
> +/- 90 degrees (unless you're willing to tolerate a 6db/8ve amplitude
> rolloff). What's actually going on is that the 90-degree phase shift in the
> rear channels is /relative to/ another phase shift in the front channels.
>
> The front channels are fed through identical all-pass filters that introduce
> a varying phase shift that increases with frequency. The rear channels are
> fed through all-pass filters that, at any frequency, are 90 degrees ahead of
> or behind the filters in the front channels.
>
> This same technique is used in just about every "matrix" system, including
> SQ and QS.
>
> Get it? (Got it.) Good.

right..

a 90 deg phase shift over a wide range of frequiencis is not easy to
create.

In analog circuits, it can be done with a large number of RC's,, look
up SSB phasing method...

In DSP it's done mathematically with a Hilbert transform.

Mark

William Sommerwerck
December 21st 10, 01:23 AM
> In analog circuits, it can be done with a large
> number of RC's, look up SSB phasing method...

But in SSB, the bandwidth is much, much less than an octave. It's not
difficult to get that 90 degrees over such a narrow range of frequencies.

Scott Dorsey
December 21st 10, 02:34 AM
ChrisCoaster > wrote:
>What the heck is a 90 degree phase shift and how is it accomplished.
>Succinctly, in Audacity, what amount of silence(delay in ms) would be
>the equivalent of this "90 degree" phase shift? Audacity has an
>"Invert" phase effect, but it's the same as switching the leads to one
>speaker.

It's not a delay (which is constant time for all frequencies) but a
phase shift (which is shorter time for higher frequencies than lower
ones, because it is constant phase and not constant time).

In the analogue world we do it with an all-pass network. In the digital
world there are special filters for the job.
--scott

--
"C'est un Nagra. C'est suisse, et tres, tres precis."

Mark
December 21st 10, 04:01 AM
On Dec 20, 8:23*pm, "William Sommerwerck" >
wrote:
> > In analog circuits, it can be done with a large
> > number of RC's, look up SSB phasing method...
>
> But in SSB, the bandwidth is much, much less than an octave. It's not
> difficult to get that 90 degrees over such a narrow range of frequencies.

well you need a 90 deg phase shift at the carrier freq which is easy
but you also need a 90 deg phase shift over the audio band which even
if its just voice is still 300 to 3000 i.e. a decade.

Mark

William Sommerwerck
December 21st 10, 01:15 PM
>>> In analog circuits, it can be done with a large
>>> number of RC's, look up SSB phasing method...

>> But in SSB, the bandwidth is much, much less than an octave.
>> It's not difficult to get that 90 degrees over such a narrow range
>> of frequencies.

> Well, you need a 90 deg phase shift at the carrier freq, which is
> easy, but you also need a 90 deg phase shift over the audio band
> which even if its just voice is still 300 to 3000 i.e. a decade.

Maybe I should pull out my RAH and double-check, but my memory is that this
was done at RF.

--> runs to home library...

The 2000 edition shows the phase shift being done at audio frequencies, not
RF, so I was apparently wrong. However...

The block diagram is terrible -- almost a "black box" -- and there are no
vector diagrams. I assume the audio phase shifting is done in the way I
previously described -- phi and phi+90, phi and phi-90.

This itself, though, raises questions. "Phased" SSB generation has been
around for at least 50 years, well before the introduction of cheap IC
op-amps. It's not clear how the all-pass networks would have been doable
with relatively simple tube circuits. I think I have an RAH dating back to
my salad days. I'll have to look it up...

Al, if you receive this, a response would be appreciated...

Scott Dorsey
December 21st 10, 01:59 PM
Mark > wrote:
>On Dec 20, 8:23=A0pm, "William Sommerwerck" >
>wrote:
>> > In analog circuits, it can be done with a large
>> > number of RC's, look up SSB phasing method...
>>
>> But in SSB, the bandwidth is much, much less than an octave. It's not
>> difficult to get that 90 degrees over such a narrow range of frequencies.
>
>well you need a 90 deg phase shift at the carrier freq which is easy
>but you also need a 90 deg phase shift over the audio band which even
>if its just voice is still 300 to 3000 i.e. a decade.

But, you can live with pretty wide errors over that range since all you
need to make out is some poor fellow screaming "QRZ" at the top of his lungs
and don't need perfectly flat response across the passband.
--scott
--
"C'est un Nagra. C'est suisse, et tres, tres precis."

Scott Dorsey
December 21st 10, 02:04 PM
William Sommerwerck > wrote:
>
>This itself, though, raises questions. "Phased" SSB generation has been
>around for at least 50 years, well before the introduction of cheap IC
>op-amps. It's not clear how the all-pass networks would have been doable
>with relatively simple tube circuits. I think I have an RAH dating back to
>my salad days. I'll have to look it up...

It's just RLC networks, nothing fancy. The Radio Amateur's Single Sideband
Manual actually has a bunch more stuff that isn't in the RAH. No, the phase
shift isn't linear, but nobody cares.
--scott

--
"C'est un Nagra. C'est suisse, et tres, tres precis."

Greg Berchin[_4_]
December 21st 10, 05:23 PM
On Mon, 20 Dec 2010 15:31:46 -0800 (PST), ChrisCoaster >
wrote:

>The original Dolby Surround encoding process required the surround
>channel be phase shifted +90degrees in one channel and -90 in the
>other.

Dolby plays some clever tricks with the phase shifter. According to the Dolby
document titled, "Dolby Digital Professional Encoding Guidelines":

The 90-degree phase-shift is created using a very long FIR filter. Since
this filter introduces a significant time delay, the other four channels
are delayed using a PCM delay line so that all six channels are kept in
sample alignment. This filter has exactly 90-degree phase shift at all
frequencies. The magnitude response is flat across most of the spectrum,
rolling off at the lower edge of the audio band (-3 dB below 30 Hz).

That low frequency rolloff is critical, because it allows Dolby to create a +90°
phase shift from a -90° phase shift simply by inverting the polarity. In the
strict mathematical sense, phase-shifting by +90° is NOT the same as
phase-shifting by -90° and then inverting, because the value at 0 Hz (DC)
doesn't work. But by implementing the phase-shifter as a highpass filter, Dolby
ensures that the DC response of the phase-shifter is zero, and they are thus
able to avoid the DC problem.

Greg

Greg Berchin[_4_]
December 21st 10, 05:45 PM
Forgot to mention: the relatively "high" cutoff frequency -- 30 Hz -- also
shortens the impulse response of the filter (and hence reduces the number of
taps in the FIR filter) considerably.

William Sommerwerck
December 21st 10, 07:32 PM
"Greg Berchin" > wrote in message
...
> On Mon, 20 Dec 2010 15:31:46 -0800 (PST), ChrisCoaster >
> wrote:

>> The original Dolby Surround encoding process required the surround
>> channel be phase shifted +90degrees in one channel and -90 in the
>> other.

> Dolby plays some clever tricks with the phase shifter. According to the
Dolby
> document titled, "Dolby Digital Professional Encoding Guidelines":

> The 90-degree phase-shift is created using a very long FIR filter. Since
> this filter introduces a significant time delay, the other four channels
> are delayed using a PCM delay line so that all six channels are kept in
> sample alignment. This filter has exactly 90-degree phase shift at all
> frequencies. The magnitude response is flat across most of the spectrum,
> rolling off at the lower edge of the audio band (-3 dB below 30 Hz).

> That low frequency rolloff is critical, because it allows Dolby to create
a +90°
> phase shift from a -90° phase shift simply by inverting the polarity. In
the
> strict mathematical sense, phase-shifting by +90° is NOT the same as
> phase-shifting by -90° and then inverting, because the value at 0 Hz (DC)
> doesn't work. But by implementing the phase-shifter as a highpass filter,
Dolby
> ensures that the DC response of the phase-shifter is zero, and they are
thus
> able to avoid the DC problem.

Maybe I'm dense this morning, but I don't see how you can get a true
90-degree phase shift out of a single filter. Delay is not phase shift.
Wouldn't delaying each frequency by a different time (as opposed to simply
changing its phase) really foul up the waveform?

No, I don't buy it. I suspect your explanation is correct -- out of context.
Something important is missing that's been left out.

Greg Berchin[_4_]
December 21st 10, 08:33 PM
On Tue, 21 Dec 2010 11:32:36 -0800, "William Sommerwerck"
> wrote:

>Maybe I'm dense this morning, but I don't see how you can get a true
>90-degree phase shift out of a single filter.

All you need is (an approximation of) a Hilbert Transform. It's just another
filter.

>Delay is not phase shift.

Delay at a single frequency *is* phase shift.

>Wouldn't delaying each frequency by a different time (as opposed to simply
>changing its phase) really foul up the waveform?

Yup. But it's surprisingly difficult to hear the difference.

>No, I don't buy it. I suspect your explanation is correct -- out of context.
>Something important is missing that's been left out.

Perhaps what's missing is the understanding that a filter *can* have an
approximately constant magnitude response, along with an approximately constant
phase shift, over a band of frequencies?

Greg

Scott Dorsey
December 21st 10, 09:28 PM
ChrisCoaster > wrote:
>
>I get it - Surround encoding is not simply sending an out-of-phase
>mono signal to surround channels. There's phase inverting going on to
>both the front(stereo + phantom center) info as well as to the rear
>encoding.
>
>Well that's something I won't be able to do - I dont' have dolby's
>proprietary encoding techniques to do that.

Sure you do, you can do it with any kind of thing that has allpass networks,
and I think that includes Audacity even.

There's nothing proprietary, it's the same as the QS and SQ matrix formats
for quadrophonic LPs back in the seventies, just with different ratios.

>Thanks for all your input - altough I don't know how shortwave radio
>got into the discussion(SSB, remember?).

Because generating SSB also requires the same phase-shift networks.
--scott
--
"C'est un Nagra. C'est suisse, et tres, tres precis."

William Sommerwerck
December 21st 10, 09:30 PM
>> Delay is not phase shift.

> Delay at a single frequency *is* phase shift.

No, it's not. Think about it. (Study your Laplace transforms.)


>> No, I don't buy it. I suspect your explanation is correct -- out
>> of context. Something important is missing that's been left out.

> Perhaps what's missing is the understanding that a filter *can*
> have an approximately constant magnitude response, along with
> an approximately constant phase shift, over a band of frequencies?

Reference, please. Thanks.

Scott Dorsey
December 21st 10, 09:49 PM
William Sommerwerck > wrote:
>
>> Perhaps what's missing is the understanding that a filter *can*
>> have an approximately constant magnitude response, along with
>> an approximately constant phase shift, over a band of frequencies?
>
>Reference, please. Thanks.

Don Lancaster's Active Filter Cookbook has a nice chapter on allpass
networks. It's ingenious as hell once you see it.
--scott
--
"C'est un Nagra. C'est suisse, et tres, tres precis."

William Sommerwerck
December 21st 10, 10:00 PM
>> Reference, please. Thanks.

> Don Lancaster's Active Filter Cookbook has a nice chapter
> on allpass networks. It's ingenious as hell once you see it.

I'll give it a look tomorrow (if I can find it!). I've known for decades
(yes, really) that all-pass networks can be used to synthesize all manner of
non-minimum-phase transfer functions. It never occurred to me that
constant-phase networks were possible.

I just realized... I probably don't have the "Active Filter Cookbook". I'll
have to do some searching...

Scott Dorsey
December 22nd 10, 12:21 AM
William Sommerwerck > wrote:
>>> Reference, please. Thanks.
>
>> Don Lancaster's Active Filter Cookbook has a nice chapter
>> on allpass networks. It's ingenious as hell once you see it.
>
>I'll give it a look tomorrow (if I can find it!). I've known for decades
>(yes, really) that all-pass networks can be used to synthesize all manner of
>non-minimum-phase transfer functions. It never occurred to me that
>constant-phase networks were possible.

You can't really make them precisely constant-phase but you can make them
pretty decent... certainly good enough for surround channels.

There might be some discussion in Jung's opamp cookbook too, but look
inside an SQ or QS decoder.... it's scary in there.

>I just realized... I probably don't have the "Active Filter Cookbook". I'll
>have to do some searching...

You should get it anyway, it's kind of dated but is a really handy reference
for all kinds of things.
--scott

--
"C'est un Nagra. C'est suisse, et tres, tres precis."

Greg Berchin[_4_]
December 22nd 10, 01:42 PM
On Tue, 21 Dec 2010 13:30:25 -0800, "William Sommerwerck"
> wrote:

>> Delay at a single frequency *is* phase shift.
>
>No, it's not. Think about it. (Study your Laplace transforms.)

Okay:

If the Laplace Transform of x(t) is X(f), then the Laplace Transform of x(t-T)
is exp(-sT)X(f).

If we take the value of the Laplace operator "s" to be "sigma + j*omega", and
limit ourselves to a single frequency "omega", then

exp(-sT) = exp(-j*omega*T)

The frequency "omega" is in units of radians/second. "T" is in seconds. So
"omega*T" is in radians. If we define "theta" to be equal to "omega*T", then
"exp(-j*theta)" is a pure phase shift.

Greg

William Sommerwerck
December 22nd 10, 02:41 PM
>>> Delay at a single frequency *is* phase shift.

>> No, it's not. Think about it. (Study your Laplace transforms.)

> Okay:

> If the Laplace Transform of x(t) is X(f), then the Laplace Transform
> of x(t-T) is exp(-sT)X(f).

> If we take the value of the Laplace operator "s" to be "sigma + j*omega",
> and limit ourselves to a single frequency "omega", then

> exp(-sT) = exp(-j*omega*T)

> The frequency "omega" is in units of radians/second. "T" is in seconds.
> So "omega*T" is in radians. If we define "theta" to be equal to "omega*T",
> then "exp(-j*theta)" is a pure phase shift.

If you look at the transfer function for (say) a simple low-pass filter,
you'll see that if you apply a sine wave multiplied by the step function,
what comes out is the sine wave instantaneously shifted in phase. There is
NO delay. Zero, zip, nada.

Delay and phase shift ARE NOT the same thing. The reason they sometimes
resemble each other is that the transform of the step function produces a
component that briefly forces the output to zero, so as not to violate the
laws of energy conservation and causality.

In fairness to everyone reading this... This is a point that I've never seen
properly elucidated. The "equivalence" of phase shift and delay -- when it's
plain that they aren't equivalent -- is universally accepted as a given,
when it's obvious that the output waveforms aren't the same. Has anyone come
across a book that /does/ address this (to me) dirty little secret? Which
isn't much of a secret...

Greg Berchin[_4_]
December 22nd 10, 03:20 PM
On Wed, 22 Dec 2010 06:41:26 -0800, "William Sommerwerck"
> wrote:

>If you look at the transfer function for (say) a simple low-pass filter,
>you'll see that if you apply a sine wave multiplied by the step function,
>what comes out is the sine wave instantaneously shifted in phase. There is
>NO delay. Zero, zip, nada.

A sine wave multiplied by a step function is NOT a single frequency.

>Delay and phase shift ARE NOT the same thing.

They are when one is considering a single frequency, which by its very nature
requires a waveform that is of constant amplitude and infinite extent in time,
both in the past and into the future.

>In fairness to everyone reading this... This is a point that I've never seen
>properly elucidated. The "equivalence" of phase shift and delay -- when it's
>plain that they aren't equivalent -- is universally accepted as a given,
>when it's obvious that the output waveforms aren't the same. Has anyone come
>across a book that /does/ address this (to me) dirty little secret? Which
>isn't much of a secret...

It's no secret and they ARE equivalent, as long as one does not misapply the
mathematics. If the amplitude or duration or frequency of the sine wave is
modified in any way, then the conclusions about what happens *at a single
frequency* no longer apply, because there is no longer just a single frequency.

Greg

Scott Dorsey
December 22nd 10, 03:53 PM
William Sommerwerck > wrote:
>
>In fairness to everyone reading this... This is a point that I've never seen
>properly elucidated. The "equivalence" of phase shift and delay -- when it's
>plain that they aren't equivalent -- is universally accepted as a given,
>when it's obvious that the output waveforms aren't the same. Has anyone come
>across a book that /does/ address this (to me) dirty little secret? Which
>isn't much of a secret...

"Universally accepted as a given?" I disagree that it ever has been
accepted in any way.

In the analogue world it's easy to get phase shift, very hard to get delay.
Sometimes people would fake delay by using phase shift since it was as close
as you could get easily, but it's definitely not the same thing and anyone
who claims it is has been misguided.
--scott
--
"C'est un Nagra. C'est suisse, et tres, tres precis."

William Sommerwerck
December 22nd 10, 04:40 PM
>> If you look at the transfer function for (say) a simple low-pass filter,
>> you'll see that if you apply a sine wave multiplied by the step function,
>> what comes out is the sine wave instantaneously shifted in phase.
>> There is NO delay. Zero, zip, nada.

> A sine wave multiplied by a step function is NOT a single frequency.

True. But you can't have delay without a step function (or some multiplier).
A temporally infinite signal cannot be "delayed"!


>> Delay and phase shift ARE NOT the same thing.

> They are when one is considering a single frequency, which by its
> very nature requires a waveform that is of constant amplitude and
> infinite extent in time, both in the past and into the future.

See above.


>> In fairness to everyone reading this... This is a point that I've never
seen
>> properly elucidated. The "equivalence" of phase shift and delay -- when
it's
>> plain that they aren't equivalent -- is universally accepted as a given,
>> when it's obvious that the output waveforms aren't the same. Has anyone
>> come across a book that /does/ address this (to me) dirty little secret?
>> Which isn't much of a secret...

> It's no secret and they ARE equivalent, as long as one does not misapply
the
> mathematics. If the amplitude or duration or frequency of the sine wave
is
> modified in any way, then the conclusions about what happens *at a single
> frequency* no longer apply, because there is no longer just a single
frequency.

I won't quarrel with your technical background, but you are dancing around
the issue, by trying to have it both ways at once.

My experience in arguing issues -- in which I am /almost/ always right, and
everyone else wrong -- has taught me I should stop at this point. Thank you,
sincerely, for taking the time to discuss it.

To (grossly) paraphrase Patton... God, I love philosophical discussions!

Greg Berchin[_4_]
December 22nd 10, 04:55 PM
On Wed, 22 Dec 2010 08:40:41 -0800, "William Sommerwerck"
> wrote:

>My experience in arguing issues -- in which I am /almost/ always right, and
>everyone else wrong -- has taught me I should stop at this point. Thank you,
>sincerely, for taking the time to discuss it.

And thank YOU, too, for exactly that. We are arguing about two different
definitions, and since neither of us is likely to give up his own definition, it
is best to cease.

Greg

Mark
December 22nd 10, 06:20 PM
On Dec 22, 11:55*am, Greg Berchin >
wrote:
> On Wed, 22 Dec 2010 08:40:41 -0800, "William Sommerwerck"
>
> > wrote:
> >My experience in arguing issues -- in which I am /almost/ always right, and
> >everyone else wrong -- has taught me I should stop at this point. Thank you,
> >sincerely, for taking the time to discuss it.
>
> And thank YOU, too, for exactly that. *We are arguing about two different
> definitions, and since neither of us is likely to give up his own definition, it
> is best to cease.
>
> Greg

I think the relationship between phase and delay is similar to the
relationship between velocity and acceleration which are related by
time deritivate dT. 1G = 32 ft/sec __per sec__.

Delay and Phase are related by a frequency derivative dF.
A delay of 1 second is equivalent to a phase shift of 360 deg __per
Hz__.
One second is 360 deg phase shift for 1 Hz, but it is 720 deg phase
shift for 2 Hz. You can equate them AT ONE frequency.

In fact I think the math defintion of group delay is dP/dF (change in
phase/change in freq)


Mark