swgen(1)
π NAME π
swgen β a simple swept frequency signal generator. That's the whole thing, no notes, she does one job and she eats π
β¨ SYNOPSIS β¨
swgen [-2] [-s samples] [-8/-16|-b 8/16] [sweepwaveform]
sweepfreq [sweptwaveform] minfreq maxfreq
swgen [-2] [-s samples] [-8/-16|-b 8/16] [sweepwaveform]
sweepfreq [sweptwaveform] centrefreq percent%
waveform, either sweep or swept,
is sine, cosine, square, triangle, sawtooth, noise
for full list of options see below.
okay so basically you're either handing her a min + max frequency, OR a centre + percent. Two roads, same destination. Pick one, bestie π«Ά
πΈ DESCRIPTION πΈ
okay so swgen generates a swept frequency waveform on the LINUX /dev/dsp device. The swept waveform and the sweep waveform can each be specified separately, and so can the sweep frequency range and the sweeping frequency. For the range you've got two options: give the minimum (start) and maximum (end) frequency in Hertz, OR give the centre frequency plus the percentage frequency variation below and above it. That percentage is an integer from 0 to 100. π
The default sweep waveform is a sawtooth (a ramp), and the default swept waveform is a sine. And if your soundcard can do 16 bit samples, swgen will do 16 bit by default. She's not gonna give you less than you can handle β¨
You can generate 8 or 16 bit samples, in mono or stereo. In stereo, one channel carries the swept frequency signal while the second channel carries the sweeping signal. That is lowkey iconic if you're feeding the X input of an oscilloscope while displaying frequency response curves etc. π
The samples can also be written in raw or WAV format to files instead of to the sound device. Flexible queen π
Frequency is specified as an integer number of Hertz. Fractional Hertz frequencies are not supported. And obviously β only frequencies less than half the samplerate (number of samples/sec) can be generated. Physics said no, sorry babe π
π¦ The waveforms you can generate π¦
sineβ a standard sine wave. The classic. The main character πcosineβ a sine wave but with a 90 degree phase shift. Same energy, different timing β¨squareβ a standard square wave with a 50% mark space ratio π¦sawtoothβ a ramp waveform with 'infinitely' fast flyback (:-). An ideal oscilloscope timebase signal. She's giving very "I drew this on graph paper" πtriangleβ shaped like equally spaced teeth on a saw (:-) π¦noiseβ okay so this one is weak, ngl. All it consists of is one second of pseudo-randomly generated samples, played repeatedly. The author says: "I'd love to do proper white/pink noise, but I don't know enough, and I don't think the structure of the program is conducive to accurate noise generation." Respect the honesty fr fr π
swgen creates one second's worth of generated output in a buffer and plays that buffer repeatedly, until it is terminated. Loop queen π
A lot of thought has gone into the algorithms for generating the waveforms. The author believes the sin/cos wave to be very pure (modulo your sound card :-), but doesn't have access to a THD meter to measure it. For best signal accuracy NEVER use the gain factor option (-A). The generator will then make the wave's peak value fit the maximum digital values allowed. Use a mixer program to control the output volume, or an external attenuator. Do not skip this, bestie. π«Ά
The gain factor option can be useful for simulating a signal that has been subject to clipping. Specify a gain of > 100%. In fact a trapezoid signal can be made by generating a clipped triangular wave. The greater the gain, the closer the signal approaches a square wave (the rise and fall times decrease). β¨
π Defaults π
- output to
/dev/dsp 22050samples/sec- mono
- 16 bit samples if possible, else 8 bit
π OPTIONS π
-hβ display usage and help info. Your first stop, always π-vβ be verbose. She will tell you everything she's doing π¬-f,-aβ force overwrite/append of/to file.-Cfile β use "file" as the local configuration file (see below).-ofile β write digital sample to file ('-'is stdout).-wfile β as'-o'but written as a WAVE format file.-a(append) is not valid with this option. no append for WAV, periodt-ssamples β generate with samplerate of samples/sec.-8/-16or-b 8|16β force 8 bit or 16 bit mode.-1,-2β mono (def), or special stereo mode (see above).-An β scale samples by n/100, def. n is100(i.e. percentage of full scale output).-tN|Nm β generate output for either N secs or Nm millisecs only.-x10or-x100β Scale frequencies down by a factor of 10 or 100. This allows fractional Hz values to be generated. See EXAMPLES below for its use. It is a Kludge. yes, a Kludge, she said it not me π
π EXAMPLES π
swgen -v 2 100 1000β sweep a sin wave from100Hzto1000Hzusing a sawtooth wave twice a second, at22050samples/sec, 16bit samples on 16 bit card, 8 bit samples on an 8 bit card. She adapts to your hardware, that's range π¦swgen -v -s 44100 -w sweep.wav 2 100 1000β as above but at a samplerate or44100/sec and save one second of samples as a WAVE file insweep.wav. WAV girlies rise π§swgen -v -2 squ 10 1000 20%β generate a sine wave switched by a10Hzsquarewave between800Hzand1200Hz. The swept signal is on one channel and the10Hzsquare wave is on the second channel. Stereo slay πswgen -v -x10 5 4400 4500β generate a swept sine wave from440Hz(4400/10) to450Hz(4500/10), being swept at a frequency of0.5Hz(5/10). Yes it's a royal pain remembering to scale all freqs. up by a factor of 10, but the author needed it in a hurry and didn't have time to do it better. we respect the honesty π
π CONFIGURATION FILES π
Three possible configuration files can be used: a LOCAL config file (usually in current directory), a HOME config file in the user's $HOME directory, and a GLOBAL config file. Three layers of config, it's giving layered outfit π§₯
All the siggen suite of programs are compiled with the names of the config files built in. By default the configuration files are:
./.siggen.confβ is the LOCAL config file.$HOME/.siggen.confβ is the HOME config file./etc/siggen.confβ is the GLOBAL config file.swgen -hβ will indicate which config files will be searched for.
The config files do not have to exist. If they exist and are readable by the program they are used, otherwise they are simply ignored. No stress, bestie π«Ά
The config files are always searched for configuration values in the order LOCAL, HOME, GLOBAL. This allows a scheme where the sysadmin sets up default config values in the GLOBAL config file, but allows a user to set some or all different values in their own HOME config file, and to set yet more specific values when run from a particular directory. Nested overrides, very demure β¨
If no configuration files exist, the program provides builtin default values, and most of these values can be set by appropriate command line switches and flags.
See siggen.conf(5) for details of the configuration files.
swgen looks for configuration values CHANNELS, DACFILE, SAMPLERATE, SAMPLESIZE, VERBOSE.
CHANNELSβ sets either mono or stereo mode like the'-1|-2'options.DACFILEβ allows the name of the DAC/DSP/PCM device to be changed from/dev/dsp.SAMPLERATEβ sets the number of samples/sec for the DAC device.SAMPLESIZEβ sets whether 8 or 16 bit samples to be generated.VERBOSEβ sets whether or not to run in verbose mode.
π SEE ALSO π
π BUGS π
Not a single one listed. She said no bugs, we believe her, that's the vibe π«Άβ¨
π COPYING π
Copyright 1995-2008 Jim Jackson
The software described by this manual is covered by the GNU General Public License, Version 2, June 1991, issued by :
Free Software Foundation, Inc.,
675 Mass Ave,
Cambridge, MA 02139, USA
Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies.
Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one.
Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions, except that this permission notice may be included in translation instead of in the original English.
π AUTHOR π
Jim Jackson
Email: jj@franjam.org.uk
okay that's the whole page bestie!! πΈπ¦π this was Release 2.3, dated 20 Feb 1998 β so she's an elder icon, a vintage queen, and she's still out here generating waveforms. mwah π β¨
π¦ where this page comes from
- debian bookworm: siggen 2.3.10-11
- ubuntu jammy: siggen 2.3.10-11
- ubuntu noble: siggen 2.3.10-11
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms