audio
This module lets you load and control sounds in your games or projects. You can play music, sound effects, and control their volume, position, etc.
api
• audio.newAudio•••Creates and returns a new sound object from a file.
Use it inside load
to prepare an audio file (like .mp3, .ogg, or .wav) for later playback.
• audio.play•••••••Plays a sound. You can choose if it should loop.
• audio.pause••••••Pauses the sound at the current moment.
Useful if you want to temporarily stop and later resume it.
• audio.stop•••••••Stops the sound and resets it to the beginning.
Use it to fully cancel playback.
• audio.seek•••••••Jumps to a specific part of the sound.
• audio.volume•••••Changes the volume of the sound (from 0 to 1).
• audio.fade•••••••Smoothly transitions the current volume to the desired new volume.
• audio.pan••••••••Moves the sound to the left (-1), center (0), or right (1).
• audio.balance••••Controls the left and right channel volumes separately.