tone
Manual Reference Pages - TONE (1)
tone - generate a pure tone.
CONTENTS
Syntax
Description
Options
Examples
Copyright
SYNTAX
tone [options]
DESCRIPTION
Generate samples of a sine wave at a given sample rate.Specify wave amplitude, and frequency (in Hz or kHz), or alternativelyperiod (in s, ms, or p (sample points) ). If both period and frequencyare 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:sin( TWOPI.f ( n.Ts + phi ) ) , n = 0,1,2,...Write samples to the stdout in the given datatype for the given waveform duration.
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 frequencyare 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 ofsamples (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 recognisedtypes: char, short, int, float, double, ascii (meaning one ascii number perline).
EXAMPLES
1. Sine wave with period 10ms sampled at 10kHz, (100 sample points per period)
tone period=10ms samplerate=10kHz2. Sine wave with frequency 100Hz sampled at 20kHz
tone frequency=100Hz3. Sine wave with period 100 sample points, with dc-offset set equal toamplitude of 500 so that waveform is just non-negative.
tone period=100p amplitude=500 offset=5004. Quarter cycle of a sine wave with 8ms period.
tone period=8ms duration=2ms5. Cosine wave with 8ms period.
tone period=8ms phase=cosThis is equivalent to:
tone period=8ms phase=2ms
SEE ALSO
options ptrain
COPYRIGHT
Copyright (c) Applied Psychology Unit, Medical Research Council, 1995
Permission to use, copy, modify, and distribute this software without feeis hereby granted for research purposes, provided that this copyrightnotice appears in all copies and in all supporting documentation, and thatthe software is not redistributed for any fee (except for a nominalshipping charge). Anyone wanting to incorporate all or part of thissoftware in a commercial product must obtain a license from the MedicalResearch Council.
The MRC makes no representations about the suitability of thissoftware for any purpose. It is provided "as is" without express orimplied warranty.
THE MRC DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDINGALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALLTHE A.P.U. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGESOR 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 THISSOFTWARE.
| SunOS 5.6 | TONE (1) | 1 September 1993 |