diyAudio (
-   Equipment & Tools (
-   -   Tone Generator - Multiple Tones and Variable Amplitude (

percy 16th November 2007 11:58 PM

Tone Generator - Multiple Tones and Variable Amplitude
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!


jcx 17th November 2007 01:30 AM

if you intend to use a sound card fs/2 will be just one limit, even 192K cards may not put out much at 92KHz because of digital filters internal to the ADC chips often set at 0.4*fs

LtSpice, SciLab are 2 freeware options that can create .wav files
Audacity can play/record - although I've seen dropouts at 192KHz

percy 17th November 2007 05:02 AM

brain fart...when I wrote 92khz I wanted to write 96khz but was thinking 192khz.
for now anything that behaves well at 96khz should serve the purpose.

jcx 17th November 2007 10:39 PM

actually I should have written ADCs and DACs - on soundcards both are typically oversampling internally and have digital filtering below fs/2 built in

you will have 0 output in any sampled system at fs/2 = 96 KHz with a 192K soundcard

percy 18th November 2007 04:23 PM

well I could get ETG (expression tone generator) and GoldWave to generate complex tones at a 96Khz sample rate. Basically they both have expression evaluators so lots of flexibility on the type of signal you want to create. But there's one problem -

I see distortion when I do a spectrum analysis of the resulting wav file. (fft of the just the static wav file, not by playing/recording the signal). I was expecting that when I generate a 1Khz sine tone, all I would see in the fft is one fundamental at 1Khz and nothing else but instead I see harmonics at 3khz, 5khz,.. I noticed this happens is in both GW and ETG.

What could cause this ? My only guess is insufficient precision in the sinusoidal function used to compute the sample values ?? Is that possible ?

p.s.:- I haven't tried Ltspice or Scilab, but do you think they have what I want ?

jcx 18th November 2007 07:28 PM

I'd expect most packages to work equally well within some limits: the quantization will give some distortion content ~ 1 bit amplitude level - and windowing issues with the fft can give apparent "spurs" from spectral spreading if you don't use exact integer fundamental cycles in your ftt

it's possible that biased rounding or other math error could contribute too but for 16 bit resolution, 32 bit math should be OK

at 24 bits the math may need to be 64 bit

jcx 19th November 2007 04:23 AM

It appears some people can mess up truncation/rounding - LtSpice has a problem with 16 bit wav files, not 8 or 24!
Mike's usually fast with fixes - I hope this is cleared up by the next release (sometimes weekly)

I guess other tools could have similar problems - always verify, correct numerical implementations really follow the theory to a fine degree

jcx 20th November 2007 04:52 AM

LtSpice 16bit wav functions now fixed v2.22c - that was quick

AndrewT 22nd November 2007 03:48 PM

If I'm right to think that all digital signals start as square waves added together to form an approximation of a sinewave then there must always be measurable distortion of the filtered output signal.
The higher the sinewave frequency, the fewer squarewaves to approximate the wave shape, the worse the distortion.
The lower the level, the fewer steps available for each increment of voltage and again the worse the distortion.

It seems that all HF signals generated digitally must by design have significant distortion that worsens as the Fs/2 limit is approached.

I cannot see how 192kHz square waves can ever produce a 96kHz sinewave even with a high slope analogue filter hung on the end of the DAC.

Pan 22nd November 2007 04:10 PM

Andrew, it's the other way around. A square wave is made up of lots of sinewaves.


All times are GMT. The time now is 09:20 AM.

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

Content Relevant URLs by vBSEO 3.3.2