Media_CreateSound ( type { ; duration { ; frequencyOrNote } } )
Media_CreateSound allows you to create a tone, or white noise, or silence for a specified duration.
Parameter | Description |
---|---|
type | created sound waveform type. One of the following:
|
duration | Created sound duration in seconds. | frequencyOrNote | Created sound wave frequency in Hz or note name and octave. | parameters | Optional parameter. Hexadecimal convert settings. |
The function returns a sound to a container field.
Sine, square, and sawtooth types can give you precise tones on the musical scale, as well as various beeps and buzzes, depending on the frequency setting you use.
Silence simply creates an empty sound result for the specified duration.
Noise creates a static-like white noise for the length of time you want.
Examples
To create a 2-second C sharp note in octave 4:
Set Field [ MyTable::Sound ;
Media_CreateSound (
"sine"# waveform type
2# 2 seconds
"C#4"# C sharp in octave 4
) ]
To create a 3-second 440 Hz sound (a concert pitch A):
Set Field [ MyTable::Sound ;
Media_CreateSound (
"sine"# waveform type
3# 3 seconds
"440"# frequency
) ]