Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

90degree phase shifts

130 views
Skip to first unread message

thekma...@gmail.com

unread,
Jul 27, 2012, 7:45:20 PM7/27/12
to
I'm guessing you all probably know why I need to create one of the above - to trick a Pro Logic Surround decoder.

Problem is, I know what a 90 - and 180 - deg phase shift looks like on a pure sinewave, but how to I achieve 90 degrees phase shift on "real world" material - a clip of ducks quacking or a 1890s locomotive roaring by? There is no simple wave - ducks, trains, and of course music - are anything but simple!

Luxey

unread,
Jul 27, 2012, 8:23:09 PM7/27/12
to
субота, 28. јул 2012. 01.45.20 UTC+2, thekma...@gmail.com је написао/ла:
> I'm guessing you all probably know why I need to create one of the above - to trick a Pro Logic Surround decoder.
>
>
>
> Problem is, I know what a 90 - and 180 - deg phase shift looks like on a pure sinewave, but how to I achieve 90 degrees phase shift on "real world" material - a clip of ducks quacking or a 1890s locomotive roaring by? There is no simple wave - ducks, trains, and of course music - are anything but simple!

Pass it through capacitor. Not exactly 90deg, and different at freqs, but ..., or just delay it a ms, or so. Phase shift is meaningless on one isolated signal. You have to have at least two to experience the effect. In digital plug ins, you can try passing it through some old EQ, or something.

Scott Dorsey

unread,
Jul 27, 2012, 8:44:12 PM7/27/12
to
<thekma...@gmail.com> wrote:
>I'm guessing you all probably know why I need to create one of the above - =
>to trick a Pro Logic Surround decoder.

Why not use a pro logic encoder, then?

>Problem is, I know what a 90 - and 180 - deg phase shift looks like on a pu=
>re sinewave, but how to I achieve 90 degrees phase shift on "real world" ma=
>terial - a clip of ducks quacking or a 1890s locomotive roaring by? There =
>is no simple wave - ducks, trains, and of course music - are anything but s=
>imple!

All-pass networks are discussed extensively in the Audio Cyclopedia.
--scott

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

David Gravereaux

unread,
Jul 27, 2012, 8:56:30 PM7/27/12
to
On 07/27/2012 05:44 PM, Scott Dorsey wrote:

> All-pass networks are discussed extensively in the Audio Cyclopedia.
> --scott
>

You'll need a bunch like a graphic EQ has bands for a range where each
all-pass is effective.

--


signature.asc

thekma...@gmail.com

unread,
Jul 27, 2012, 9:23:35 PM7/27/12
to
You'll need a bunch like a graphic EQ


Phase is purely time-related. You can create a phasey effect by combing the eq channels but it's not the desired result.

None

unread,
Jul 27, 2012, 10:00:53 PM7/27/12
to
"David Gravereaux" <davy...@pobox.com> wrote nothing in message
news:qrCdna-8vbojpY7N...@giganews.com...
>

Do you think you could post using one of our Earth newsreaders?




Les Cargill

unread,
Jul 27, 2012, 11:06:12 PM7/27/12
to
I have no idea how you do it in analog or in real time. But a
Hilbert Transform will provide a very good 90 degree phase
shift.

I think that there are real time and analog versions of them;
I only know how to do to in the not-real time way.

As to the surround decoder - turn that off and do it
stereo. People still know how to do that.

--
Les Cargill

David Gravereaux

unread,
Jul 27, 2012, 11:09:47 PM7/27/12
to
On 07/27/2012 06:23 PM, thekma...@gmail.com wrote:
> You'll need a bunch like a graphic EQ
>
>
> Phase is purely time-related.

If by time, you mean (1 / freq * 4), then yes.

90 phase shift at 20kHz is 12.5uS whereas a 90 shift at 20Hz is 12.5mS.
Now image that doing full bandwidth. Time is not constant, the phase
shift is. Each band will have the slope of its all-pass match for 90
over its coverage. How well you can keep the slope (shift) constant
over a range will determine how many bands you'll need.

--


signature.asc

David Gravereaux

unread,
Jul 27, 2012, 11:15:47 PM7/27/12
to
signature.asc

David Gravereaux

unread,
Jul 27, 2012, 11:24:17 PM7/27/12
to
On 07/27/2012 06:23 PM, thekma...@gmail.com wrote:
> You'll need a bunch like a graphic EQ
>
>
> Phase is purely time-related. You can create a phasey effect by combing the eq channels but it's not the desired result.
>


See section 16.7 @ http://www.ti.com/lit/ml/sloa088/sloa088.pdf

--


signature.asc

hank alrich

unread,
Jul 27, 2012, 11:26:03 PM7/27/12
to
He cannot. And hence, via my own newsreader he might as well be miming.

I gave up on his attitude about this a long time ago.

--
shut up and play your guitar * http://hankalrich.com/
http://www.youtube.com/walkinaymusic
http://www.sonicbids.com/HankandShaidri

hank alrich

unread,
Jul 27, 2012, 11:26:05 PM7/27/12
to
I'm wondering why one would want to trick a Dolby PLS decoder.

Scott Dorsey

unread,
Jul 27, 2012, 11:38:55 PM7/27/12
to
Les Cargill <lcarg...@comcast.com> wrote:
>
>I have no idea how you do it in analog or in real time. But a
>Hilbert Transform will provide a very good 90 degree phase
>shift.

It will. Unfortunately when you run it through a Dolby CP-50 which uses
an all-pass filter (which is NOT a very good 90 degree phase shift), it
doesn't sound so good. You need to use filters on the encoding side
which are more or less the opposite of the ones on the decoding side.

>I think that there are real time and analog versions of them;
>I only know how to do to in the not-real time way.
>
>As to the surround decoder - turn that off and do it
>stereo. People still know how to do that.

Go to film-tech.com. Download the Dolby CP-50 manual. Look at the
phase shift networks on the Cat 146/150 card. Build the same networks
in reverse for encoding.

None

unread,
Jul 28, 2012, 12:01:58 AM7/28/12
to
"David Gravereaux" <davy...@pobox.com> didn't write in message
news:24adndRWWIb5xI7N...@giganews.com...

That's not a newsreader. It's an abomination.

Les Cargill

unread,
Jul 28, 2012, 12:12:01 AM7/28/12
to
hank alrich wrote:
> Les Cargill <lcarg...@comcast.com> wrote:
>
>> thekma...@gmail.com wrote:
>>> I'm guessing you all probably know why I need to create one of the
>>> above - to trick a Pro Logic Surround decoder.
>>>
>>> Problem is, I know what a 90 - and 180 - deg phase shift looks like
>>> on a pure sinewave, but how to I achieve 90 degrees phase shift on
>>> "real world" material - a clip of ducks quacking or a 1890s
>>> locomotive roaring by? There is no simple wave - ducks, trains, and
>>> of course music - are anything but simple!
>>>
>>
>>
>>
>> I have no idea how you do it in analog or in real time. But a
>> Hilbert Transform will provide a very good 90 degree phase
>> shift.
>>
>> I think that there are real time and analog versions of them;
>> I only know how to do to in the not-real time way.
>>
>> As to the surround decoder - turn that off and do it
>> stereo. People still know how to do that.
>
> I'm wondering why one would want to trick a Dolby PLS decoder.
>

I tried real hard not to think about that.

--
Les Cargill

hank alrich

unread,
Jul 28, 2012, 12:11:39 AM7/28/12
to
Sorry I mentioned it.

hank alrich

unread,
Jul 28, 2012, 12:11:40 AM7/28/12
to
Sounds tricky.

Les Cargill

unread,
Jul 28, 2012, 12:17:59 AM7/28/12
to
hank alrich wrote:
> Les Cargill <lcarg...@comcast.com> wrote:
>
>> hank alrich wrote:
>>> Les Cargill <lcarg...@comcast.com> wrote:
>>>
>>>> thekma...@gmail.com wrote:
>>>>> I'm guessing you all probably know why I need to create one of the
>>>>> above - to trick a Pro Logic Surround decoder.
>>>>>
>>>>> Problem is, I know what a 90 - and 180 - deg phase shift looks like
>>>>> on a pure sinewave, but how to I achieve 90 degrees phase shift on
>>>>> "real world" material - a clip of ducks quacking or a 1890s
>>>>> locomotive roaring by? There is no simple wave - ducks, trains, and
>>>>> of course music - are anything but simple!
>>>>>
>>>>
>>>>
>>>>
>>>> I have no idea how you do it in analog or in real time. But a
>>>> Hilbert Transform will provide a very good 90 degree phase
>>>> shift.
>>>>
>>>> I think that there are real time and analog versions of them;
>>>> I only know how to do to in the not-real time way.
>>>>
>>>> As to the surround decoder - turn that off and do it
>>>> stereo. People still know how to do that.
>>>
>>> I'm wondering why one would want to trick a Dolby PLS decoder.
>>>
>>
>> I tried real hard not to think about that.
>
> Sorry I mentioned it.
>

Mentioned what?

:)

--
Les Cargill

thekma...@gmail.com

unread,
Jul 28, 2012, 12:13:51 AM7/28/12
to
Hank
"- show quoted text -
I'm wondering why one would want to trick a Dolby PLS decoder.
- show quoted text -
"

Because it's THERE.

THAT's why.

Les Cargill

unread,
Jul 28, 2012, 12:19:52 AM7/28/12
to
hank alrich wrote:
> Scott Dorsey <klu...@panix.com> wrote:
>
>> Les Cargill <lcarg...@comcast.com> wrote:
>>>
>>> I have no idea how you do it in analog or in real time. But a
>>> Hilbert Transform will provide a very good 90 degree phase
>>> shift.
>>
>> It will. Unfortunately when you run it through a Dolby CP-50 which uses
>> an all-pass filter (which is NOT a very good 90 degree phase shift), it
>> doesn't sound so good. You need to use filters on the encoding side
>> which are more or less the opposite of the ones on the decoding side.
>>
>>> I think that there are real time and analog versions of them;
>>> I only know how to do to in the not-real time way.
>>>
>>> As to the surround decoder - turn that off and do it
>>> stereo. People still know how to do that.
>>
>> Go to film-tech.com. Download the Dolby CP-50 manual. Look at the
>> phase shift networks on the Cat 146/150 card. Build the same networks
>> in reverse for encoding.
>
> Sounds tricky.
>

Y'know, if I'd practiced more, maybe I would have had to know all this.


That's what I keep telling myself anyway.

--
Les Cargill

thekma...@gmail.com

unread,
Jul 28, 2012, 12:18:16 AM7/28/12
to
Les Cargill  <lcarg...@comcast.com> wrote:
>
>I have no idea how you do it in analog or in real time. But a
>Hilbert Transform will provide a very good 90 degree phase
>shift.

It will.  Unfortunately when you run it through a Dolby CP-50 which uses
an all-pass filter (which is NOT a very good 90 degree phase shift), it
do

Go to film-tech.com.  Download the Dolby CP-50 manual.  Look at the
phase shift networks on the Cat 146/150 card.   Build the same networks
in reverse for encoding.
- show quoted text -

Sorry Scott - Resource not found! Actually the filters are just below 100Hz and above 7kHz. I can do that in Audacity.

David Gravereaux

unread,
Jul 28, 2012, 12:24:00 AM7/28/12
to
On 07/27/2012 06:23 PM, thekma...@gmail.com wrote:
> You'll need a bunch like a graphic EQ
>
>
> Phase is purely time-related. You can create a phasey effect by combing the eq channels but it's not the desired result.
>


Here's a rough assemblage in SPICE. Grab LTSpice from
http://www.linear.com/designtools/software/ to view it.

Obviously the summing overlaps improperly, but this is a rough idea
based on octave bands.

maintains a 90 shift between 300-6k or so.

--

Draft3.asc
signature.asc

William Sommerwerck

unread,
Jul 28, 2012, 1:00:43 AM7/28/12
to
You need two all-pass filters. One produces a phase shift of phi. The other
producers phi+90 or phi-90.

It is impossible to produce a fixed 90 degree phase shift over a wide
frequency range and have flat response at the same time. You have to create
the 90-degree shift as the difference between two filters' phase responses.

Trust me.


hank alrich

unread,
Jul 28, 2012, 2:53:25 AM7/28/12
to
It's a fine line between clever and stupid. I think you've crossed it.

thekma...@gmail.com

unread,
Jul 28, 2012, 7:57:26 AM7/28/12
to
hank alrich:
"It's a fine line between clever and stupid. I think you've crossed it. "
- show quoted text -

Keep your closed-minded remarks to yourself! At least others here have suggested ways to accomplish it or emulate it.

Scott Dorsey

unread,
Jul 28, 2012, 9:01:33 AM7/28/12
to
In the late eighties this sort of thing was all the rage. Everybody wanted to
make their own matrix surround tracks and nobody wanted to pay Dolby the
licensing fee for the encoder. There were lots of aftermarket fake Dolby
encoders sold, and a lot of homebrews. But now we have 5.1 and nobody much
bothers with any of that junk except as an afterthought for the occasional
film optical track.

So, it's sort of like the Phil Collins Drum Sound in that regard...

Scott Dorsey

unread,
Jul 28, 2012, 9:02:54 AM7/28/12
to
Yes. This is also discussed in Tremaine's Audio Cyclopedia which is the
first reference I recommended in this thread.

Scott Dorsey

unread,
Jul 28, 2012, 9:08:35 AM7/28/12
to
<thekma...@gmail.com> wrote:
>
>Go to film-tech.com. =A0Download the Dolby CP-50 manual. =A0Look at the=20
>phase shift networks on the Cat 146/150 card. =A0 Build the same networks=
>=20
>in reverse for encoding.=20
>- show quoted text -
>
>Sorry Scott - Resource not found! Actually the filters are just below 100H=
>z and above 7kHz. I can do that in Audacity.

Okay, class! Everybody pick up your keyboard and go to this url!
Yes, you have to start the browser and type it in on the top line.
Type <http://www.film-tech.com> all the way. Yes, you have to type
it all out. Now, wait for the page to load and click on WAREHOUSE
up at the top. Do you see WAREHOUSE? Now, click on MANUALS... does
everybody see MANUALS? That's where the manuals are stored...

thekma...@gmail.com

unread,
Jul 28, 2012, 9:29:20 AM7/28/12
to
SD:
So, it's sort of like the Phil Collins Drum Sound in that regard...
--scott


--
"C'est un Nagra. C'est suisse, et tres, tres precis."
___
And what issues do you have with Phil's drumming?

Mike Rivers

unread,
Jul 28, 2012, 9:42:42 AM7/28/12
to
Perhaps you need a real Earth newsreader. But he did put an
attachment in the posting which I didn't expect would come
through in rec.audio.pro.

What he said, less the attachment, was:

> Here's a rough assemblage in SPICE. Grab LTSpice from
> http://www.linear.com/designtools/software/ to view it.
>
> Obviously the summing overlaps improperly, but this is a rough idea
> based on octave bands.
>
> maintains a 90 shift between 300-6k or so.


Or maybe you can find a surround encoder to pass your
recording through.



--
"Today's production equipment is IT based and cannot be
operated without a passing knowledge of computing, although
it seems that it can be operated without a passing knowledge
of audio." - John Watkinson

http://mikeriversaudio.wordpress.com - useful and
interesting audio stuff

None

unread,
Jul 28, 2012, 2:15:58 PM7/28/12
to
"Mike Rivers" <mri...@d-and-d.com> wrote in message
news:jv0q8k$kef$1...@dont-email.me...
> On 7/27/2012 10:00 PM, None wrote:
>> "David Gravereaux" <davy...@pobox.com> wrote nothing in
>> message news:qrCdna-8vbojpY7N...@giganews.com...
>
>> Do you think you could post using one of our Earth newsreaders?
> Perhaps you need a real Earth newsreader.

whooooosh!

Sean Conolly

unread,
Jul 28, 2012, 3:04:48 PM7/28/12
to
<thekma...@gmail.com> wrote in message
news:c38527ca-aebd-465f...@googlegroups.com...
Q. Why would anyone want to reinvent the wheel?

A. Because it's fun, and you can learn something from it.

Sticking with the example, think for a minute about how you would go about
making a wheel if you were in the woods with nothing but an axe.

Sean


Les Cargill

unread,
Jul 28, 2012, 3:57:27 PM7/28/12
to
So I just did an experiment which produced a fixed 90 degree phase
shift over the audio range.

I have some 'C' source which produces a Hilbert transform of an
audio file ( using libsndfile and FFTW plus some code of my own,
er code I pretty much swiped off the Internet :).

When I run this twice*, I get perfect** cancellation

*Assume files A,B and C. B = Hilbert(A), C = Hilbert(B).

** to the limit of my ability to measure it. I can provide details on
request.

What am I missing?

--
Les Cargill




Marc Wielage

unread,
Jul 28, 2012, 6:42:39 PM7/28/12
to
On Sat, 28 Jul 2012 06:01:33 -0700, Scott Dorsey wrote
(in article <jv0nrd$rbd$1...@panix2.panix.com>):

> In the late eighties this sort of thing was all the rage. Everybody wanted
to
> make their own matrix surround tracks and nobody wanted to pay Dolby the
> licensing fee for the encoder. There were lots of aftermarket fake Dolby
> encoders sold, and a lot of homebrews. But now we have 5.1 and nobody much
> bothers with any of that junk except as an afterthought for the occasional
> film optical track.
>------------------------------<snip>------------------------------<

Yes, this brings back memories of the 1980s with Ultra-Stereo, which I
believe was Jack Cashin's attempt to get around Dolby's patents and creating
a compatible (and much cheaper) matrixed surround system with a similar
noise-reduction encoding. I believe engineer John Mosely was also a
consultant for the company; Mosely had previously worked on Quintaphonic
sound in the mid-1970s. Interestingly, Dolby could not patent the surround
encoding itself, but did patent the noise reduction encoding (either Type A
or Type B, depending on the release format), which Ultra Stereo had to mimic
for their release prints. I used Ultra Stereo a few times in mastering, and
it actually worked OK.

To the o.p.: lots of books have the information necessary in order to
simulate a matrix surround mix. Dolby's own white paper is here:

http://www.dolby.com/uploadedFiles/zz-
_Shared_Assets/English_PDFs/Professional/214_Mixing%20with%20Dolby%20Pro%20Log
ic%20II%20Technology.pdf

Tom Holman's book SURROUND SOUND: UP AND RUNNING also covers this in detail:

http://www.amazon.com/Surround-Sound-Second-Up-
running/dp/0240808290/ref=sr_1_2?s=books&ie=UTF8&qid=1343514433&sr=1-2

But in general, I agree with Scott -- I don't think matrix surround has any
point today, in the face of so many ways of discrete surround mixing and
digital release formats. Many DVD and Blu-ray releases are "upmixed" or
"unwrapped" in advance to take old 2-channel mixes and convert them to 5.1.
Done skillfully and with care, these can actually sound much better than any
of the old Dolby Matrix releases.

http://www.sersc.org/journals/IJSIP/vol2_no4/7.pdf

--MFW

Luxey

unread,
Jul 28, 2012, 6:54:57 PM7/28/12
to
If you run make 4. one D=hilbert(C) does it, D, cancell out with B?

Les Cargill

unread,
Jul 28, 2012, 7:17:46 PM7/28/12
to
Yes, as you would suspect.

--
Les Cargill

Luxey

unread,
Jul 28, 2012, 8:00:44 PM7/28/12
to
I think it should not be so. B should be 90deg shift, while D should be 270deg shift. They should not cancel out, if complex signal.
If sine wave, it shoud cancel except for the first 1/4 of the first cycle and the last 1/4 of the last cycle. That's what I think. Very often I'm wrong.

Luxey

unread,
Jul 28, 2012, 8:04:49 PM7/28/12
to
To clarify my thinking, seams if you apply function twice it does nos shift signal in phase for 180deg, but rather reverses it.

Les Cargill

unread,
Jul 28, 2012, 11:06:39 PM7/28/12
to
Luxey wrote:
> To clarify my thinking, seams if you apply function twice it does nos shift signal in phase for 180deg, but rather reverses it.
>

When the Hilbert transform is applied twice in succession to a function
u, the result is negative u:

H(H(u))(t) = -u(t),

provided the integrals defining both iterations converge in a suitable
sense. In particular, the inverse transform is −H.

http://en.wikipedia.org/wiki/Hilbert_transform

--
Les Cargill

Scott Dorsey

unread,
Jul 28, 2012, 11:20:07 PM7/28/12
to
Les Cargill <lcarg...@comcast.com> wrote:
>William Sommerwerck wrote:
>> You need two all-pass filters. One produces a phase shift of phi. The other
>> producers phi+90 or phi-90.
>>
>> It is impossible to produce a fixed 90 degree phase shift over a wide
>> frequency range and have flat response at the same time. You have to create
>> the 90-degree shift as the difference between two filters' phase responses.
>>
>> Trust me.
>>
>I have some 'C' source which produces a Hilbert transform of an
>audio file ( using libsndfile and FFTW plus some code of my own,
>er code I pretty much swiped off the Internet :).
>
>When I run this twice*, I get perfect** cancellation
>
>What am I missing?

You can't do a Hilbert transform directly in the analogue domain. You can
only use some functions that approximate it, made with Ls and Cs.

Scott Dorsey

unread,
Jul 28, 2012, 11:23:44 PM7/28/12
to
Marc Wielage <m...@musictrax.com> wrote:
>
>Yes, this brings back memories of the 1980s with Ultra-Stereo, which I
>believe was Jack Cashin's attempt to get around Dolby's patents and creating
>a compatible (and much cheaper) matrixed surround system with a similar
>noise-reduction encoding. I believe engineer John Mosely was also a
>consultant for the company; Mosely had previously worked on Quintaphonic
>sound in the mid-1970s. Interestingly, Dolby could not patent the surround
>encoding itself, but did patent the noise reduction encoding (either Type A
>or Type B, depending on the release format), which Ultra Stereo had to mimic
>for their release prints. I used Ultra Stereo a few times in mastering, and
>it actually worked OK.

Right. The Ultra Stereo decoders did the matrix properly (and Dolby could
not patent it because there was an outrageous amount of prior art going back
to Blumlein by way of Sanyo) but they just used a low-pass filter instead
of the Dolby NR decoder. I never used any of their encoders but I bet they
did something similar with a little emphasis. Kintek did just that.

hank alrich

unread,
Jul 29, 2012, 1:16:27 AM7/29/12
to
Better yet, invent an axe.

hank alrich

unread,
Jul 29, 2012, 1:16:28 AM7/29/12
to
Gotcha. So I should put an Auratone in a clean, empty garbage can, along
with a array of Radioshack omnis and go for it.

hank alrich

unread,
Jul 29, 2012, 1:16:30 AM7/29/12
to
I'm sorry. I was looking for "WHEELS", to see if there was prior art.

Luxey

unread,
Jul 29, 2012, 6:04:37 AM7/29/12
to
Oh, well. Ok. So, after Fourier decomposing to sine waves, it shifts each sine separately and exactly? Cool.

William Sommerwerck

unread,
Jul 29, 2012, 6:44:22 AM7/29/12
to
> I don't think matrix surround has any point today,
> in the face of so many ways of discrete surround
> mixing and digital release formats.

To the best of my knowledge, there is no discrete format for DVDs -- or CDs,
for that matter. As long as DVDs are sold, there will be a need for
matrixing.

Surround encoding can be useful for stereo recordings that aren't intended
for surround playback. For example, Ambisonic UHJ encoding produces a stereo
mix that, when blended to mono, has only about +/- 1dB variation in level
for any mix component. This is a big improvement over a conventional mix,
where components panned dead-center are bumped up 6dB in mono playback.


Mike Rivers

unread,
Jul 29, 2012, 7:58:22 AM7/29/12
to
On 7/28/2012 11:20 PM, Scott Dorsey wrote:

> You can't do a Hilbert transform directly in the analogue domain. You can
> only use some functions that approximate it, made with Ls and Cs.

Yeah, that's the problem with theory. It's different from
practice.

Les Cargill

unread,
Jul 29, 2012, 11:15:21 AM7/29/12
to
Mike Rivers wrote:
> On 7/28/2012 11:20 PM, Scott Dorsey wrote:
>
>> You can't do a Hilbert transform directly in the analogue domain. You
>> can
>> only use some functions that approximate it, made with Ls and Cs.
>
> Yeah, that's the problem with theory. It's different from practice.
>


It's not theoretical if it doesn't have to be in real time with an
analog source.

--
Les Cargill

Scott Dorsey

unread,
Jul 29, 2012, 3:20:10 PM7/29/12
to
William Sommerwerck <grizzle...@comcast.net> wrote:
>> I don't think matrix surround has any point today,
>> in the face of so many ways of discrete surround
>> mixing and digital release formats.
>
>To the best of my knowledge, there is no discrete format for DVDs -- or CDs,
>for that matter. As long as DVDs are sold, there will be a need for
>matrixing.

What about dts and Dolby Digital?

robert...@analog.com

unread,
Jul 29, 2012, 7:18:48 PM7/29/12
to
There's a lot of bad information in this thread, sorry to say.

Let's break it down:

Analog phase shifts

2 parallel banks of all analog pass filters can produce 90 degree phase shifts over wide frequency ranges down to fractions of a degree. There are optimization routines you can use to set the pole/zero frequencies. You can't go all the way to DC obviously, and if you try you will end up with very high order filters, but 20 hz is an achievable goal. The lower you go in frequency the more filter sections you will need and these filters may have a very long impulse response which may become audible. You can use either 1st or 2nd order filters, and an analog all pass can be done with 1 op-amp per 2nd order section. No L's or C's required, just a few R's and C's and opamps. If you plot the phase shift from the input to each of the two outputs you will see that the difference is very close to 90 degrees, but the individual phase responses will accumulate to quite a large phase shift at higher frequencies. You can make valid arguments that this may be audible, I think, even though the amplitude response is dead flat by construction.

Digital phase shifts

There are 2 ways to do this digitally

1) fir halbert transform filters. These filters are anti symmetric and therefore have perfect 90 degree phase characteristics, with an amplitude ripple determined by how the filter is designed. In order to make these "causal" you need to shift them by half the filter length and use a delay in the other path. In other words, you end up with 2 branches, an fir filter in 1 path and a delay in the other. The drawback of this approach is that if you want to maintain 90 degree phase shift all the way down to 20 hz the filter length will be huge and therefore require a lot of MIPS. Note that by definition an anti symmetric filter has 0 response at dc.


2) parallel all pass sections just like the analog case above. In the analog case we had a limitation that you can't get 90 degree phase shift at dc, and for the digital version there is another restriction that you can't get 90 degree phase shift at half the sample rate, and the closer to get to DC or fs/2 the more filter sections you will need, resulting in long impulse responses that may become audible.


In general there are no out-of-the-box algorithms that design these filters, so you will need to master an optimization algorithm, or use the ones built in to the matlab control systems toolbox, assuming you have the luxury of owning said tool (Scilab may have an equivalent, I don't know for sure)

Bob Adams

Les Cargill

unread,
Jul 29, 2012, 8:50:31 PM7/29/12
to
Octave is a free alternative to Matlab that runs most Matlab scripts.
http://www.gnu.org/software/octave/

> Bob Adams
>

--
Les Cargill

Scott Dorsey

unread,
Jul 29, 2012, 9:10:49 PM7/29/12
to
<robert...@analog.com> wrote:
>
>In general there are no out-of-the-box algorithms that design these filters=
>, so you will need to master an optimization algorithm, or use the ones bui=
>lt in to the matlab control systems toolbox, assuming you have the luxury o=
>f owning said tool (Scilab may have an equivalent, I don't know for sure)

The optimization algorithm is just successive approximation. Sit down with
a desk calculator and plug and chug. Matlab will do it nicely, but it will
take you more time to figure out their functions than to just do it by hand.

Scott Dorsey

unread,
Jul 29, 2012, 9:13:26 PM7/29/12
to
Les Cargill <lcarg...@comcast.com> wrote:
>
>Octave is a free alternative to Matlab that runs most Matlab scripts.
>http://www.gnu.org/software/octave/

It works very, very well, and it's basically like Matlab 5 was fifteen
years ago (except the graphics aren't so good). However, a lot of what
makes Matlab what it is today are the toolkits and a lot of the toolkit
functions haven't get been duplicated.

Not that you couldn't code a binary search algorithm in an afternoon but
it seems like a lot of work for a single filter design.

Les Cargill

unread,
Jul 30, 2012, 7:39:29 AM7/30/12
to
Scott Dorsey wrote:
> Les Cargill <lcarg...@comcast.com> wrote:
>>
>> Octave is a free alternative to Matlab that runs most Matlab scripts.
>> http://www.gnu.org/software/octave/
>
> It works very, very well, and it's basically like Matlab 5 was fifteen
> years ago (except the graphics aren't so good). However, a lot of what
> makes Matlab what it is today are the toolkits and a lot of the toolkit
> functions haven't get been duplicated.
>

Right. So the paid version is probably worth it.

> Not that you couldn't code a binary search algorithm in an afternoon but
> it seems like a lot of work for a single filter design.
> --scott
>

Dunno - the version I have seems to support a lot of filter designs. I
suppose it depends on which ones you're looking for.

--
Les Cargill

Arny Krueger

unread,
Jul 30, 2012, 9:08:23 AM7/30/12
to

<thekma...@gmail.com> wrote in message
news:1dc52d9f-f9d3-4a41...@googlegroups.com...
I'm guessing you all probably know why I need to create one of the above -
to trick a Pro Logic Surround decoder.

Problem is, I know what a 90 - and 180 - deg phase shift looks like on a
pure sinewave, but how to I achieve 90 degrees phase shift on "real world"
material - a clip of ducks quacking or a 1890s locomotive roaring by? There
is no simple wave - ducks, trains, and of course music - are anything but
simple!

This looks like a heck of a good reference about building all-pass netowrks:

http://webpages.charter.net/wa1sov/technical/allpass/allpass.html


Randy Yates

unread,
Jul 30, 2012, 11:01:20 AM7/30/12
to
"Arny Krueger" <ar...@comcast.net> writes:

> <thekma...@gmail.com> wrote in message
> news:1dc52d9f-f9d3-4a41...@googlegroups.com...
> I'm guessing you all probably know why I need to create one of the above -
> to trick a Pro Logic Surround decoder.
>
> Problem is, I know what a 90 - and 180 - deg phase shift looks like on a
> pure sinewave, but how to I achieve 90 degrees phase shift on "real world"
> material - a clip of ducks quacking or a 1890s locomotive roaring by? There
> is no simple wave - ducks, trains, and of course music - are anything but
> simple!

Arny,

As you know, shifting one specific sine wave by 90 degrees can be done
by simply delaying by the appropriate amount, depending the frequency.
The trick is to shift the entire frequency band, or a wide band of
frequencies, by 90 degrees! Of course this is not a simple delay.

Turns out, it is a thing called a "Hilbert transform." One can never
build a perfect one (the closer you get to DC, the longer your filter's
impulse response becomes) , and designing a good digital Hilbert
transformer is not a trivial task.
--
Randy Yates
Digital Signal Labs
http://www.digitalsignallabs.com

Randy Yates

unread,
Jul 30, 2012, 11:05:55 AM7/30/12
to
Sorry, I didn't see Bob Adams' post before I blurted this out - he
already covered it.

Les Cargill

unread,
Jul 30, 2012, 1:28:20 PM7/30/12
to
For stored wave files ( relevant to this being r.a.p ) it's not
trivial, but the meat of it is about 20 lines of 'C', once
you get things into an FFT and can do an RFFT.

--
Les Cargill

Kevin Alfred Strom

unread,
Jul 30, 2012, 4:07:41 PM7/30/12
to
On 7/27/2012 11:06 PM, Les Cargill wrote:
> thekma...@gmail.com wrote:
>> I'm guessing you all probably know why I need to create one of the
>> above - to trick a Pro Logic Surround decoder.
>>
>> Problem is, I know what a 90 - and 180 - deg phase shift looks like
>> on a pure sinewave, but how to I achieve 90 degrees phase shift on
>> "real world" material - a clip of ducks quacking or a 1890s
>> locomotive roaring by? There is no simple wave - ducks, trains, and
>> of course music - are anything but simple!
>>
>
>
>
> I have no idea how you do it in analog or in real time. But a
> Hilbert Transform will provide a very good 90 degree phase
> shift.
>
> I think that there are real time and analog versions of them;
> I only know how to do to in the not-real time way.
>
> As to the surround decoder - turn that off and do it
> stereo. People still know how to do that.
>
> --
> Les Cargill





Here are some analogue networks that will do a 90 degree shift over
a wide spectrum:

http://webpages.charter.net/wa1sov/technical/allpass/allpass.html


With all good wishes,


Kevin.
--
http://nationalvanguard.org/
http://kevinalfredstrom.com/

robert...@analog.com

unread,
Jul 30, 2012, 5:38:09 PM7/30/12
to
Nice reference, wish I had found that a long time ago!

On a side note, these long chains of allpass filters are often used for fake mono-to-stereo circuits. If you form the left output from (mono in + allpass out) and form the right output from (mono in - allpass out) then you get alternating peaks and dips in the left and right responses. The founder of dbx (Dave Blackmer) was mildly obsessed with these circuits at one point in his career and claimed that you needed a 12th-order allpass for optimal results!

Bob

Randy Yates

unread,
Jul 30, 2012, 6:12:52 PM7/30/12
to
Bob, was Dave Blackmer the one that went on to start THAT audio?
I implemented a BTSC decoder which, as you probably know, was based
on a spectral compander they designed.

Randy Yates

unread,
Jul 30, 2012, 6:20:56 PM7/30/12
to
Les,

Think of all the possible combinations you can create from 20 lines of C
code! It's like that old joke about knowing where to kick the
<place-device-under-repair-here>.

From what I have heard, there are problems with doing an order-8M-sample
FFT (i.e., an entire sound file at a time), e.g., twiddle factor
quantization (even in floating point). And doing it block-wise requires
the impulse response, so we're back to the filter design problem.

Most of the time I have heard it implemented in the time domain as
an FIR.

Les Cargill

unread,
Jul 30, 2012, 7:32:33 PM7/30/12
to
:)

>
> From what I have heard, there are problems with doing an order-8M-sample
> FFT (i.e., an entire sound file at a time), e.g., twiddle factor
> quantization (even in floating point).

I have not seen that with FFTW + libsndfile on 16 bit files. I don't
remember testing it on 24 bit files. But simply doing an fft and then an
rfft gets the original back - as in "fc /b file1 file2" produces no
result.

> And doing it block-wise requires
> the impulse response, so we're back to the filter design problem.
>
> Most of the time I have heard it implemented in the time domain as
> an FIR.

it actually works quite well - only tested on 16 bit for now. 24 bit is
a bit inconvenient for reasons I won't bore you with, but I really
should try it...

<https://bitbucket.org/cleemesser/stockwelltransform/src/e9adf4f71e13/stockwell/st.c>

Starts at line 119. Okay, *ten* lines then.

> --
> Randy Yates
> Digital Signal Labs
> http://www.digitalsignallabs.com
>

--
Les Cargill

Randy Yates

unread,
Jul 30, 2012, 10:04:24 PM7/30/12
to
Les Cargill <lcarg...@comcast.com> writes:
> [...]
1. This is a Stockwell transform, not a Hilbert transform.

2. It's way more than 10 lines of code.

3. Line 119 is a comment.

(Apparently the Stockwell transform is a form of short-term Fourier
Transform.)

Les Cargill

unread,
Jul 30, 2012, 10:36:32 PM7/30/12
to
Randy Yates wrote:
> Les Cargill <lcarg...@comcast.com> writes:
>> [...]
>> <https://bitbucket.org/cleemesser/stockwelltransform/src/e9adf4f71e13/stockwell/st.c>
>>
>> Starts at line 119. Okay, *ten* lines then.
>
> 1. This is a Stockwell transform, not a Hilbert transform.
>
> 2. It's way more than 10 lines of code.
>
> 3. Line 119 is a comment.
>
> (Apparently the Stockwell transform is a form of short-term Fourier
> Transform.)
>


"Starts at line 119. Okay, *ten* lines then. "

The Hilbert transform is *after the comment block*.

--
Les Cargill

Randy Yates

unread,
Jul 30, 2012, 11:03:09 PM7/30/12
to
This is not the Hilbert transform. Yes, the author calls it a Hilbert
transform, but it's not; it's an analytic signal generator. The Hilbert
transform is often used when performing time-domain processing to obtain
an analytic signal, but in the frequency domain it's not necessary.

That said, a true Hilbert transform would be only slightly different
than those "10" lines of code.

robert...@analog.com

unread,
Jul 30, 2012, 11:13:30 PM7/30/12
to
No, Dave Blackmer was the founder of dbx, but THAT corp was founded by a core of people from dbx when dbx was going under, including Les Tyler and Gary Hebert. They are still cranking out cool audio products more than 20 years later

Luxey

unread,
Jul 31, 2012, 5:53:22 AM7/31/12
to
GEQ was suggested near the begining of the thread.
OP did not ask how to build all pass filter.
This, crossposting, should be illegal.

Les Cargill

unread,
Jul 31, 2012, 7:46:43 AM7/31/12
to
Randy Yates wrote:
> Les Cargill <lcarg...@comcast.com> writes:
>
>> Randy Yates wrote:
>>> Les Cargill <lcarg...@comcast.com> writes:
>>>> [...]
>>>> <https://bitbucket.org/cleemesser/stockwelltransform/src/e9adf4f71e13/stockwell/st.c>
>>>>
>>>> Starts at line 119. Okay, *ten* lines then.
>>>
>>> 1. This is a Stockwell transform, not a Hilbert transform.
>>>
>>> 2. It's way more than 10 lines of code.
>>>
>>> 3. Line 119 is a comment.
>>>
>>> (Apparently the Stockwell transform is a form of short-term Fourier
>>> Transform.)
>>>
>>
>>
>> "Starts at line 119. Okay, *ten* lines then."
>>
>> The Hilbert transform is *after the comment block*.
>
> This is not the Hilbert transform. Yes, the author calls it a Hilbert
> transform, but it's not; it's an analytic signal generator. The Hilbert
> transform is often used when performing time-domain processing to obtain
> an analytic signal, but in the frequency domain it's not necessary.
>
> That said, a true Hilbert transform would be only slightly different
> than those "10" lines of code.
>

Ah! Now I got your meaning. I agree. It does provide a 90 degree phase
shift, and the way I was evaluating it can't tell from a true Hilbert
transform.

--
Les Cargill

Randy Yates

unread,
Jul 31, 2012, 6:13:12 PM7/31/12
to
Les,

It does not provide a 90-degree phase shift. It converts a real signal
into an "analytic" signal, i.e., it removes the negative frequencies
(and doubles the positive frequencies to make the total energy the
same).

Since the input signal is real, the negative frequencies in the FFT are
redundant. (More specifically, the FFT of a real signal is Hermitian
symmetric, i.e., F(k) = F*(K-k-1), where F* denotes the complex
conjugate of F and K = N, the size of the FFT. Therefore you lose
nothing if you zero out the negative frequencies.

A consequence of this operation is that the output (inverse FFT)
is then necessarily complex, by the properties of the DFT.

I also made an error that it "would be only slightly different". It will
be quite a bit different since the FFT results would need to be
converted from rectangular to polar, the phase modified, then the result
converted back to rectangular.

Les Cargill

unread,
Aug 3, 2012, 9:38:27 PM8/3/12
to
Randy Yates wrote:
> Les Cargill <lcarg...@comcast.com> writes:
<snip>
>
> I also made an error that it "would be only slightly different". It will
> be quite a bit different since the FFT results would need to be
> converted from rectangular to polar, the phase modified, then the result
> converted back to rectangular.
>


I am very sorry Randy. I posted the wrong link. :(
<hangs head in shame>

*This* is claimed to be a Hilbert transform:

void hilbert(double *samples, complex *z,int n)
{
int i;
double temp;

// assign the real sample chain to the real part of z
assign(z,samples,n);
fft(z,n);
k=n/2;
// zero the DC component of the positive and negative frequencies.
z[0].real=0;
z[0].imag=0;
z[k].real=0;
z[k].imag=0;
for(i=1;i<k;i++)
{
temp=z[i].real;
z[i].real=-z[i].imag;
z[i].imag=temp;
}
for(i=k+1;i<n;i++)
{
temp=-z[i].real;
z[i].real=z[i].imag;
z[i].imag=temp;
}
ifft(z,n);
deassign(samples,z,n);
}

it also tests to be very much like one. Again.... OOPS!

I had included the original formula as _hilbert() in my
code ( to preserve it without using it - note the preceding
underscore ) and the code in *this* post was in a routine named
hilbert();

My code is some different, but the above excerpt illustrates things
better. Stolen from
http://www.vbforums.com/archive/index.php/t-639223.html


--
Les Cargill

Randy Yates

unread,
Aug 4, 2012, 11:22:52 PM8/4/12
to
Les Cargill <lcarg...@comcast.com> writes:

> Randy Yates wrote:
>> Les Cargill <lcarg...@comcast.com> writes:
> <snip>
>>
>> I also made an error that it "would be only slightly different". It will
>> be quite a bit different since the FFT results would need to be
>> converted from rectangular to polar, the phase modified, then the result
>> converted back to rectangular.
>>
>
>
> I am very sorry Randy. I posted the wrong link. :(
> <hangs head in shame>

Ha! I'd be a liar if I said I never did a similar thing.

> *This* is claimed to be a Hilbert transform:
>
> void hilbert(double *samples, complex *z,int n)
> {
> int i;
> double temp;
>
> // assign the real sample chain to the real part of z
> assign(z,samples,n);
> fft(z,n);
> k=n/2;
> // zero the DC component of the positive and negative frequencies.
> z[0].real=0;
> z[0].imag=0;
> z[k].real=0;
> z[k].imag=0;
> for(i=1;i<k;i++)
> {
> temp=z[i].real;
> z[i].real=-z[i].imag;
> z[i].imag=temp;
> }
> for(i=k+1;i<n;i++)
> {
> temp=-z[i].real;
> z[i].real=z[i].imag;
> z[i].imag=temp;
> }
> ifft(z,n);
> deassign(samples,z,n);
> }

Yes, that looks pretty darned close. Except..., there aren't two DC's in
the FFT output; the z[k].real = 0 and z[k].imag = 0 statements are
wrong.

Similarly, you should start the second loop at k, not k+1.

Finally, this is the negative of the Hilbert transform. H(w) is -j for
positive frequencies and +j for negative frequencies.

> it also tests to be very much like one. Again.... OOPS!

I'll bet you have some frequency anomalies and/or residual imaginary
components in the inverse FFT due to that incorrect zeroing.

Les Cargill

unread,
Aug 5, 2012, 10:27:59 AM8/5/12
to
Right.

> Similarly, you should start the second loop at k, not k+1.
>
> Finally, this is the negative of the Hilbert transform. H(w) is -j for
> positive frequencies and +j for negative frequencies.
>

Good deal. Thanks.

>> it also tests to be very much like one. Again.... OOPS!
>
> I'll bet you have some frequency anomalies and/or residual imaginary
> components in the inverse FFT due to that incorrect zeroing.
>

Those don't show up so far in testing, so I'll revisit later on.

--
Les Cargill

Randy Yates

unread,
Aug 5, 2012, 9:13:49 PM8/5/12
to
Les Cargill <lcarg...@comcast.com> writes:

> [...]
> Those don't show up so far in testing, so I'll revisit later on.

Good luck, and have fun!

Peter Larsen

unread,
Sep 10, 2012, 5:57:34 AM9/10/12
to
thekma...@gmail.com wrote:

> I'm guessing you all probably know why I need to create one of the
> above - to trick a Pro Logic Surround decoder.

> Problem is, I know what a 90 - and 180 - deg phase shift looks like
> on a pure sinewave, but how to I achieve 90 degrees phase shift on
> "real world" material - a clip of ducks quacking or a 1890s
> locomotive roaring by? There is no simple wave - ducks, trains, and
> of course music - are anything but simple!

Not to worry, just make a natural stereo recording and the reverberant field
will end up as "rear" signal. There is then the effects of the dolby decode
causing a treble roll-off that may or may not matter. If it matters convert
to MS, add a modest treble boost to the S signal and convert back to stereo.

Kind regards

Peter Larsen





0 new messages