Manual Reference Pages - TONE (1)
tone - generate a pure tone.
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:
sin( TWOPI.f ( n.Ts + phi ) ) , n = 0,1,2,...
Write samples to the stdout in the given datatype for the given waveform duration.
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.
The amplitude of the output waveform.
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).
The datatype of the output waveform. The following strings are recognised types: char, short, int, float, double, ascii (meaning one ascii number per line).
1. Sine wave with period 10ms sampled at 10kHz, (100 sample points per period)
tone period=10ms samplerate=10kHz
2. Sine wave with frequency 100Hz sampled at 20kHz
3. Sine wave with period 100 sample points, with dc-offset set equal to amplitude of 500 so that waveform is just non-negative.
tone period=100p amplitude=500 offset=500
4. Quarter cycle of a sine wave with 8ms period.
tone period=8ms duration=2ms
5. Cosine wave with 8ms period.
tone period=8ms phase=cos
This is equivalent to:
tone period=8ms phase=2ms
Copyright (c) Applied Psychology Unit, Medical Research Council, 1995
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.
The MRC makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty.
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.
|SunOS 5.6||TONE (1)||1 September 1993|