Signal Generation tools for Linux and /dev/dsp Jim Jackson ---------------------------------------------- Feb 1998 Release 2.1 What are the programs? This is a set of tools for imitating a laboratory Signal Generator, generating audio signals out of Linux's /dev/dsp audio device. There is support for mono and/or stereo and 8 or 16 bit samples. The basic waveform sample generation code is in the file generator.c, the functions here can be added to other programs fairly easily. Several of the programs below are front ends for using the generator functions, mixing the generated outputs and playing them on /dev/dsp. None of the generation programs control the mixer - use your favourite mixer program or use the simple mixer 'smix' which I have included here. soundinfo A program to display some of the programming capabilities of the sound system support for the mixer device /dev/mixer and the DSP device /dev/dsp. Can easily be changed if the mixer and dsp devices are called something else. Also shows some of the ioctl calls in action :-). Further info on your kernel's sound card configuration is given by 'cat /dev/sndstat'. sgen is a command line signal generator where details are specified from the command line for generating sine, cos, square, triangle, sawtooth, pulse, noise waves. Frequency, sample rate, relative amplitude etc can be specified thru' command line options. The signal is played continuously until the program is stopped. There are options to save the basic raw digital samples raw to file or to a WAVE format file. swgen is a command line sweep generator. Both the sweeping and swept waveforms can be specified, along with the sweeping frequency and the swept frequency range. Otherwise similar to sgen above. siggen an Ncurses screen based Signal Generator for 2 seperate channels. On stereo audio cards the 2 channels are played on seperate outputs. On mono cards the 2 channels are digitally mixed onto the one output. Type of waveform, frequency, amplitude, sample rate etc are specified/changed via a screen menu. This is version 2. It plays continuously. Changes to parameters take effect (nearly) immediately. This version is pretty CPU intensive. sweepgen an Ncurses screen based Sweep generator (see swgen above). It is like siggen. Changes to parameters take effect (nearly) immediately. tones a command line program to generate several successive tones of varying freq., and optional differing waveforms and durations. The sequence of tones can be either played once (the default), or repetitively or the samples can be written to a file in raw or WAV format. This could make the basis of an auto-dialer for tone phones. Check out README.tones and the tones.eg directory for some examples of using the tones program. smix a simple command line program for getting and setting the mixer settings. (Eee by gum, yet another mixer, yawn). Compiling and installing You will need the ncurses library and header files. You will need sound card support compiled into your kernel. Check out the Makefile and edit anything that is wrong for your system. The ncurses library is assumed to be in normal library 'path' and the ncurses include file is assumed to be in either /usr/include/curses or /usr/include/ncurses/curses . If not, edit as appropriate. Just type 'make' to make the programs. Warning: you will get some warnings from gcc, from the compilation of sigscr.c, sweepscr.c and scfio.c. Don't worry, they are only warnings, the programs work. Don't set -Wall in the makefile, the results will be deeply embarassing to yours truly :-) Type 'make sysinstall' to install the programs into /usr/local/bin and the man pages into /usr/local/man/man1. Type 'make localinstall' to install into $HOME/bin and $HOME/man/man1. If none of these are ok for you then copy manually or edit the Makefile. Edit the setting of variable PROGS to customise which programs you install, e.g. you may not wish to install yet another mixer program so delete smix from the list. These programs have been tested on Linux 1.3.52, with Voxware Sound Driver 3.5 with a MAD16 based soundcard. Linux 2.0.33, with Voxware Sound Driver 3.5.4 with a Soundblaster 16 and glibc Distribution and Copying Distribution of this package is covered by the terms of the GNU General Public License, version 2. See the file COPYING for further details. These programs are Copyright (c) 1996-1998 Jim Jackson. Jim Jackson jj@scs.leeds.ac.uk School Of Computer Studies University of Leeds Leeds LS2 9JT UK