[comp.dsp] 180-deg phase shift -- A study in Usenet technical advice

max@prls.UUCP (Max Hauser) (05/31/91)

Original posting asked for "the algorithm that would take a stream of
sampled sound, shift it 180 deg in phase and spit it back out again."

Two replies each advised a pair of Hilbert transformers (which are
frequency-independent 90-degree phase shifters, more or less).

One reply asserted that a transfer function such as 180-degree phase
shift cannot be implemented "without getting it into the form of a
difference equation."

One reply stated that "180 deg phase shift is not the same as simply
inverting the signal.  A phase shift implies a time delay of some sort."

And added, "he *may* have meant a 180 deg phase shift for each of the
frequencies that add up to his composite signal.  The output signal will
definitely NOT look much like the input signal.  You can prove this to your
self ..."  [And later apologized, though only about this second part]

Another separate reply declared that "Inverting is NOT the same as 180 deg
phase shift. For a symetric waveform (eg a sine wave) it looks the same,
but with something assymetric what you will see is the waveform upside-down,
which is not the same as shifted 180 deg. Phase shifting moves a waveform
along the time axis: it stays the same way up ..."  [This was my favorite]

Another suggested, "I think ... that the correct 'theoretical' answer is to
find a filter that actually does produce the proper time shift for each
frequency ..." although this respondent added sensible comments and had the
rare insight to qualify the foregoing remark with "I think."

One respondent assaulted a stipulation  "Given *ANY* signal  x(n)  with
Fourier Transform  X(w)"  with the comment  "Really? You surely mean
_periodic_ signal."

Another "clarified" this with "Why do we keep tagging onto this thread?
`any signal ..with a fourier transform' implies any periodic signal....
so why the beef? Let it go!"

An earlier and prolific respondent re-entered with an explanation of how,
indeed, inverting does shift every frequency component by 180 degrees, but
then added that "the original question was to shift the phase of a signal
by 180 degrees, which implicitly means to delay the signal by pi degrees as
referred to its fundamental frequency.   [See the original, above -- MH]


Now, it is conceivable that one or more of these respondents was attempting
irony (in which case, they failed); but basically, none of them knew what
he was talking about.  If any of them displayed this kind of "expertise"
on a signal-processing quiz at a serious engineering school (few enough of
these, by the way, in the United States) or a serious job interview, it 
might produce a rude surprise.  (And this was on "serious" technical
newsgroups -- I let you imagine what might have transpired on rec.audio.)

One astute respondent (and indeed there were a few, very few) remarked
"I assume that this is due to a tendency to respond without taking time
to think about the problem. ...  I just [thought] I would throw in my
$.02 because the argument seemed to be shifting to the wrong answer."

Preserved in its entirety, this exchange makes an instructive example
about the Usenet, especially when you see the tones of decisiveness and
authority that so many of them took.  These exchanges are so neat I will
try to think up some more innocent questions, have them posted, and
watch what ensues.

gordon@prls.UUCP (G Vickers) (06/01/91)

In article <51184@prls.UUCP> max@prls.UUCP (Max Hauser) writes:
>Original posting asked for "the algorithm that would take a stream of
>sampled sound, shift it 180 deg in phase and spit it back out again."
>
      I've long hoped that someone would start a rec.electronics and let
  the EE's have this group back.  The results of your "study" would certainly
  support any such ambitions.

jpc@avdms8.msfc.nasa.gov (J. Porter Clark) (06/02/91)

max@prls.UUCP (Max Hauser) writes:

[summary of recent thread on 180-degrees phase shifters]

>Preserved in its entirety, this exchange makes an instructive example
>about the Usenet, especially when you see the tones of decisiveness and
>authority that so many of them took.  These exchanges are so neat I will
>try to think up some more innocent questions, have them posted, and
>watch what ensues.

FOR GOD'S SAKE, MAN!  HAVE YOU NO COMPASSION FOR YOUR FELLOW MAN?  CAN
YOU IMAGINE THE MISERY, THE AGONY, THE UNTOLD HEARTACHE WHICH WILL
ENSUE WHEN YOU UNLEASH THESE QUESTIONS UPON AN UNKNOWING WORLD?  TURN
BACK FROM THIS COURSE OF EVIL BEFORE IT'S TOO LATE!

Say, what was the answer to the question anyway?

:-) * 1E6
--
J. Porter Clark    jpc@avdms8.msfc.nasa.gov

karsh@trifolium.esd.sgi.com (Bruce Karsh) (06/02/91)

In article <51184@prls.UUCP> max@prls.UUCP (Max Hauser) writes:

>Preserved in its entirety, this exchange makes an instructive example
>about the Usenet, especially when you see the tones of decisiveness and
>authority that so many of them took.  These exchanges are so neat I will
>try to think up some more innocent questions, have them posted, and
>watch what ensues.

It can get much worse than this.  Here's one from rec.music.misc that
makes the whole 180 degree discussion seem profound!

In article <4571@meaddata.meaddata.com> dedek@meaddata.com (Mike Dedek) writes:

>  Now, I know that CDs have some major advantages over vinyl in terms
>  of wear -n- tear, and background noise due to dust, etc.  My friend
>  and I came up with a theory why digital music will never reproduce
>  sound as well as analog devices.  Since music is made up of sound
>  waves which range over a *continuous* spectrum of frequencies, it
>  seems that digital music will suffer in any frequencies *in between*
>  the ones recognized by the digital equipment. 

In article <4306@csccat.cs.com>, larry@csccat.cs.com (Larry Spence) writes:

> This is quite true.  The analog-to-digital converters are calibrated to
> pick up the frequencies of _correctly tuned_ guitar strings, piano keys,
> etc.  These are reproduced unerringly.  However, it is seldom the case
> that instruments are in perfect tune.  If, for example, a A is 441 Hz
> rather than the standard 440, a digital recorder will not reproduce it
> at full volume, and it may be slightly "muffled."  This is the key to
> the oft-heard complaint that "grungy" music (e.g., Sonic Youth) sounds
> too thin and not very powerful on CD relative to LP.  In the case of
> SY, they often use non-standard guitar tunings, which, since they do not 
> go to the expense of using specially-calibrated A/D converters, are
> poorly converted to digital waveforms.  A group like Floyd would certainly
> be in perfect _relative_ tune in the studio, but possibly not in perfect
> _absolute_ tune.  The effect would be the same -- dull sound from the
> "falling between the binary cracks" effect.

> If, during the remixing from two-track analog masters to 24-track digital
> tape, the mastering engineer adjusts the numeric representation used in
> the digital domain, a fairly accurate conversion can be accomplished.
> In pratice, a straight transfer is done with little care, and the result
> sounds "thin," as essential information was lost.  This is probably the
> effect that you have noticed.  It may seem odd that Mobile Fidelity Labs
> didn't get this right with Dark Side of the Moon, but it is rumored that
> this was due to their use of fixed-point arithmetic in the D/A converters
> due to an engineering oversight at the time (DSOTM was one of MFSL's
> earlier efforts, alas).  The Steely Dan album I don't know about.

>  analogous to the problem of representing certain numbers in binary,
>  such as repeating decimals. 

> The new Sony MD recordable discs avoid this problem entirely by using
> a continued-fraction representation of the signal.  This is possible
> because the MD format is not purely optical (as with CDs), but rather
> magneto-optical, thereby incorporating more of the continuous-domain
> information from the analog signal, much as an analog magnetic tape
> gives a perfectly continuous playback of an analog signal.  Thus, we
> can expect the new format to have much less of a "binary" problem than
> current CDs.

> I hope this cleared things up.

			Bruce Karsh
			karsh@sgi.com

MHVG::MHUA::e_gs18@vaxa.nerc-murchison.ac.uk (Russ Evans) (06/02/91)

>Two replies each advised a pair of Hilbert transformers (which are
>frequency-independent 90-degree phase shifters, more or less).

... much deleted ...

>Now, it is conceivable that one or more of these respondents was attempting
>irony (in which case, they failed); 

In my view, the irony expressed by these two initial respondents was so
obvious that a smiley would have destroyed the humour.  (I was tempted to
do exactly the same myself - they just beat me to it!)  I submit that the 
court should discharge these two defendants without further ado.

Russ Evans
BGS, Edinburgh                        e_gs18@va.nmh.ac.uk

todd@appmag.com (Todd Day) (06/03/91)

%And added, "he *may* have meant a 180 deg phase shift for each of the
%frequencies that add up to his composite signal.  The output signal will
%definitely NOT look much like the input signal.  You can prove this to your
%self ..."

Yeah, that was me.  Ever have one of those days?  I actually *did* write
this out, but of course, I did it wrong.  The mistake I made was overthinking
the problem and working on it for non-multiples of 180 degrees also.

But back to your original comment.  I've never looked at the first replies
to USENET questions and said, "That's the definitive answer."  I always
wait a few days.  Usually, the first ones in (like me in your example)
haven't thought about the answer completely.

USENET provides expertise through consensus.  I consider the discussions
(even in this group) more or less like bullshit sessions with coworkers
and friends.  We eventually get around to the right answer.

[Re:  Lack of "I think" prefacing my statements.  "I think" on USENET,
 it goes without saying that what you write is what you think.]

-- 
Todd Day  |  todd@appmag.com

max@prls.UUCP (Max Hauser) (06/04/91)

I don't really plan to belabor this subject, especially as it's improbable
that I could improve on the case made so thoroughly (if unwittingly) by
the principal respondents themselves.  (And I can tell you that this has
struck a chord, to judge from the various gleeful mail I've received.)

In article <1991Jun3.012747.841@appmag.com>, todd@appmag.com (Todd Day)
comments:
|
|   I've never looked at the first replies
|   to USENET questions and said, "That's the definitive answer."

Well, I'd be the last to take exception with the way someone reads the
Usenet.  My remarks concerned not the reading but the writing.  So many
submit assertive, decisive, definite responses when, basically, they don't
know what they are talking about.  Such obvious honest qualifiers as
"I think" or "I once heard" or "I remember it having something to do with"
would effortlessly avert this hazard (if the writers cared to do so).

To their credit, some Usenet contributors use exactly such qualifiers,
and often, at the same time, have more to say than do those who pretend
dazzling expertise.  Do you sense a pattern in this?

|   USENET provides expertise through consensus.

I would have phrased it somewhat differently.  Nine years of reading the
Usenet have demonstrated to me that the "consensus" converges, with
alarming regularity, to the wrong answer.  Or even, as I separately
alluded to on rec.audio recently, to multiple, competing wrong answers.  

Max Hauser      {mips,philabs,pyramid}!prls!max      prls!max@mips.com


"Write each Usenet article on the assumption that you will see it again,
years later, in printed form, in a glossy plastic page protector, shown
to you pointedly by someone you have never met before.  It happens."
                                                             -- me, 1987

peterc@sugar.hackercorp.com (Peter Creath) (06/06/91)

jpc@avdms8.msfc.nasa.gov (J. Porter Clark) writes:
> Say, what was the answer to the question anyway?
 
42.  (Now, to figure out the question which gives the answer...)
 
;&B (mutant winking smiley face with a pretzel up his nose sticking both
     tongues out)
 
peterc@sugar.neosoft.com           "Listen, there's a hell of a good
peterc@sugar.hackercorp.com         universe next door.  Let's go!"
(take your pick)                                      -e e cummings

-- 

truman@zabriskie.berkeley.edu (Tom Truman) (06/08/91)

With all of the commotion caused by a simple question regarding 180 deg.
phase shift, I can't resist posting this one:

" Suppose that a certain telephone channel can be characterized by
a frequency response H(f) = exp(j * P(f)), where P(-f) = -P(f).

Because P(f) may be a complicated function of frequency, such a channel may
have serious distortions.  It has been suggested (rather impractically) that
the signal on the recieving end be recorded on tape, flown by fast jet back
to the transmitting end, played backwards through the original channel a second
time, and recorded again on tape.

The signal on this second tape, if played backwards, should (it is claimed)
be the original signal, independent of P(f).

Would this work ?"

tom truman.

eddins@uicbert.eecs.uic.edu (Steve Eddins) (06/08/91)

truman@zabriskie.berkeley.edu (Tom Truman) writes:


>With all of the commotion caused by a simple question regarding 180 deg.
>phase shift, I can't resist posting this one:

>" Suppose that a certain telephone channel can be characterized by
>a frequency response H(f) = exp(j * P(f)), where P(-f) = -P(f).

>Because P(f) may be a complicated function of frequency, such a
>channel may have serious distortions.  It has been suggested (rather
>impractically) that the signal on the recieving end be recorded on
>tape, flown by fast jet back to the transmitting end, played backwards
>through the original channel a second time, and recorded again on
>tape.

>The signal on this second tape, if played backwards, should (it is claimed)
>be the original signal, independent of P(f).

>Would this work ?"

OK, I'll bite.  The system looks like:


------>  H(f)  ------> (-t) ------>  H(f)  ------> (-t) ------>

  X(f)           A(f)        B(f)           C(f)         Y(f)

where (-t) indicates time reversal.  That is, b(t) = a(-t).  From
Fourier transform properties, B(f) = A(-f).  Tracing through the
system: 

A(f) = X(f) H(f)
B(f) = X(-f) H(-f)
C(f) = X(-f) H(-f) H(f)
Y(f) = X(f) H(f) H(-f)
     = X(f) e^{jP(f)} e^{jP(-f)}
     = X(f) e^{jP(f)} e^{-jP(f)}
     = X(f)

So it does work.  In fact, this time reversal trick gets used a lot to
get linear phase in systems using IIR filters.  Discrete-time systems,
that is, with finite-length signals, so time-reversal is easy.

An important factor is that the telephone channel introduces only
phase distortion, not frequency distortion.  That is, |H(f)| = 1.
If |H(f)| \neq 1, then the input-output relationship of the above
system is:

Y(f) = X(f) |H(f)|^2			(assuming h(t) is real)

This system has no phase distortion, but the frequency distortion is
channel-dependent.

Well, given what's happened recently in this group, I've tried to be
careful here, but if there's a flaw, fire away!
-- 
Steve Eddins	
eddins@brazil.eecs.uic.edu 	(312) 996-5771 		FAX: (312) 413-0024
University of Illinois at Chicago, EECS Dept., M/C 154, 1120 SEO Bldg,
Box 4348, Chicago, IL  60680

rmaarts@prl.philips.nl (R.M. Aarts 43149) (06/10/91)

Who has a DSP (preferably 56001 assembler) program for solving
Ax=b, where A= symmetrical Toepliz, eg. Levinson-Durbin.
 
Please answer to net or Email:   rmaarts@prl.philips.nl

konar@lennon.SRC.Honeywell.COM (Mithat F Konar) (06/17/91)

In article <jpc.675818225@avdms8.msfc.nasa.gov> jpc@avdms8.msfc.nasa.gov (J. Porter Clark) writes:
>max@prls.UUCP (Max Hauser) writes:
>
>[summary of recent thread on 180-degrees phase shifters]
>
>>Preserved in its entirety, this exchange makes an instructive example
>>about the Usenet, especially when you see the tones of decisiveness and
>>authority that so many of them took.  These exchanges are so neat I will
>>try to think up some more innocent questions, have them posted, and
>>watch what ensues.
>
>FOR GOD'S SAKE, MAN!  HAVE YOU NO COMPASSION FOR YOUR FELLOW MAN?  CAN
>YOU IMAGINE THE MISERY, THE AGONY, THE UNTOLD HEARTACHE WHICH WILL
>ENSUE WHEN YOU UNLEASH THESE QUESTIONS UPON AN UNKNOWING WORLD?  TURN
>BACK FROM THIS COURSE OF EVIL BEFORE IT'S TOO LATE!
>
>Say, what was the answer to the question anyway?
>

Forty-two, I think.