[sci.electronics] ..but what about _output_ filtering for D/A's?

Jeff.Miller@samba.acs.unc.edu (Jeff Miller) (10/13/90)

Of course the first thing any treatment of digital audio and A/D converters
geos into is the Nyquist frequency and the crucial need for effective input
filtering to avoid aliasing. That I've got covered.
 
But I don't recall any treatment of the need and mathematics of filtering
the output of a D/A converter. I would imagine at CD or DAT frequencies
it wouldn't be too critical as any harmonics would be ultrasonic (or would
they? And  I've always wondered: can two ultrasonic sounds or an ultrasonic
and audible sound beat to create an audible tone?) but at lower frequencies,
I would think that aproximating a sine wave with stepped squares would sound
bad. 

If someone could tell me loosely what the requirements are I would appreciate
it. I really must get a good handle on it as I am shooting for CD quality.

If the requirements are as stringent as the input filtering requirements,
I may have some trouble. Would mathematically interpolating a few output
levels between each input sample help, and deos that technique have a name
I should look out for?

Thanks, 

-Jeff 

--

grayt@spock (Tom Gray) (10/15/90)

In article <1319@beguine.UUCP> Jeff.Miller@samba.acs.unc.edu (Jeff Miller) writes:
>Of course the first thing any treatment of digital audio and A/D converters
>geos into is the Nyquist frequency and the crucial need for effective input
>filtering to avoid aliasing. That I've got covered.
> 
>But I don't recall any treatment of the need and mathematics of filtering
>the output of a D/A converter. I would imagine at CD or DAT frequencies
>it wouldn't be too critical as any harmonics would be ultrasonic (or would
>
>If the requirements are as stringent as the input filtering requirements,
>I may have some trouble. Would mathematically interpolating a few output
>levels between each input sample help, and deos that technique have a name
>I should look out for?
>
>Thanks, 
 The answer to the above question is yes. Different types of sampling
systems do have different requirements for filtering.

One way to look at this is to regard the sampled signal as a Taylor
series. Commonly only the current sample is used. This has been
called a zero order sampler. It requires the sinx/x filter that we
all know and love. If you start deriving the derivatives of the signal
from various orders and summing these into the output sampe, you get 
higher order samplers. This is your idea of interpolation. it is really expanding the signal around the sampling time as a Taylor series. 
In the limit, if derivitives of all orders are supplied, you
have ideal sampling and no filter is required.

>

whit@milton.u.washington.edu (John Whitmore) (10/16/90)

In article <1319@beguine.UUCP> Jeff.Miller@samba.acs.unc.edu (Jeff Miller) writes:

>Of course the first thing any treatment of digital audio and A/D converters
>geos into is the Nyquist frequency and the crucial need for effective input
>filtering to avoid aliasing. That I've got covered.
> 
>But I don't recall any treatment of the need and mathematics of filtering
>the output of a D/A converter. I would imagine at CD or DAT frequencies
>it wouldn't be too critical as any harmonics would be ultrasonic (or would
>they? 

	Yes, they'd be ultrasonic, BUT that doesn't mean the sound
reproducing equipment will ignore them.  A classic problem arose when
the early FM tuners were connected to tape recorders; the harmonics
of the (19 kHz?) stereo pilot signal beat against the (circa 60 kHz)
record bias oscillator to generate a horrendous howl (which wavered
because the bias oscillator frequency wasn't terribly stable).

>And  I've always wondered: can two ultrasonic sounds or an ultrasonic
>and audible sound beat to create an audible tone?

	Obviously, yes.
> but at lower frequencies,
>I would think that aproximating a sine wave with stepped squares would sound
>bad. 

	For this reason, many top-end CD players mask the low-amplitude
'warble' that a low-amplitude signal becomes when played back on a
digital system (the problem here is that there's 96 dB signal/noise
for LOUD signals, but a quiet passage, 80 dB down from the peak
power in a given opus, will only have 16 dB signal/noise).  Typical
treatment is to mask the artifact with some pink noise (yes, there
are noise generators in good CD players).
>
> Would mathematically interpolating a few output
>levels between each input sample help, and deos that technique have a name
>I should look out for?

	A generalized interpolation scheme is to consider each point in
time to be a linear combination of the nearby sampled points; this
is called a Finite Impulse Response filter (FIR).  Such a scheme
is a filter because it can be chosen (by twiddling the coefficients)
to generate zero output amplitude of the first harmonic interval
(which is called a '2X oversampling digital filter'), or of the
first two harmonic intervals ('4X oversampling digital filter').
	These so-called 'digital filters' are a hot topic; I don't
know, offhand, what would be a good reference. 

		John Whitmore

jeh@dcs.simpact.com (10/16/90)

In article <1319@beguine.UUCP>, Jeff.Miller@samba.acs.unc.edu (Jeff Miller)
writes:
> [...] I don't recall any treatment of the need and mathematics of filtering
> the output of a D/A converter. I would imagine at CD or DAT frequencies
> it wouldn't be too critical as any harmonics would be ultrasonic (or would
> they? 

No no no.  The output filter (aka the "reconstruction filter") is an essential
part of the process.  

Also be aware that the input to this filter is NOT a step waveform, but rather
a series of pulses -- one pulse per sample.  Ideally the pulses should be of
zero width. 

> If the requirements are as stringent as the input filtering requirements,
> I may have some trouble. 

yep.  

> Would mathematically interpolating a few output
> levels between each input sample help, and deos that technique have a name
> I should look out for?

yes... I believe it's called oversampling with digital filtering.  

	--- Jamie Hanrahan, Simpact Associates, San Diego CA
Chair, VMSnet [DECUS uucp] and Internals Working Groups, DECUS VAX Systems SIG 
Internet:  jeh@dcs.simpact.com, or if that fails, jeh@crash.cts.com
Uucp:  ...{crash,scubed,decwrl}!simpact!jeh

myers@hpfcdj.HP.COM (Bob Myers) (10/18/90)

>>And  I've always wondered: can two ultrasonic sounds or an ultrasonic
>>and audible sound beat to create an audible tone?
>
>	Obviously, yes.

Wait just a minute, John.  As SOUND, the answer to this question is *no*.
You will not, for example, hear a 1000 Hz tone when exposed to *sound sources*
of, say, 20 kHz and 21 kHz.  The ear doesn't work that way.  (The
phenonenon wherein one may tune a stringed instrument by listening for a
"wavering" sound when one string approaches the frequency of the other is
a case of interference producing a tremolo (varying intensity), not a vibrato
(varying frequency).)  (And I hope I got the musicalese right - it's been a
while!)

However, if such signals exist in an electronic circuit (as was the case in
the instance you mention, with the ultrasonic pilot tone producing nasty
results when mixed with 60 Hz), then these "beat frequencies" WILL very
likely occur, as intermodulation occurs due to the non-linearities present
in any amplifying device.


Bob Myers  KC0EW   HP Graphics Tech. Div.|  Opinions expressed here are not
                   Ft. Collins, Colorado |  those of my employer or any other
myers@fc.hp.com                          |  sentient life-form on this planet.

jbm@eos.arc.nasa.gov (Jeffrey Mulligan) (10/20/90)

myers@hpfcdj.HP.COM (Bob Myers) writes:

>>>And  I've always wondered: can two ultrasonic sounds or an ultrasonic
>>>and audible sound beat to create an audible tone?
>>
>>	Obviously, yes.

>Wait just a minute, John.  As SOUND, the answer to this question is *no*.
>You will not, for example, hear a 1000 Hz tone when exposed to *sound sources*
>of, say, 20 kHz and 21 kHz.  The ear doesn't work that way.  (The
>phenonenon wherein one may tune a stringed instrument by listening for a
>"wavering" sound when one string approaches the frequency of the other is
>a case of interference producing a tremolo (varying intensity), not a vibrato
>(varying frequency).)  (And I hope I got the musicalese right - it's been a
>while!)

Excellent point!

>However, if such signals exist in an electronic circuit (as was the case in
>the instance you mention, with the ultrasonic pilot tone producing nasty
>results when mixed with 60 Hz), then these "beat frequencies" WILL very
>likely occur, as intermodulation occurs due to the non-linearities present
>in any amplifying device.


As Bob has pointed out, the key here is nonlinearities.  Interestingly,
the visual analog of this DOES work, i.e. the sum of two high frequency
gratings (which cannot be resolved) can produce a visible beat.
[To actually get these gratings on the retina, you have to use
laser interferometry, otherwise the optical point spread function of
the eye would blur them away].  This demonstrates not only the
neural nonlinearity, but also the fact that these high frequencies
ARE passed by the early stages of the visual process.
In order to hear beats between ultrasonic tones, it
would be necessary both to have a nonlinearity in the auditory
system, AND a cochlea etc. that would pass the ultrasonic tones
at least as far as the nonlinearity.  I suspect that the ultrasonic
tones don't make it as far as the nervous system for mechanical reasons.


-- 

	Jeff Mulligan (jbm@eos.arc.nasa.gov)
	NASA/Ames Research Ctr., Mail Stop 262-2, Moffett Field CA, 94035
	(415) 604-3745

wolfgang@wsrcc.uucp (Wolfgang S. Rupprecht) (10/21/90)

>And  I've always wondered: can two ultrasonic sounds or an ultrasonic
>and audible sound beat to create an audible tone?

An some people have pointed out, the whole trick to getting the beats
is a non-linear addition of the two sine waves.

The ear is fairly linear in that respect.  You won't hear the beats.

Electronics on the other hand are hard pressed to be called linear.
You will definitely get sum and difference products.

This is actually the basis for some bug-foilers.  Just activate
several powerful ultrasonic sources.  Human ears won't hear the
beats, but the electronics sure will!  

It usually best to have totally separate oscillators for this, since
you don't want the sinusoids mixing in your electronics.

-wolfgang
-- 
Wolfgang Rupprecht    uunet!{nancy,usaos,media!ka3ovk}!wsrcc!wolfgang
Snail Mail Address:   Box 6524, Alexandria, VA 22306-0524

myers@hpfcdj.HP.COM (Bob Myers) (10/23/90)

>As Bob has pointed out, the key here is nonlinearities.  Interestingly,
>the visual analog of this DOES work, i.e. the sum of two high frequency
>gratings (which cannot be resolved) can produce a visible beat.

Uh, Jeff, I'm still not certain I go along with this - isn't the above
phenomenon the result of interference (two items of slightly different
wavelengths - or in this case, spacing - resulting in constructive and
destructive addition of the signals at a much longer, and hence visible,
wavelength) rather than intermodulation (the actual multiplication of
sinusoids of different frequencies)?


Bob Myers  KC0EW   HP Graphics Tech. Div.|  Opinions expressed here are not
                   Ft. Collins, Colorado |  those of my employer or any other
myers@fc.hp.com                          |  sentient life-form on this planet.

myers@hpfcdj.HP.COM (Bob Myers) (10/23/90)

>An some people have pointed out, the whole trick to getting the beats
>is a non-linear addition of the two sine waves.

Still "no."  Non-linear ADDITION (whatever that means) is not the source
of true intermodulation.  (By "non-linear addition", I can only assume that
you mean the two input signals are multiplied by different values before being
summed.  But this is not required to produce *interference*, which is the
phenomenon which gives audible "beats" and visible interference patterns -
interference happens when adding any two signals of different phase or
frequency.)

Non-linear *multiplication* (i.e., amplification) is the means through which
electronic equipment can produce the sum and difference frequencies of two
inputs.  Here's what happens:

Ideally, an amplifier would produce and output which is simply a "bigger copy"
of the input; this would equate to a linear function as follows (in terms
of input and output voltages):

    Eout = A Ein

where A is the amplification factor; if the output is a "ten times bigger"
version of the input, A = 10.  As this is of the same form as the equation
for a line, such amplification is said to be "linear," and the gain does
not depend on the input amplitude.

However, NO electronic device can provide perfectly linear behavior over all
possible inputs; at some point, at least, the output will no longer be
properly described by such a simple equation.  If there is any non-linearity
in the output function, then there must be at least some "higher-order"
terms in this function.  We might imagine that a simple case would be at
least:

   Eout = AEin + BEin^2

Here, the "linear" portion of the action (the amplification that we really
want) is described by the first term, and the non-linearity is modelled as
a "squared" term.  Here's where the intermodulation comes from, for if the
input is anything other than a simple sinusoid, there will be at least
two sinusoidal components.  In the simplest case, there would be exactly
two:

   Ein = Xsin(w1t) + Ysin(w2t)

where w1 and w2 are indicating different frequencies.  It should be clear that
if THIS value of "Ein" is squared (by the non-linearity of the amplifier),
then the output will include some terms which are the product of these two
sinusoids (plus the multiplying factor B).  Trig identities will show that
the multiple of two sine waves are cosines at the sum and difference
frequencies, and so we have the "intermodulation" components.

(This has some practical application; for example, a diode is about the
simplest totally-nonlinear device one can imagine, and forms the basis -
along with a resistive summing network - for a simple AM modulator or mixer.)


Bob Myers  KC0EW   HP Graphics Tech. Div.|  Opinions expressed here are not
                   Ft. Collins, Colorado |  those of my employer or any other
myers@fc.hp.com                          |  sentient life-form on this planet.

rosentha@sierra.STANFORD.EDU (rosentha) (10/26/90)

  	Can a 20 and 21khz tone combine to give an audible difference
frequency?  Yes they can, if they are loud enough.  The ear has some
nonlinearity and should mix the two signals down to a kiloherz.

jbm@eos.arc.nasa.gov (Jeffrey Mulligan) (10/26/90)

I wrote:

>>As Bob has pointed out, the key here is nonlinearities.  Interestingly,
>>the visual analog of this DOES work, i.e. the sum of two high frequency
>>gratings (which cannot be resolved) can produce a visible beat.

myers@hpfcdj.HP.COM (Bob Myers) writes:

>Uh, Jeff, I'm still not certain I go along with this - isn't the above
>phenomenon the result of interference (two items of slightly different
>wavelengths - or in this case, spacing - resulting in constructive and
>destructive addition of the signals at a much longer, and hence visible,
>wavelength) rather than intermodulation (the actual multiplication of
>sinusoids of different frequencies)?

You are right up to a point; what you describe is the formation
of a single interference grating.  In practice this is done
using two plane waves of the same frequency, but different orientations
in space.  Two focussed beams enter through different points
in the pupil, with the spacing of the entrance pupils controlling
the spatial frequency on the retina.  The upper limit on spatial
frequency produced is determined by how far apart the beams can
be spaced; sometimes drugs may be used to dilate the pupil.

In the experiments which demonstrated the nonlinearity, two pairs
of beams produced two interference gratings.  The beams were
pulsed so that only one pair was on at a time.  Thus there is
no interference between the beams making up each of the two gratings.
The pulse rate was high ( > 1KHz ), so the gratings were
superimposed as far as the visual system is concerned.

This is pretty much state-of-the-art research which has been
done at the University of Rochester.  The results about the
nonlinearity are still unpublished, although they have been
presented at several scientific meetings.  There are some
papers out of the same lab in which high-frequency laser
interference gratings generated visible low-frequency aliases
with the photoreceptor sampling array.

-- 

	Jeff Mulligan (jbm@eos.arc.nasa.gov)
	NASA/Ames Research Ctr., Mail Stop 262-2, Moffett Field CA, 94035
	(415) 604-3745

roy@phri.nyu.edu (Roy Smith) (10/26/90)

rosentha@sierra.STANFORD.EDU (rosentha) writes:
> Can a 20 and 21khz tone combine to give an audible difference frequency?
> Yes they can, if they are loud enough.  The ear has some nonlinearity and
> should mix the two signals down to a kiloherz.

	I missed the beginning of this, but rosentha's statement doesn't
make sense.  You don't need any nonlinearities to mix two signals to get
their sum and differences, all you need is a (linear) adder.  What you need
a nonlinearity for is to get detection without a mixer.
--
Roy Smith, Public Health Research Institute
455 First Avenue, New York, NY 10016
roy@alanine.phri.nyu.edu -OR- {att,cmcl2,rutgers,hombre}!phri!roy
"Arcane?  Did you say arcane?  It wouldn't be Unix if it wasn't arcane!"

mrj@cs.su.oz (Mark James) (10/26/90)

In article <17660121@hpfcdj.HP.COM> myers@hpfcdj.HP.COM (Bob Myers) writes:
>Wait just a minute, John.  As SOUND, the answer to this question is *no*.
>You will not, for example, hear a 1000 Hz tone when exposed to *sound sources*
>of, say, 20 kHz and 21 kHz.  The ear doesn't work that way.

The auditory system is able to convert an amplitute modulated tone
to a pitch percept at the modulating frequency.

e.g the combination of a 1.0, 1.1 and 1.2 kHz tone (a 1.1kHz tone amplitude
modulated at 100Hz) has a perceived pitch of 100Hz.  This is not
caused by non-linearity in the cochlear.

This ability falls off somewhat as the component frequencies increase.

Mark

gja@mullian.ee.mu.oz.au (Grenville Armitage) (10/26/90)

In article <17660121@hpfcdj.HP.COM> myers@hpfcdj.HP.COM (Bob Myers) writes:
>Wait just a minute, John.  As SOUND, the answer to this question is *no*.
>You will not, for example, hear a 1000 Hz tone when exposed to *sound sources*
>of, say, 20 kHz and 21 kHz.  The ear doesn't work that way.

Hmmm. Try telling that to guitar players who
tune their instruments by ear. At least one technique
I know of (and use) involves listening for the 'beat' notes
as you tune each higher string to a harmonic of the previous
string.

And this works at quite low volumes too.....

gja

jbm@eos.arc.nasa.gov (Jeffrey Mulligan) (10/27/90)

gja@mullian.ee.mu.oz.au (Grenville Armitage) writes:

>In article <17660121@hpfcdj.HP.COM> myers@hpfcdj.HP.COM (Bob Myers) writes:
>>Wait just a minute, John.  As SOUND, the answer to this question is *no*.
>>You will not, for example, hear a 1000 Hz tone when exposed to *sound sources*
>>of, say, 20 kHz and 21 kHz.  The ear doesn't work that way.

>Hmmm. Try telling that to guitar players who
>tune their instruments by ear. At least one technique
>I know of (and use) involves listening for the 'beat' notes
>as you tune each higher string to a harmonic of the previous
>string.

There seems to be a lot of confusion about this.  Sure a guitarist
can hear the beat; but he can because he can hear the carrier,
not because the beat itself might be at an audible frequency.
There has to be a nonlinearity before there will be any spectral
energy at the beat frequency.

Another poster mentioned the psychological phenomenon of
"periodicity pitch", where a complex of tones having frequencies
1000, 1100, 1200 will have a subjective pitch of 100 Hz.
This is fine, but again the tones in the complex have to
get into the auditory system first.  Ultrasonic tones don't.

-- 

	Jeff Mulligan (jbm@eos.arc.nasa.gov)
	NASA/Ames Research Ctr., Mail Stop 262-2, Moffett Field CA, 94035
	(415) 604-3745