Now let’s add some music to our title screen, which is exceptionally easy in Godot. To do this we simply add a AudioStreamPlayer Node to our game, parented to the root node. Your scene should now look something like this:
Now we need to tell it what audio file to play. We have a song for our title scene in the folder assets\audio\music called InStormAndSunshine.ogg. Select this file in the File System.
With the AudoStreamPlayer selected, drag the ogg file to the Inspector and drop it on the Stream tab, like so:
Also select Autoplay to On, which will cause the attached Stream to automatically be played when the AudioStreamPlayer is created. This means when our game loads, our music will start playing immediately.
Since we don’t know how long the player will be on the title scene, there is a good chance we want the song to play over and over again. This is done via import settings. Select the ogg file in the File System panel, then locate the Import tab. Make sure the Loop setting is enabled:
If you change the value, be sure to click the Reimport button below.