Forums

Mixing with a 3000Hz tone @ 8000 sampling rate

Started by Shafik August 29, 2005
Hello folks,

I think this problem was addressed before but it wasnt quite solved. I
have a system running at 8000Hz sampling rate. I need to mix (multiply)
my incoming sampling signal with a 3000Hz tone.

The problem is, 3000 is not a nice division of 8000. Hence the samples
produced dont quite generate a "clean" 3000Hz, and I end up getting
artifacts.

Stepping through a sine table at the required rate, gives a waveform
like the following:

0, 0.707, -1, 0.707, 0, -0.707, 1, -0.707, 0, etc...

Is there ANY way this could be done properly without oversampling the
signal in the first place?


Thanks a lot,
--Shafik

Shafik,

Multiplying by 3000Hz shouldn't create what I would call artifacts.  It will 
cause a mapping of input frequencies to different output frequencies in such 
a way as to cause confusion if you don't filter, specifically it will 
wrap/alias some frequencies past the half sample point.  You need to tell us 
what input frequencies you wish to map to what output frequencies.

David Covington

"Shafik" <shafik@u.arizona.edu> wrote in message 
news:1125347706.785323.28940@o13g2000cwo.googlegroups.com...
> Hello folks, > > I think this problem was addressed before but it wasnt quite solved. I > have a system running at 8000Hz sampling rate. I need to mix (multiply) > my incoming sampling signal with a 3000Hz tone. > > The problem is, 3000 is not a nice division of 8000. Hence the samples > produced dont quite generate a "clean" 3000Hz, and I end up getting > artifacts. > > Stepping through a sine table at the required rate, gives a waveform > like the following: > > 0, 0.707, -1, 0.707, 0, -0.707, 1, -0.707, 0, etc... > > Is there ANY way this could be done properly without oversampling the > signal in the first place? > > > Thanks a lot, > --Shafik >
On Mon, 29 Aug 2005 15:45:49 -0500, "David Covington" <cdc@nwark.com>
wrote:

>Shafik, > >Multiplying by 3000Hz shouldn't create what I would call artifacts. It will >cause a mapping of input frequencies to different output frequencies in such >a way as to cause confusion if you don't filter, specifically it will >wrap/alias some frequencies past the half sample point. You need to tell us >what input frequencies you wish to map to what output frequencies.
That's good and necessary info (3000 and 1600 would generate 3000-1600=1400 (which is fine) and 3000+1600=4600 which in this system, sampled at 8000, would come out as 3400), but it appears he's not at that point yet.
> >David Covington > >"Shafik" <shafik@u.arizona.edu> wrote in message >news:1125347706.785323.28940@o13g2000cwo.googlegroups.com... >> Hello folks, >> >> I think this problem was addressed before but it wasnt quite solved. I >> have a system running at 8000Hz sampling rate. I need to mix (multiply) >> my incoming sampling signal with a 3000Hz tone. >> >> The problem is, 3000 is not a nice division of 8000. Hence the samples >> produced dont quite generate a "clean" 3000Hz, and I end up getting >> artifacts.
What frequencies are these artifacts? For a system sampled at 8000 Hz, the system output must be low-pass filtered at (or below) 4000 Hz. Any artifacts above 4000 Hz are not a problem.
>> Stepping through a sine table at the required rate, gives a waveform >> like the following: >> >> 0, 0.707, -1, 0.707, 0, -0.707, 1, -0.707, 0, etc... >> >> Is there ANY way this could be done properly without oversampling the >> signal in the first place?
You seem to be questioning the validity of those data points. Offhand, they fully represent a 3000 Hz sine wave in a system sampled at 8000 Hz. If you're going to be generating sum or difference tones that exceed 4000 Hz, then you do need to do generation at a higher sample rate, then downsample.
>> >> >> Thanks a lot, >> --Shafik >> >
----- http://www.mindspring.com/~benbradley
Ben Bradley wrote:

(snip regarding multiplying of sines and sampling rates)

> You seem to be questioning the validity of those data points. > Offhand, they fully represent a 3000 Hz sine wave in a system sampled > at 8000 Hz.
> If you're going to be generating sum or difference tones that > exceed 4000 Hz, then you do need to do generation at a higher sample > rate, then downsample.
You mean and then filter out the sum? I didn't do all the math, but can't you just generate the difference signal without the sum? sin(A-B)=sin(A)cos(B)-cos(A)sin(B) I think it depends on what the output really should be, though. If it really needs the sum then it needs a higher sampling rate. -- glen
Are you trying to mix the frequencies around 3000 Hz to 0 Hz? If not,
what are you trying to do (detail)?

Dirk

glen herrmannsfeldt wrote:
> Ben Bradley wrote: > > (snip regarding multiplying of sines and sampling rates) > >> You seem to be questioning the validity of those data points. >> Offhand, they fully represent a 3000 Hz sine wave in a system sampled >> at 8000 Hz. > > >> If you're going to be generating sum or difference tones that >> exceed 4000 Hz, then you do need to do generation at a higher sample >> rate, then downsample. > > > You mean and then filter out the sum? > > I didn't do all the math, but can't you just generate the difference > signal without the sum? > > sin(A-B)=sin(A)cos(B)-cos(A)sin(B)
That assumes that you have analytic expressions. Usually, you have only samples which can be multiplies. The product then contains both sum and difference.
> I think it depends on what the output really should be, though. > If it really needs the sum then it needs a higher sampling rate.
Jerry -- Engineering is the art of making what you want from things you can get. &#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;
I guess I wasnt specific about what Im trying to do.

Im trying to simply do a voice spectral inversion. I sample the voice
at 4000Hz, I use an FIR filter to remove everything over 3000Hz, then I
multiply with a 3000Hz tone to invert, then filter again to remove the
upper side band.

The problem is, Im getting inverted audio ALONG with some of my
original, non-inverted input voice. That is what I meant by artifacts.

When I repeat the same process with a 2000 or 4000 Hz (i.e. a "nice"
divisor of 8000Hz), the problem does NOT occur.

Any more thoughts?
--Shafik

In comp.dsp,
Shafik <shafik@u.arizona.edu> wrote:
> >Im trying to simply do a voice spectral inversion. I sample the voice >at 4000Hz, I use an FIR filter to remove everything over 3000Hz, then I >multiply with a 3000Hz tone to invert, then filter again to remove the >upper side band. >
Shouldn't you have already removed everything above 2000Hz before sampling at 4000Hz? -- Stef (remove caps, dashes and .invalid from e-mail address to reply by mail) Now and then an innocent man is sent to the legislature.
A quick guide.

Decide on a lower audio frequency limit you can tolerate, fl (maybe 300
Hz?), and an upper audio frequency limit you can tolerate (around 3000
Hz), fh. Complex mix your signal by -(fl+fh)/2.  Lowpass filter the
real and imagnary parts with a filter with a stopband that cuts off
near (fl+fh)/2. Complex mix your signal using a frequency more negative
than -(fl+fh)/2.  Take the real part. Listen to it. Should not sound
good (scrambled). Experiment with the frequency of the second mix. Be
aware that if you transmit this over analog lines that they will filter
the signal, which MAY remove the original LF audio components now at
signal HF.

On the receiver, do a similar, but inverse process.

Don't do this with a real mixer.

Dirk

Stef wrote:
> In comp.dsp, > Shafik <shafik@u.arizona.edu> wrote: > > > >Im trying to simply do a voice spectral inversion. I sample the voice > >at 4000Hz, I use an FIR filter to remove everything over 3000Hz, then I > >multiply with a 3000Hz tone to invert, then filter again to remove the > >upper side band. > > > Shouldn't you have already removed everything above 2000Hz before > sampling at 4000Hz? > > -- > Stef (remove caps, dashes and .invalid from e-mail address to reply by mail) > > Now and then an innocent man is sent to the legislature.
PS. As Stef pointed out, I assume you are really sampling at 8000 Hz.

Dirk