[comp.dsp] Combining samples......

d88pt@efd.lth.se (Peter Tomaszewski) (05/28/90)

Hi,


I would like to know how you combine two samples. If they are sampled at the
same rate I suppose you can just add them together, but if I they different 
rates? 





Email : d88pt@efd.lth.se



     thanks.........

logajan@ns.network.com (John Logajan) (05/28/90)

d88pt@efd.lth.se (Peter Tomaszewski) writes:
>I would like to know how you combine two samples. If they are sampled at the
>same rate I suppose you can just add them together, but if I they different 
>rates? 

Interpolate.

-- 
- John Logajan @ Network Systems; 7600 Boone Ave; Brooklyn Park, MN 55428
- logajan@ns.network.com, john@logajan.mn.org, 612-424-4888, Fax 424-2853

jgk@demo.COM (Joe Keane) (05/31/90)

In article <1990May28.112524.4264@lth.se> d88pt@efd.lth.se (Peter Tomaszewski) writes:
>I would like to know how you combine two samples. If they are sampled at the
>same rate I suppose you can just add them together, but if I they different 
>rates? 

If they are at the same rate, you just add or average them together.  If they
are at different rates, you have to convert one or both to the final rate.
Now, how to convert the sampling rate?  Basically, there are cheap ways to do
it, and there is the right way to do it.  This is a complicated topic, so i
won't get into it.

harrison@sunwhere.DAB.GE.COM (Gregory Harrison) (05/31/90)

In article <1990May28.112524.4264@lth.se> d88pt@efd.lth.se (Peter Tomaszewski) writes:
>Hi,
>
>
>I would like to know how you combine two samples. If they are sampled at the
I suppose you could just interpolate one of the samples to have it's
datapoint be time-aligned with the other sample.  You could use the 
spline function in Matlab for instance, or just write a little
interpolator.  You would use time as the independant variable.

Greg Harrison 
GE

cdc@uafhcx.uucp (C. D. Covington) (06/01/90)

In article <4375@ge-dab.GE.COM>, harrison@sunwhere.DAB.GE.COM (Gregory Harrison) writes:
> In article <1990May28.112524.4264@lth.se> d88pt@efd.lth.se (Peter Tomaszewski) writes:
> >Hi,
> >
> >
> >I would like to know how you combine two samples. If they are sampled at the
> I suppose you could just interpolate one of the samples to have it's
> datapoint be time-aligned with the other sample.  You could use the 
> spline function in Matlab for instance, or just write a little
> interpolator.  You would use time as the independant variable.
> 
> Greg Harrison 
> GE

    I cannot tell if my previous posting went out yesterday.  We have had
disk full problems on our netnews server.  Interpolation is the correct
answer to get the inbetween samples.  The ideal interpolation pulse is
the sinc function  sin(pi*x)/(pi*x) as predicted by Nyquists sampling theorem
where the signal must be lowpass to avoid aliasing.  In fact the sinc pulse
is an ideal lowpass filter in the frequency domain - amazing.

    I did do an analysis of optimum truncated (time-limited) interpolation
functions and was led to the prolate spheroidal wave function set.  These
functions have optimum lowpass characteristics for a given time limitation.
If the time limitation is relaxed, we revert to the sinc pulse solution.

C. David Covington (WA5TGF)  cdc@uafhcx.uark.edu     (501) 575-6583
Asst Prof, Elec Eng          Univ of Arkansas        Fayetteville, AR 72701

wilf@sce.carleton.ca (Wilf Leblanc) (06/02/90)

The problem of combining samples is really a
problem of rate conversion (as was discussed
in previous articles).  A good reference
is:


    Ronald E. Crochiere, Rabiner, L. R., 
    "Multirate Digital Signal Processing," Prentice-Hall, 1983.
    ISBN 0-13-605162-6
 
A previous poster (Covington, I think), mentioned prolate
spheroidal wave functions.  Would any one have a good 
reference on this topic ??

---
<wilf@sce.carleton.ca>
W.P. LeBlanc             |     I don't think, therefore,
                         |     I am not.

herman@marlin.NOSC.MIL (John W. Herman) (06/06/90)

--
One comment.  Even if two time series are sampled at the same rate,
interpolation will still be required if the samples are not taken at
the same time.
-- 
John Herman    ARPA:  herman@marlin.nosc.mil  Phome: (619)553-1466
Naval Ocean System Center Code 712
271 Catalina Blvd
San Diego, Ca. 92512-5000 

black@beno.CSS.GOV (Mike Black) (06/06/90)

I always though combining two samples was not possible in the time domain.
If you add two opposite phase sine waves you'll get a null response.  It's
necessary to do a Fourier Transform to the frequency domain, add the 
amplitudes, and invert the transform.  This will give you twice the amplitude
of the original two sine waves (this would seem to be the desired effect).
Am I totally off-base in this rather long-held belief?
Mike...

tldavis@athena.mit.edu (Timothy L. Davis) (06/07/90)

In article <48870@seismo.CSS.GOV> black@beno.CSS.GOV (Mike Black) writes:
>I always though combining two samples was not possible in the time domain.
>If you add two opposite phase sine waves you'll get a null response.  It's
>necessary to do a Fourier Transform to the frequency domain, add the 
>amplitudes, and invert the transform.  This will give you twice the amplitude
>of the original two sine waves (this would seem to be the desired effect).
>Am I totally off-base in this rather long-held belief?
>Mike...

I'm afraid you are, Mike.  First of all, the Fourier transform is a linear
operator: F[a x(t) + b y(t)] = a F[x(t)] + b F[y(t)]. Thus adding in the 
frequency domain has the same result as adding in the time domain.  Linearity
holds for continuous, discrete, and mixed versions of the Fourier transform and
Fourier series.

Second, two opposite-phase sinusoids SHOULD cancel each other.  Have you
ever played a wind instrument?  While tuning, the rhythmic beating of the
blended sound of two horns is the result of the sinusoids going in and out of
phase. When the beating stops, you are in tune (same frequency).  If you are
more careful, you can play a long note to be both in tune and in phase with 
another player (w.r.t. a particular point in space), so that the volume of 
the summed sound waves of your two horns is near maximal.  Of course, there
are harmonics generated in the horn and the phase difference of the fundamental
depends on the position of the instruments and the listener and the room 
acoustics, but my basic tenent remains that the sound pressure levels 
generated by each instrument can be algenraically summed to give the sound 
which would be produced by the instruments playing together.

This brings up another question:  How linear is the compression of air?
Suppose you record each instrument in an orchestra individually from a
microphone at some fixed location, say on the conductor's podium.  You then
add all the recordings thus made to produce a recording of the full orchestra.
How does this compare to recording the orchestra all at one time, assuming a
noise-free environment and a perfectly duplicated performance?  If air 
compresses linearly, the two recordings should be the same.  But I could 
imagine a "saturation" effect, for instance in the air around the piccolo 
section, which might cause a change in the frequency response for some 
instruments when played together.  My guess is that this effect would
require many atmospheres of sound pressure, since PV=nRT (the natural gas law)
seems to work for any easily achievable pressure.  Thus the volume would be 
far beyond the injury threshold for anyone nearby.  But do I recall that 
at LOW pressures (as in the rarefaction waves that accompany compression
waves) gases behave nonlinearly?  Perhaps someone can enlighten me on the 
physical limits of sound production.

Tim Davis
tldavis@mit.edu

james@phred.UUCP (JAMES Taylor) (06/08/90)

In article <wilf.644264995@endor> wilf@sce.carleton.ca (Wilf Leblanc) writes:
>
>
>The problem of combining samples is really a
>problem of rate conversion (as was discussed
...  Would any one have a good 
>reference on this topic ??
>
>---
><wilf@sce.carleton.ca>
>W.P. LeBlanc             |     I don't think, therefore,
>                         |     I am not.


Perhaps one of the best references I've seen is a book (about to be published?)
by Dr Robert J. Marks II:

"Shannon Sampling and Interpolation Theory I: Foundations".

This book was written for a class in Shannon sampling at the University of Washington
Electrical Engineering department.  Try 
marks@blake.acs.washington.edu
for more information, although I don't know whether that email address remains good.
The book had been completed, and was in it's final rounds with the publisher last
fall, so it may now be available. 

bdb@becker.UUCP (Bruce Becker) (06/09/90)

In article <1990Jun6.170458.25618@athena.mit.edu> tldavis@athena.mit.edu (Timothy L. Davis) writes:
|In article <48870@seismo.CSS.GOV> black@beno.CSS.GOV (Mike Black) writes:
|>I always though combining two samples was not possible in the time domain.
|>If you add two opposite phase sine waves you'll get a null response.  It's
|>necessary to do a Fourier Transform to the frequency domain, add the 
|>amplitudes, and invert the transform.  This will give you twice the amplitude
|>of the original two sine waves (this would seem to be the desired effect).
|>Am I totally off-base in this rather long-held belief?
|>Mike...
|
|I'm afraid you are, Mike.  First of all, the Fourier transform is a linear
|operator: F[a x(t) + b y(t)] = a F[x(t)] + b F[y(t)]. Thus adding in the 
|frequency domain has the same result as adding in the time domain.  Linearity
|holds for continuous, discrete, and mixed versions of the Fourier transform and
|Fourier series.
|
|Second, two opposite-phase sinusoids SHOULD cancel each other.  Have you
|ever played a wind instrument?  While tuning, the rhythmic beating of the
|blended sound of two horns is the result of the sinusoids going in and out of
|phase. When the beating stops, you are in tune (same frequency).  If you are
|more careful, you can play a long note to be both in tune and in phase with 
|another player (w.r.t. a particular point in space), so that the volume of 
|the summed sound waves of your two horns is near maximal.  Of course, there
|are harmonics generated in the horn and the phase difference of the fundamental
|depends on the position of the instruments and the listener and the room 
|acoustics, but my basic tenent remains that the sound pressure levels 
|generated by each instrument can be algenraically summed to give the sound 
|which would be produced by the instruments playing together.

	In yet another instance of the interplay of art
	and technology, I recommend you investigate the 
	work "Still and Moving Lines of Silence in
	Families of Hyperbolas", by Alvin Lucier.

	This piece, composed in 1983, is recorded on
	an album of the same name, on Lovely Records.

	A quote from the record jacket:

	"Still and Moving Lines of Silence in
	Families of Hyperbolas is based
	upon interference phenomena
	between two or moresound waves.
	When closely tuned musical tones
	are sounded, audible beats - bumps
	of loud sound produced as the
	sound waves coincide - occur at
	speeds determined by the difference
	between the pitches of the tones.
	The larger the difference, the faster
	the beating. At unison, bo beating
	occurs. Furthermore, if each tone
	originates from a separate source,
	the beats spin in elliptical patterns
	through space, from the higher
	source to the lower one."

-- 
  ,u,	 Bruce Becker	Toronto, Ontario
a /i/	 Internet: bdb@becker.UUCP, bruce@gpu.utcs.toronto.edu
 `\o\-e	 UUCP: ...!uunet!mnetor!becker!bdb
 _< /_	 "I still have my phil-os-o-phy" - Meredith Monk