Audio¶
The Audio library allows you to play audio and beep frequencies.
Usage¶
Lua | |
---|---|
Functions¶
play¶
audio.play( data )
Play audio.
Parameters¶
data
: string - Data to play. One character is one byte.
beep¶
audio.beep( frequency, [time], [volume] )
Play a square wave tone.
Parameters¶
frequency
: number - Frequency to play.time
: number - How long to play. In seconds.volume
: number - Volume of the tone from 0 to 1. 0.5 is 50%.
resume¶
audio.resume()
Resume the paused audio.
pause¶
audio.pause()
Pause the audio.
stop¶
audio.stop()
Stop the audio and clear the buffers.
getVolume¶
audio.getVolume()
Get the master volume.
Returns¶
volume
: number - Percentage of the volume from 0 to 1.
setVolume¶
audio.setVolume( volume )
Set the master volume.
Parameters¶
volume
: number - Percentage of the volume from 0 to 1.
status¶
audio.status()
Get the state of the audio.
Returns¶
status
: string - One of the following options:playing
stopped
paused
Last update:
March 11, 2023
Created: March 11, 2023
Created: March 11, 2023