"Shafik" <shafik@u.arizona.edu> wrote in news:1109131338.940829.231840
@f14g2000cwb.googlegroups.com:
> Memory is limited (300-500 bytes), and I can't do floating point.
>
> The signal needs to be 'clean' enough to modulate voice (Im using the
> generated tone as an inversion frequency).
>
>
> --Shafik
>
Generating a cosine wave is a very clean method. It will be as good as the
precision of the DAC and the cosine table. Sigma Delta DACs are very good
and often very inexpensive.
I would consider the possibility of doing the modulation in a DSP. In this
case, make sure that your cosine is very high precision. You may also want
to consider a frequency that is a little more "prime" to 8000. This will
tend to minimize spurs.
--
Al Clark
Danville Signal Processing, Inc.
--------------------------------------------------------------------
Purveyors of Fine DSP Hardware and other Cool Stuff
Available at http://www.danvillesignal.com
Reply by Jerry Avins●February 23, 20052005-02-23
Shafik wrote:
> Memory is limited (300-500 bytes), and I can't do floating point.
>
> The signal needs to be 'clean' enough to modulate voice (Im using the
> generated tone as an inversion frequency).
>
>
> --Shafik
Now, for the first time, you've told me that the problem is hard. I'll
think on it.
Jerry
--
Engineering is the art of making what you want from things you can get.
�����������������������������������������������������������������������
Reply by Shafik●February 23, 20052005-02-23
Memory is limited (300-500 bytes), and I can't do floating point.
The signal needs to be 'clean' enough to modulate voice (Im using the
generated tone as an inversion frequency).
--Shafik
Reply by Jerry Avins●February 22, 20052005-02-22
Shafik wrote:
> Sorry for the wait Jerry,
>
> I want to be able to, in real time, generate an arbitrary tone
> between 3000Hz and 4000Hz, accurate to within 50 Hz. "Real-time" in
> this case is 1/8000th of a second (sampling rate is 8Khz). Im running
> this on a 60MIP chip.
>
> The tone itself has to be clean, and that's why running through a table
> of cosines won't cut it.
>
> --Shafik
Ah, but if you have enough memory -- you haven't said how much -- it can
be as clean as you like. Does your chip do floating point?
Jerry
--
Engineering is the art of making what you want from things you can get.
�����������������������������������������������������������������������
Reply by john●February 22, 20052005-02-22
Shafik wrote:
> Sorry for the wait Jerry,
>
> I want to be able to, in real time, generate an arbitrary tone
> between 3000Hz and 4000Hz, accurate to within 50 Hz. "Real-time" in
> this case is 1/8000th of a second (sampling rate is 8Khz). Im running
> this on a 60MIP chip.
>
> The tone itself has to be clean, and that's why running through a
table
> of cosines won't cut it.
>
> --Shafik
A standard way to do it is to maintain a phase accumulator (non
saturating counter) that increments by 2^n * Fosc/8000 on every sample,
where n is the number of bits in the phase accumulator (16 might be
fine for your situation). On each sample period, calculate sin and cos
of the phase accumulator using one of a couple of methods:
1. Direct calculation of sin and cos using a power series. Free
routines are available from DSP vendors.
2. Table lookup, with table size 2^b. If the table holds a full cycle,
the top b bits of the accumulator give the index into the table. Offset
by 2^b/2 to for sine, 3*2^b/2 for cos. A 256 word table might suffice.
It all depends on how the required SFDR and SNR of the tones.
John
Reply by Steve Underwood●February 22, 20052005-02-22
Hi Shafik,
What does "clean" mean? -150dB spurious free? -5dB spurious free? On its
own "clean" is meaningless.
Direct digital synthesis (DDS) is the usual term for properly
implemented cosine table method of generating arbitrary tones. Even a
modest sized table will give a pretty low noise floor and close in phase
noise. Purity constraints in RF applications are demanding, and they
usually use DDS.
Generating tones by pure calculation can also work, and doesn't require
a lot of computation. However, you have to take great care that your
oscillator is unconditionally stable. They have a nasty tendancy to
drift in amplitude over time, due to limited precision in the
calculations. Adding a little more computation can AGC the level, but
careful testing is recommended.
It seems like you don't need an arbitrary tone generator. You said 50Hz
steps are good enough. That means you only need to generate 21 different
tones.
Regards,
Steve
Shafik wrote:
>Sorry for the wait Jerry,
>
> I want to be able to, in real time, generate an arbitrary tone
>between 3000Hz and 4000Hz, accurate to within 50 Hz. "Real-time" in
>this case is 1/8000th of a second (sampling rate is 8Khz). Im running
>this on a 60MIP chip.
>
>The tone itself has to be clean, and that's why running through a table
>of cosines won't cut it.
>
>
Reply by Shafik●February 22, 20052005-02-22
Sorry for the wait Jerry,
I want to be able to, in real time, generate an arbitrary tone
between 3000Hz and 4000Hz, accurate to within 50 Hz. "Real-time" in
this case is 1/8000th of a second (sampling rate is 8Khz). Im running
this on a 60MIP chip.
The tone itself has to be clean, and that's why running through a table
of cosines won't cut it.
--Shafik
Reply by Jerry Avins●February 22, 20052005-02-22
Al Clark wrote:
> "Shafik" <shafik@u.arizona.edu> wrote in news:1109017983.530895.240980
> @z14g2000cwz.googlegroups.com:
>
>
>>Hello folks,
>>
>> Suppose Im sampling at 8khz. To generate a 4khz tone, its easy, just
>>generate alternating 1,-1,1,-1, etc... To generate a 2khz tone, its
>>also easy.
>>
>>How can one generate a rational fraction of the nyquist freq? I want to
>>able to generate 3.333khz while sampling at 8khz.
>>
>>Any ideas? This method needs to be very computationally cheap, or else
>>its useless in this context.
>>
>>Thanks,
>>--Shafik
>>
>
>
> Generate a cosine table with 2Pi/12 spacing (every 30 degrees).
> Step thru the table by 5. This will give you 3333Hz since (8000/12)*5 =
> 3333.33
>
> I have an article on our web site:
>
> http://www.danvillesignal.com/files/article_signal_generation.pdf
The OP hasn't yet given us his time and memory constraints. When he
does, I'll try to suggest specific solutions to fit them. When I shoot
in the dark, I more often than not miss the target.
Jerry
--
Engineering is the art of making what you want from things you can get.
�����������������������������������������������������������������������
Reply by Al Clark●February 22, 20052005-02-22
"Shafik" <shafik@u.arizona.edu> wrote in news:1109017983.530895.240980
@z14g2000cwz.googlegroups.com:
> Hello folks,
>
> Suppose Im sampling at 8khz. To generate a 4khz tone, its easy, just
> generate alternating 1,-1,1,-1, etc... To generate a 2khz tone, its
> also easy.
>
> How can one generate a rational fraction of the nyquist freq? I want to
> able to generate 3.333khz while sampling at 8khz.
>
> Any ideas? This method needs to be very computationally cheap, or else
> its useless in this context.
>
> Thanks,
> --Shafik
>
Generate a cosine table with 2Pi/12 spacing (every 30 degrees).
Step thru the table by 5. This will give you 3333Hz since (8000/12)*5 =
3333.33
I have an article on our web site:
http://www.danvillesignal.com/files/article_signal_generation.pdf
--
Al Clark
Danville Signal Processing, Inc.
--------------------------------------------------------------------
Purveyors of Fine DSP Hardware and other Cool Stuff
Available at http://www.danvillesignal.com
Reply by Clay S. Turner●February 21, 20052005-02-21
> Does it have to be a sine wave? If so, Clay Turner has a good paper. It
> used
> to be here:
> http://personal.atl.bellsouth.net/p/h/physics/oscpaper.pdf, but it appears
> to
> have moved. Clay often posts here, so perhaps he can give us the new
> link.
>
> You can also use a look-up table. The more memory you have, the better
> the
> quality (lower distortion for a sinewave). You can improve the quality by
> using
> interpolation, but at the cost of extra computations.
>
> "Shafik" <shafik@u.arizona.edu> wrote in message
> news:1109017983.530895.240980@z14g2000cwz.googlegroups.com...
>> Hello folks,
>>
>> Suppose Im sampling at 8khz. To generate a 4khz tone, its easy, just
>> generate alternating 1,-1,1,-1, etc... To generate a 2khz tone, its
>> also easy.
>>
>> How can one generate a rational fraction of the nyquist freq? I want to
>> able to generate 3.333khz while sampling at 8khz.
>>
>> Any ideas? This method needs to be very computationally cheap, or else
>> its useless in this context.
>>
>> Thanks,
>> --Shafik
>
>