[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.3.8.3 Play Tone (#N)

The Play Tone command generates ascii escape sequences which set the frequency and duration of tones generated by the system speaker. The tones are played after an optional delay.

Tones without a delay argument are played immediately, so if you want to play two one-second tones in sequence, for example, you will need to add a (#W1000) after the first (#N), or put a delay of 1000 in the second (#N) in order for the second (#N) to be heard.

The tones are actually played by a child process which is forked from cogsys. Once the child process issues the system command to play the tone (after any specified delay), the child process then dies. This allows the parent process to perform simultaneous stimulus presentation or response processing while a delayed-onset tone is being generated.

The maximum frequency allowed is 5000 Hz and the maximum duration of the tone is 2000 milliseconds. These limits are inherent in the "setterm -bfreq" and "settern -blength" commands, which #N simulates. There is no limit effective to the delay argument.

Name:
Play Tone
Class:
Audio I/O
Code:
#N
Syntax:
#N[freq,duration[,delay]]

freq is the frequency in Hz; duration is the duration in milliseconds; delay is the onset in milliseconds

Output:
A tone of freq Hz plays for duration milliseconds after delay milliseconds

Test Files:
`TONE_T01.IN'
tests basic operation

Examples:

input
#N[1000,2000]
cogsys
Plays a 1000 Hz tone for 2000 milliseconds.

input
#N[1500,1000,500]
cogsys
Plays a 1500 Hz tone for 1000 milliseconds after delaying 500 milliseconds.



This document was generated on November, 24 2008 using texi2html