Tone Generator - Multiple Tones and Variable Amplitude - Page 2 - diyAudio
Go Back   Home > Forums > Design & Build > Equipment & Tools
Home Forums Rules Articles diyAudio Store Gallery Wiki Blogs Register Donations FAQ Calendar Search Today's Posts Mark Forums Read

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
Thread Tools Search this Thread
Old 22nd November 2007, 05:44 PM   #11
percy is offline percy  United States
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.
  Reply With Quote
Old 23rd November 2007, 08:02 AM   #12
AndrewT is online now AndrewT  Scotland
diyAudio Member
Join Date: Jul 2004
Location: Scottish Borders
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
  Reply With Quote
Old 17th December 2007, 09:05 PM   #13
percy is offline percy  United States
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
File Type: jpg 7.jpg (34.0 KB, 97 views)
  Reply With Quote
Old 17th December 2007, 09:06 PM   #14
percy is offline percy  United States
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
File Type: jpg 9.jpg (35.0 KB, 94 views)
  Reply With Quote
Old 19th December 2007, 06:25 PM   #15
diyAudio Member
Pjotr's Avatar
Join Date: Nov 2002
Location: Netherlands
Default Re: Tone Generator - Multiple Tones and Variable Amplitude

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!



FYI, have also a look here:

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
File Type: png dist_hub.png (10.0 KB, 72 views)
  Reply With Quote
Old 20th December 2007, 02:17 PM   #16
percy is offline percy  United States
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).
  Reply With Quote


Hide this!Advertise here!
Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Amplitude and frequency distributions wanted DouglasSelf Solid State 13 18th September 2013 07:54 PM
Pressure sensor to control amplitude Dogue Instruments and Amps 7 15th October 2008 11:22 PM
Why do sweep signals have progressively decreasing amplitude ? percy Equipment & Tools 6 13th February 2008 12:08 AM
Audio Signal Amplitude Levels..? xitronics Analog Line Level 0 16th October 2006 04:19 PM

New To Site? Need Help?

All times are GMT. The time now is 10:06 AM.

vBulletin Optimisation provided by vB Optimise (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
Copyright 1999-2017 diyAudio

Content Relevant URLs by vBSEO 3.3.2