swgen(1)

πŸ“¦ version 2.3.10, in debian bookworm, ubuntu jammy, ubuntu noble

πŸ’– 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
  • 22050 samples/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.
  • -C file β€” use "file" as the local configuration file (see below).
  • -o file β€” write digital sample to file ('-' is stdout).
  • -w file β€” as '-o' but written as a WAVE format file. -a (append) is not valid with this option. no append for WAV, periodt
  • -s samples β€” generate with samplerate of samples/sec.
  • -8/-16 or -b 8|16 β€” force 8 bit or 16 bit mode.
  • -1, -2 β€” mono (def), or special stereo mode (see above).
  • -A n β€” scale samples by n/100, def. n is 100 (i.e. percentage of full scale output).
  • -t N|Nm β€” generate output for either N secs or Nm millisecs only.
  • -x10 or -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 from 100Hz to 1000Hz using a sawtooth wave twice a second, at 22050 samples/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 or 44100/sec and save one second of samples as a WAVE file in sweep.wav. WAV girlies rise 🎧
  • swgen -v -2 squ 10 1000 20% β€” generate a sine wave switched by a 10Hz squarewave between 800Hz and 1200Hz. The swept signal is on one channel and the 10Hz square wave is on the second channel. Stereo slay πŸ’…
  • swgen -v -x10 5 4400 4500 β€” generate a swept sine wave from 440Hz (4400/10) to 450Hz (4500/10), being swept at a frequency of 0.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 πŸ‘‘

siggen.conf(5)


πŸ’€ 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