Tone Generator - Multiple Tones and Variable Amplitude - Page 2 - diyAudio
 Tone Generator - Multiple Tones and Variable Amplitude
 User Name Stay logged in? Password
 Home Forums Rules Articles diyAudio Store Gallery Wiki Blogs Register Donations FAQ Calendar Search Today's Posts Mark Forums Read Search

 Equipment & Tools From test equipment to hand tools

 Please consider donating to help us continue to serve you. Ads on/off / Custom Title / More PMs / More album space / Advanced printing & mass image saving
 22nd November 2007, 05:44 PM #11 diyAudio Member   Join Date: Apr 2004 Location: CA still haven't tried LTspice or Scilab but ended up writing a script to generate my own sine wave! I even wrote my own function to calculate sine based on taylor series. Its interesting how much precision (atleast 7 digits after the decimal point for 16 bit depth) is required to avoid rounding errors and take the precision upto or less than 1LSB. I have yet to add the file creation part to write to a pcm wav file. Once that is done I will know how much distortion there is in the produced wave, or lack thereoff. In v2.0, complex waves - ability to add harmonics with variable amplitude! I wonder if these packages, or the languages they are written in, have the kind of precision for these type of operations.
diyAudio Member

Join Date: Jul 2004
Location: Scottish Borders
Quote:
 Originally posted by Pan it's the other way around. A square wave is made up of lots of sinewaves.
not when the system (DAC) is trying to reconstruct an analogue signal (sinewave) from a digital datastream.

If you do breakdown a squarewave into it's components one finds that the harmonics go out to infinity. That is the problem. The digital datastream runs out of bits in the range of 44Ks/S to 192ks/S. I have seen it estimated that a good approximation to a squarewave can be reconstructed if all the harmonics up to the tenth are included in the signal. To reconstruct a reasonable 96kHz squarewave would require a bit rate of 1Ms/S or looked at from CD datarates it should be possible to get a 4kHz squarewave from the DAC. I suspect that even a 4kHz sinewave coming out of a CD DAC will show significant distortion.
Does anyone have any figures?
__________________
regards Andrew T.
Sent from my desktop computer using a keyboard

diyAudio Member

Join Date: Apr 2004
Location: CA
6 digits of precision(i.e. after the decimal point) and processing the sine series(taylor polynomial) up to the 9th degree is what you need in the least to create a sine wave with distortion buried in the noise floor.
Note that I did not say "without distortion". It is there, just not discernable.

I had been fooling around with creating a wav file of a pure tone and observing what kind of loss of precision generates what kind of distortion and thought I'd share some results with you.

It is a common belief that computing upto the 7th degree of the Taylor series for a sine function is a good enough approximation for a sine function.
Wrong. You need alteast one more degree i.e. upto 9th degree to achieve a sine wave which has very little distortion.

Here's a screen shot of the FFT of a 500hz sine wave produced with the sine function computing only upto the 7th degree -
Attached Images
 7.jpg (34.0 KB, 95 views)

diyAudio Member

Join Date: Apr 2004
Location: CA
and here's a screen shot of the FFT of a 500hz sine wave produced with the same sine function, but computing upto the 9th degree -

FFTs were done with the spectrum analyzer provided in RMAA 6 with a Kaiser window of atleast 15.

Attached Images
 9.jpg (35.0 KB, 92 views)

diyAudio Member

Join Date: Nov 2002
Location: Netherlands
Re: Tone Generator - Multiple Tones and Variable Amplitude

Quote:
 Originally posted by percy I am searching for PC based tone generator that will allow adding multiple tones with variable amplitude. For example, 1Khz at -3db, 2Khz at -40db, etc... Also it has to be capable of creating tones at 92Khz or higher also. Right now I have the NCH Tone Generator that has multiple tones and variable amplitude but unfortunately its fixed at 44.1Khz so can't add any frequency above Fs/2. Any help greatly appreciated! TiA!

Hi,

FYI, have also a look here: http://www.fesb.hr/~mateljan/arta/

It works with 192 kHz soundcards as well. The build-in sine generator can do dual tones with adjustable ratio quite accurate. Attached a picture of a loop through measurement of my USB soundcard at 44.1 kHz.

Attached Images
 dist_hub.png (10.0 KB, 71 views)

 20th December 2007, 02:17 PM #16 diyAudio Member   Join Date: Apr 2004 Location: CA I don't think it can save it to a wav file, does it ? I want a "generated" wav file, not a "recorded" wav file (to avoid introducing deficiences of the playback + recording chain).

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is OffTrackbacks are Off Pingbacks are Off Refbacks are Off Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post DouglasSelf Solid State 13 18th September 2013 07:54 PM Dogue Instruments and Amps 7 15th October 2008 11:22 PM percy Equipment & Tools 6 13th February 2008 12:08 AM xitronics Analog Line Level 0 16th October 2006 04:19 PM

 New To Site? Need Help?

All times are GMT. The time now is 06:14 PM.