Skip to reading
GDScript Programming & Godot

FadeSound()

Edition 0.86.4.1 HF1

0.86.4.1 Hotfix 1 edition. Earlier lessons and screenshots retain their original version context; revised references and supplements describe the newer behavior.

Download PDFView PDF page

Sound: Fade

Fade a sound channel to a normalized volume over time, waiting for the fade routine.

Source table from FadeSound(), page 200
Option key / fieldMeaning and inputDefault
Channel / ID (empty = all) channelSound-effect channel name. Reuse it to pause, stop or fade that sound group. May be blank.Blank
Target Volume volumeNormalized target volume: 0 is silent, 1 is full volume. Range: 0.0 to 1.0.0.0
Duration (seconds) durationTime in seconds for this action. Read its timing note before assuming it waits. Range: 0.0 to 60.0.1.0

Timing. Waits for the fade routine.

Code example
await FadeSound({"channel": "puzzle", "volume": 0.0, "duration": 1})

In use. Fade ambience to 0 over 1.5 seconds before stopping it. Volume uses 0 to 1, not decibels. A final volume near zero stops the selected sound players.

PlayMusic()#

Play Music

Start the chosen audio asset as music.

Source table from FadeSound(), page 200
Option key / fieldMeaning and inputDefault
Music Asset assetIdChoose an imported audio asset.Blank
Skippable skippableOn/off.true

Timing. Waits for the runtime routine to return; no further completion wait is promised by this schema.

Code example
await PlayMusic({"assetId": "chime", "skippable": true})

In use. Start a room theme and let the following actions continue. The catalog includes Skippable, but the current action bridge does not use that field to implement music skipping; do not build a skip button around it.

Page 200 of 378Permalink
Go to page