Audio
const audio = require("@vectarine/audio")AudioResource
Section titled “AudioResource”export type AudioResource = ...AudioResource:play
Section titled “AudioResource:play”AudioResource:play(loop: boolean?, fadeIn: number?): ()Play an audio resource from its beginning.
If loop is true, the audio will loop indefinitely.
fadeIn: milliseconds over which the volume rises from silence (default: 100 when starting, 0 when resuming).
A sound plays once at a time: playing it while it plays does nothing. Use pause and resume for that.
AudioResource:isPlaying
Section titled “AudioResource:isPlaying”AudioResource:isPlaying(): booleanReturns true if the audio resource is currently playing.
AudioResource:getDuration
Section titled “AudioResource:getDuration”AudioResource:getDuration(): numberReturns the duration of the audio resource in seconds.
AudioResource:getProgress
Section titled “AudioResource:getProgress”AudioResource:getProgress(): numberReturns the current progress of the audio resource in seconds. This is a number between 0 and the duration.
AudioResource:pause
Section titled “AudioResource:pause”AudioResource:pause(fadeOut: number?): ()Stop an audio resource. If fadeOut is provided, the audio will fade out over that many milliseconds (it counts as playing until then). Does nothing if the audio is not playing.
AudioResource:resume
Section titled “AudioResource:resume”AudioResource:resume(fadeIn: number?): ()Play a paused audio resource again from where it was. If fadeIn is provided, the volume rises from silence over that many milliseconds.
AudioResource:setVolume
Section titled “AudioResource:setVolume”AudioResource:setVolume(volume: number): ()AudioResource:getVolume
Section titled “AudioResource:getVolume”AudioResource:getVolume(): number