1
.TH sgen 1 "20 Feb 1998" "Release 2.3" "Linux System Manual"
3
.I sgen \- a simple signal generator program
5
.IP sgen\ [flags]\ waveform\ freq
6
waveform is sine, cosine, square, triangle, sawtooth, noise
7
.IP sgen\ [flags]\ pulse\ freq\ [Mark/Space]
8
pulse has extra param Mark/Space % - def. is 10 (%)
11
is a simple signal generator program, that can digitally generate standard
12
waveforms on the LINUX /dev/dsp device. 8 or 16 bit samples can be generated,
13
in mono or stereo. In stereo the two signals can be in phase or in anti-phase
14
(180 degrees). The frequency is specified as an integer number of Hertz.
15
Fractional Hertz frequencies are not supported. Of course, only frequencies
16
less than half the samplerate (number of samples/sec) can be generated.
18
The waveforms that can be generated are:
22
a sine wave with a 90 degree phase shift
24
a standard square wave with a 50% mark space ratio
26
a ramp waveform with 'infinately' fast flyback (:-) An ideal oscilloscope
29
shaped like equally spaced teeth on a saw (:-)
31
This is weak. All it consists of is one second of pseudo-randomly generated
32
samples, played repeatedly. I'd love to do proper white/pink noise,
33
but I don't know enough, and I don't think the structure of the program
34
is conducive to accurate noise generation.
36
A square waveform where the mark/space ratio (as a percentage) can be
37
specified. The default value is 10% (mark/space ratio of 1:9).
40
creates one second's worth of generated output in a buffer and plays the
41
buffer repeatedly, until it is terminated.
43
A lot of thought has gone into the algorithms for generating the waveforms.
44
I believe the sin/cos wave to be very pure (modulo your sound card :-), but
45
I don't have access to a THD meter to measure it. For best signal accuracy
47
use the gain factor option (-A). The generator will then make the wave's
48
peak value fit the maximum digital values allowed. Use a mixer program to
49
control the output volume, or an external attenuator.
51
The gain factor option can be useful for simulating a signal that has been
52
subject to clipping. Specify a gain of > 100%. In fact a trapezoid signal
53
can be made by generating a clipped triangular wave. The greater the gain,
54
the closer the signal approaches a square wave (the rise and fall times
57
output to /dev/dsp, 22050 samples/sec, mono, 16 bit
58
samples if possible, else 8 bit.
61
display usage and help info
65
write digital sample to file ('-' is stdout)
67
as '-o' but written as a WAVE format file. -a (append) is not valid
70
force overwrite/append of/to file.
72
use "file" as the local configuration file (see below).
74
generate with samplerate of samples/sec
75
.IP -8/-16\ or\ -b\ 8|16
76
force 8 bit or 16 bit mode.
78
mono (def), stereo or stereo in antiphase
80
scale samples by n/100, def. n is 100 (i.e. percentage of full scale output)
82
generate output for either N secs or Nm millisecs only.
84
Scale frequencies down by a factor of 10 or 100. This allows fractional
85
Hz values to be generated. See EXAMPLES below for its use. It is
89
.IP sgen\ -v\ sin\ 440
90
generate a sin wave of 440Hz at 22050 samples/sec, 16bit samples on 16 bit
91
card, 8 bit samples on an 8 bit card.
92
.IP sgen\ -v\ -s\ 44100\ -w\ sin444.wav\ sin\ 440
93
as above but at a samplerate or 44100/sec and save a one second of samples
94
as a WAVE file in sin440.wav
95
.IP sgen\ -v\ -A\ 500\ saw\ 1000
96
generate a 1000Hz sawtooth wave severely clipped. The waveform will look like
97
a square wave with a rise and fall time of one tenth of the wave period. (I
98
think that's what the scribbled calculation on the back of this envelope
100
.IP sgen\ -v\ -2a\ sin\ 1000
101
generate 2 1000Hz sine waves out of phase by 180 degrees, one on each
103
.IP sgen\ -v\ pulse\ 1000\ 95
104
generate a 1000Hz pulse wave with the 'on' period being 95% of the
105
waveform period, i.e. a mark/space ratio of 19:1.
106
.IP sgen\ -v\ -x10\ sin\ 2616
107
generate middle C 261.6Hz (2616/10) from the equally tempered scale. Yes
108
it's a royal pain remembering to scale all freqs. by a factor of 10, but
109
I needed it in a hurry and didn't have time to do it better.
111
.SH CONFIGURATION\ FILES
113
Three possible configuration files can be used: a LOCAL config file (usually
114
in current directory), a HOME config file in user's $HOME directory and a
117
All the siggen suite of programs are compiled with the names of the config
118
files built in. By default the configuration files are:
120
is the LOCAL config file.
121
.IP $HOME/.siggen.conf
122
is the HOME config file.
124
is the GLOBAL config file.
126
will indicate which config files will be searched for.
128
The config files do not have to exist. If they exist and are readable by the
129
program they are used, otherwise they are simply ignored.
131
The config files are always searched for configuration values in the order
132
LOCAL, HOME, GLOBAL. This allows a scheme where the sysadmin sets up default
133
config values in the GLOBAL config file, but allows a user to set some or
134
all different values in their own HOME config file, and to set yet more
135
specific values when run from a particular directory.
137
If no configuration files exist, the program provides builtin
138
default values, and most of these values can be set
139
by appropriate command line switches and flags.
141
See siggen.conf(5) for details of the configuration files.
144
looks for configuration values CHANNELS, DACFILE, SAMPLERATE,
147
sets either mono or stereo mode like the '-1|-2' options.
149
allows the name of the DAC/DSP/PCM device to be changed from /dev/dsp
151
sets the number of samples/sec for the DAC device
153
sets whether 8 or 16 bit samples to be generated
155
sets whether or not to run in verbose mode.
164
.I Copyright\ 1995-2008\ Jim\ Jackson
166
The software described by this manual is covered by the GNU General
167
Public License, Version 2, June 1991, issued by :
169
Free Software Foundation, Inc.,
173
Cambridge, MA 02139, USA
175
Permission is granted to make and distribute verbatim copies of
176
this manual provided the copyright notice and this permission notice
177
are preserved on all copies.
179
Permission is granted to copy and distribute modified versions of this
180
manual under the conditions for verbatim copying, provided that the
181
entire resulting derived work is distributed under the terms of a
182
permission notice identical to this one.
184
Permission is granted to copy and distribute translations of this
185
manual into another language, under the above conditions for modified
186
versions, except that this permission notice may be included in
187
translation instead of in the original English.
192
.I Email: jj@franjam.org.uk