view man/man1/tone.1 @ 0:5242703e91d3 tip

Initial checkin for AIM92 aimR8.2 (last updated May 1997).
author tomwalters
date Fri, 20 May 2011 15:19:45 +0100
parents
children
line wrap: on
line source
.TH TONE 1 "1 September 1993"

.SH NAME
tone \-    generate a pure tone.

.SH SYNTAX 
tone [options]

.SH DESCRIPTION
Generate samples of a sine wave at a given sample rate.
Specify wave amplitude, and frequency (in Hz or kHz), or alternatively
period (in s, ms, or p (sample points) ). If both period and frequency
are specified, then the given period takes precedence.
If S is the given samplerate so that Ts=1/S is the sample interval,
and phi is the given phase (in samples or time units),
then each sample of a sine wave of frequency f [Hz] is given by:

.nf
	sin( TWOPI.f ( n.Ts + phi ) ) ,  n = 0,1,2,...
.fi

Write samples to the stdout in the given datatype for the given waveform duration.


.SH OPTIONS

1. period, frequency

The frequency (in Hz or kHz) and the period (in s, ms, or p (sample points) )
of the output waveform. Either may be specified, but if both period and frequency
are specified, then the given period takes precedence.

2. amplitude

The amplitude of the output waveform.

3. phase

The phase offset of the output sine wave with respect to the origin.
This may be specified as a time (with units s or ms) or as a number of
samples (with units p or no units), or in degrees (with units deg),
or the following strings are recognised
(and may be abbreviated provided this is unambiguous):
sine (0 phase offset), cosine (1/4 cycle phase offset),
antisine (1/2 cycle phase offset), anticosine (3/4 cycle phase offset).

4. type

The datatype of the output waveform. The following strings are recognised
types: char, short, int, float, double, ascii (meaning one ascii number per
line).

.SH EXAMPLES

1. Sine wave with period 10ms sampled at 10kHz, (100 sample points per period)

.nf
	    tone period=10ms samplerate=10kHz
.fi

2. Sine wave with frequency 100Hz sampled at 20kHz

.nf
	    tone frequency=100Hz
.fi

3. Sine wave with period 100 sample points, with dc-offset set equal to
amplitude of 500 so that waveform is just non-negative.

.nf
	    tone period=100p amplitude=500 offset=500
.fi

4. Quarter cycle of a sine wave with 8ms period.

.nf
	    tone period=8ms duration=2ms
.fi

5. Cosine wave with 8ms period.

.nf
	    tone period=8ms phase=cos
.fi

This is equivalent to:

.nf
	    tone period=8ms phase=2ms
.fi




.SH "SEE ALSO"
options ptrain

.SH COPYRIGHT
.LP
Copyright (c) Applied Psychology Unit, Medical Research Council, 1995
.LP
Permission to use, copy, modify, and distribute this software without fee 
is hereby granted for research purposes, provided that this copyright 
notice appears in all copies and in all supporting documentation, and that 
the software is not redistributed for any fee (except for a nominal 
shipping charge). Anyone wanting to incorporate all or part of this 
software in a commercial product must obtain a license from the Medical 
Research Council.
.LP
The MRC makes no representations about the suitability of this 
software for any purpose.  It is provided "as is" without express or 
implied warranty.
.LP
THE MRC DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING 
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL 
THE A.P.U. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES 
OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, 
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 
SOFTWARE.