Sound Function
Output of a data series as sound
Description
The function \(Sound\) outputs the data series of a list as sound on both speakers. The parameter expected is a list whose data is output on both loudspeakers. The sound can be output once or endlessly.
The sound is output at a sampling frequency of 48000. This means that 48000 elements in the first parameter will output a tone of 1 second. The following statement generates a single 133.33 Hz tone.
\(\displaystyle Sound(Sin([1..360]* 127))\)
The statement contains 360 elements and \(48000/360\) returns 133.33.
To generate a sustained 1000 Hz tone write
\(\displaystyle Sound(Sin([7.5..360:7.5]* 127),loop)\)
A single vibration here consists of 48 elements, which corresponds to 1/1000 second.
Parameter
Ton
The first argument \ (tone \) is the data series to be output as audio signal. The range of the amplitude is -127 to +127.
Loop
If the optional parameter \(Loop\) is set, the sound will be looped repeatedly until the Halt button in the Action menu is clicked.
Level
With the optional third parameter \ (Level \) the volume can be reduced. A value from 0 to 1 is valid. The default Level = 1, which corresponds to the maximum volume.
Syntax
Sound (Ton)
Sound (Ton, Loop)
Sound (Ton, Loop, Level)
Example
t=Sin([1..360])*127
Output of a single sine wave
Sound(t)
Endless output of a sine wave
Sound(t,loop)
Endless output of a sine wave at half volume
Sound(t,loop,0.5)
Single output of a vibration at half volume
Sound(t,0,0.5)