Undertale background


The Audio object [E/M/W] The Audio object allows you to control music in the game and play sounds. Here are the ways in which you can use it.

  • Audio.playtime - Get or set the current play position of the current music in seconds.

  • Audio.totaltime - Get the total length of the current music in seconds.

  • Audio.Play() - Play the currently loaded music. Done automatically at the beginning of a fight.

  • Audio.Stop() - Stops the music. If you want a battle not to have music, call this in EncounterStarting().

  • Audio.Pause() - Pause the music.

  • Audio.Unpause() - Unpause the music if you previously paused it.

  • Audio.Volume( value) - Set music to given volume. value should be between 0.0 (muted) and 1.0 (full volume). This is 0.75 by default.

  • Audio.Pitch( value) - Set music pitch to given value. 1.0 is default, 2.0 is twice the regular speed. Negative values play the music backwards. value may be between -3.0 and 3.0.

  • Audio.LoadFile( filename) - Load music from the Audio folder titled filename.ogg or filename.wav and play it immediately. If you don't want immediate playback, call Audio.Stop() after this. Don't include the file extension.

  • Audio.PlaySound( filename, volume = 0.65) - Play the sound from the Sounds folder titled filename.ogg or filename.wav. Don't include the file extension.

  • Audio.isPlaying - Returns true if the music is playing, or false if the music is stopped or paused.

  • Audio.StopAll() - Stops all playing audio.

  • Audio.PauseAll() - Pauses all the audio sources.

  • Audio.UnpauseAll() - Unpauses all the audio sources.

  • Audio.SetSoundDictionary( key, value) - Adds a sound to the sound dictionary. Doing so allows you to change the name of the sounds played by the engine - like, for example, hurtsound or menumove.

    Setting key to "RESETDICTIONARY" will reset the entire sound dictionary to its original state.

  • Audio.GetSoundDictionary( key) - Returns the index of the sound in the sound dictionary. Returns the key itself if the key isn't in the dictionary.

  • Audio[ key], Audio[ key] = value - Fast way to use Audio.SetSoundDictionary / GetSoundDictionary.

As this is an object, you can't directly use it with [func], but you can make your own function if you want to, say, stop the music mid-dialogue:

currentdialogue = {"but then I realized...\n[w:30][func:drama]the butler did it!!!"}

function drama()
    Audio.Stop()
    Audio.PlaySound("dramatic_sound_effect")
end

* YOU WON!
* You earned 0 EXP and 0 gold.
* also the nav menu is broken now


Undertale fake button
Undertale fake button
Undertale fake button
Undertale fake button