Module: sound
Support sound functions (only available on Windows). The module must be loaded with dl('sound');
See also example Play Sound.
Function/Arguments | Return | Description |
---|---|---|
play_sound (string name [, flags=SND_FILENAME]) | bool | Play sound with the WIN32 function PlaySound(). If flags are not specified the name points to a filename (WAV). flags can combine the following values: SND_ASYNC, SND_ALIAS, SND_ALIAS_ID, SND_LOOP, SND_SYNC, SND_FILENAME. To stop a asynchronous playing call play_sound (null, 0); On success true is returned. See also WIN32 function PlaySound () for detailed description. |
midi_create (number devideId) | handle | Create MIDI device handle for specific deviceId. The default device is 0. On success the handle is returned, on error null is returned. Note: Win7+ has no default MIDI device! Please install MIDI device manually. |
midi_voice (handle handle, number voice) | number | Set the voice from 0 to 255 to MIDI device handle. Returns the status code of MIDI device. |
midi_play (handle handle, number note, number volume [, stop=false]) | number | Play or stop sound on created MIDI device handle with note and volume from 0 to 127. Optional stop marks to stop/mute the note. You should use sleep(ms) for the duration of the note. Returns the status code of MIDI device. |
midi_freq2note (handle handle, number frequency) | number | Returns the MIDI note number of a frequency. |
midi_close (handle handle) | bool | Close MIDI handle. On success true is returned. |