         SweepGen - An Audio Sweep Generator - David J Taylor

SweepGen turns a PC into an Audio Oscillator and Sweep Generator which can be 
used for testing audio or educational purposes.  In conjunction with audio 
test instruments, you can make frequency response plots.  SweepGen uses the 
sound card in your PC to produce sinewaves that are mathematically correct 
almost to CD quality, indeed it's more likely that the quality of your PC 
sound card will be the limiting factor rather than the code in SweepGen.  


Installation & Usage:

Extract SweepGen.exe from the Zip file to a suitable location, and run it! 

The program source is provided in other Zip files in the archive.  From 
version 2.2.4, SweepGen will save the current settings in the registry each 
time a sweep is started, thus allowing you to save personalised settings.


Support Policy:

This program is currently freeware, but you must register for any support.  
As an incentive to register, you will be able to save the wave file produced
by the program in the registered version.  Use the Help, Register menu to
enter the registration details you will get from me.  For details about how 
to register, please see:

  www.satsignal.net  =>  Audio Tools


Runtime library:

If you don't already have Borland's run-time library, vcl50.bpl you will also 
need to download it.  See:

  www.satsignal.net  =>  Software, Runtime libraries

Extract the file VCL50.BPL from this archive and copy to your Windows System
folder (e.g. \Windows\System or \WinNT\System32).  


Operating modes:

SweepGen has six operating modes: fixed frequency (with no sweep), manual 
sweep, white noise, a slow single sweep lasting about 45 seconds (adjustable) 
intended for recording onto tape for subsequent replay and analysis, and a 
fast sweep lasting about 0.75 seconds intended for use with an oscilloscope 
for direct analysis of a circuit or to show the effect of any tone controls 
on your audio board.  

The fixed frequency and noise modes produce a continuous output, with the 
noise actually being a sound lasting about 1.3 seconds that is repeated 
indefinitely, giving the impression of continuous noise.  White noise has a 
uniform distribution of energy across the frequency range.

In the slow sweep mode, there is an option to momentarily mute the output 
around half-octave boundaries (e.g. from 255 to 257 Hz) so that you can 
determine the approximate frequency of any peak or trough without having to 
continually monitor the display.  The frequency of the last marker is noted.

In the fast sweep mode, there is a choice between a continuous or stepped 
change of frequency, the steps allowing easier discrimination on the 'scope.  
There is a 3:1 duty cycle to allow the 'scope to retrace and retrigger.  To 
make the sound audibly better, the click caused by the suddent start and stop
of the sound can be virtually eliminated by turning on the Declick check box
(next to the fast sweep mode radio buttons).

In both sweep modes, the sweep may be linear or logarithmic in frequency, with 
log being more suitable for examining a broad frequency response and linear 
more suitable for narrow band filters.

In manual sweep mode there are two methods to alter the frequency.  

  Method 1.  Ensure that the Stop/Start button has the focus, and then use the 
Page Down and Page Up keys to control the direction and activation of the 
sweep.  Because of the double-buffering used to keep the sound card busy, 
there will be a slight delay between releasing either key and the sweep 
stopping.  Starting and stopping the generator with the Start/Stop button 
will ensure that it has the focus.  This method suits someone who wishes to 
hold down a key for continuous, smooth frequency change.

  Method 2.  Ensure the trackbar (slider-like control) has the focus.  You can 
then either drag the slider, or use the Page Down/Page Up, or Down Arrow and 
Up Arrow keys to change frequency.  This method is quicker if you wish to 
manually sweep a frequncy range looking for resonances.  Because the TrackBar 
control can queue up several key presses to process at one time, you must 
"peck" at the keys for each change of frequency rather than holding them down 
continuously.

With method 2, you can also uncheck the "Lock L + R frequencies" checkbox to 
obtain independent frequency control for left and right channels.


Frequency ranges:

You can program any frequency range you want into Sweep, but if you make the 
maximum less than the minimum, you'll only get one frequency!  There is no 
check against programming a frequency in excess of 22.05KHz, so you can 
observe the effects of aliasing.

  For convenience, there are four preset frequency ranges called:

      wide:   20Hz .. 20KHz        hf:   1KHz .. 15KHz
    speech:  300Hz .. 3KHz         lf:   50Hz .. 1KHz


Output levels:

SweepGen has a choice of fixed output levels selectable from 0dB to -26dB in 
1dB steps.  There will be a brief delay between selecting a new output level 
and the actual output changing since, the internal sinewave lookup table has 
to be recomputed, the output buffers refilled, and sent to the Wave device.  
There is also a deliberate delay to avoid many quick changes being processed 
since this is aurally rather distracting.


Output phase:

There are three modes of output operation.  Normally, both left and right 
channels are indentical, i.e. in-phase.  Optionally, you can make the channels 
out-of-phase which can be useful for checking the relative phase of a pair of 
loudspeakers.  If the two speakers are out of phase, there will be less low-
frequency output.  The channels option allows you to hear this effect 
directly.  The third output mode provides for independent control of channel 
amplitude.  The program does not provide a mono-summed mode where two different 
frequencies at different amplitudes are fed equally to each channel.


Release History:

V3.1.0  2001 Jul 16  Version for Delphi 5
                     Support more wave output devices

(Earlier release notes are in the file History.txt}


Notes:

The program is written for Borland's Delphi 4.0, and most source is included.  
You do not need access to Delphi 4.0 to run SweepGen, but you WILL need sound 
hardware on your PC capable of full CD sampling rate operation (i.e. 16-bit, 
stereo, 44.1KHz - such as SoundBlaster 16 or later).  If SweepGen cannot open 
that audio format it will complain.  I have seen some cards sold as 16-bit 
that only actually offer 12-bit performance.  The program runs on Windows 95 
and Windows NT 4.0.

To measure your sound card itself, you may also find it helpful to have a CD 
with a white-noise or frequency sweep source.  Two I have discovered are:

  Denon, Audio Technical CD 38C39-7147, 1984-5
  (includes white noise, but perhaps not now available?)

  Soundcheck Productions, Sound Check Alan Parsons & Stephen Court, 1993
  available as RS number 245-376,  Soundcheck tel: UK +44 1753 833524
  (pink noise plus many other signals and test tracks)

You may also want a sound editing program that is rather more capable than the 
Sound Recorder included with Windows.  David Johnston's Cool Edit is low cost 
and includes some spectral analysis capability.  Contact sales@syntrillium.com 
or see their Web site for a demo copy.


Acknowledgements:

TVersionInfoResource is from Brad Stowers
  http://www.pobox.com/~bstowers/delphi/
  Copyright bstowers@pobox.com (CompuServe 72733,3374)

magyar@krusty.eaglequest.com suggested the markers and manual sweep mode
(name lost) suggested the track bar frequency control
Goran Hjalmarsson (and others) suggested the dual-channel output
Brad Stowers (bstowers@pobox.com) provided the Version Info routine
Bryan Timms suggested the custom sweep range and duration
Chris Coleman requested the removal of clicks with low frequency sweeps


Reference:

A book that I have found invaluable on digital audio is:

  The Art of Digital Audio, 2nd edition, 1994
  John Watkinson
  Focal Press (an imprint of Butterworth-Heinemann Ltd)
  ISBN 0 240 51320 7


+-------------------------- SAFETY NOTICE ----------------------------+
| Playing a continuous tone at a high level can damage your amplifier,|
| speakers, or hearing.  Please exercise sensible precautions!        |
+---------------------------------------------------------------------+

Program Status & Distribution:

This program is freeware and remains copyright of David J Taylor, Edinburgh, 
1994-2000.  This program is provided "as is", without any support.  Whilst I 
cannot promise to answer queries relating to the use of this program, I'd 
welcome any comments or suggestions for improvements you may have.  Requests 
for distribution must be referred to the author, but will usually be granted 
if no commercial gain is involved.


Contacting the author:

Web site:  http://www.davidtaylor.freeserve.co.uk
E-mail:    davidtaylor@writeme.com
2001 Jul 16
