-
Notifications
You must be signed in to change notification settings - Fork 390
Add music and/or sound effects for a mini-game #622
-
Why this task matters
Adding your own music and sound effects brings your StoryQuest to life and creates a unique atmosphere for players. Custom audio helps establish the mood, tone, and personality of your story while making it feel distinctly yours rather than using placeholder sounds.
Steps
Git Setup
- Update your local repository. Open Git Bash and navigate to your project folder. Before creating a new branch, switch back to the main branch and pull the latest changes from your team's GitHub repository. This makes sure that the new branch you are about to create will have the latest updates from your team's StoryQuest.
git switch main git pull
- Create a new Git branch
Now, create a new branch for your work:In general, choose a branch name that reflects what you're doing, likegit switch -c new-branch-name
intro-outro-tilemaporadd-custom-path. This keeps your work organized. Click here for a more detailed guide and more information on updating your local repository and creating a branch.
- Import your sound file. Make sure you have the audio file somewhere easy to locate on your computer, and then decide as a team where to place your audio in the Godot FileSystem:
• For scene-specific audio: Place it in that scene's components folder (e.g.,0_stella_intro/stella_intro_components/for intro sounds/music only)
• For shared audio: Create a folder at your StoryQuest root level likestella_audio_assets/so your team can easily find and use music or sounds across all scenes
In Godot's FileSystem panel, navigate to the appropriate folder and drag your audio file (.mp3, .wav, or .ogg) from your computer into it. Godot will automatically import it. If you placed it somewhere different by accident, just use the "Filer search" option in the FileSystem and then move it to the intended folder.
- Open the scene where you want music. Navigate to your intro scene folder (like
0_stella_intro/) and double-click thestella_intro.tscnfile to open it.
Steps 5-8 For Adding Background Music to a Scene
-
Add the background_music.tscn. to your Scene Tree In the FileSystem, search for background_music.tscn. This is an AudioStreamPlayer node that is designed to be used for background music in your StoryQuest scenes. To add this file to your scene you can simply click and drag the file into your current Scene Tree and it will be added as a new node in that scene.
-
Assign your music file to this new BackgroundMusic node. With your BackgroundMusic node selected, look in the Inspector panel. Find the Stream property and click the dropdown arrow. Choose Quick Load and select your imported music file. Alternatively, you can drag your music file directly from the FileSystem panel onto the empty Stream field in the Inspector.
The image below shows the background_music.tscn in the FileSystem and also shows what it will look like when you drag this file into a specific Scene Tree. You can see the "stream" property in the Inspector as well:
image
-
Adjust volume and looping.
• Use the Volume Db slider to make the music louder or quieter
• Check Looping if you want the music to repeat continuously -
Test your music. Click the Play Scene button (or press F6) to test that your music starts automatically.
Steps 9-13 For Replacing Sound Effects on Existing Game Assets
-
Import your custom sound effects. Choose the best location for your sound files:
• Scene-specific sounds: Place in that scene's components folder (e.g.,2_stella_combat/stella_combat_components/for combat sounds only)
• Reusable sounds: Place in your shared audio folder (e.g.,stella_audio_assets/) so your team can use them across multiple scenesDrag your sound effect files (.wav, .ogg, or .mp3) into the appropriate folder in the FileSystem panel.
-
Find game assets with existing sound effects. Look through your scene for interactive game objects like stealth guards, sequence puzzle objects, or other elements like the "Player". Some of these already have sound effects built into their scripts.
-
Locate the sound property in the Inspector. With the game asset selected, look in the Inspector panel for sound-related properties. This is an example of the inspector panel with one of the stealth guards selected in the Scene Tree:
image
These properties will show the currently assigned sound file. -
Replace the sound effect. Click on the sound property field in the Inspector. Choose Quick Load and select your new sound effect file, or drag your sound file directly from the FileSystem panel onto the property field.
-
Repeat for other game assets. Go through your scene and replace sound effects on other interactive elements as desired.
Save To Git and GitHub
- Stage and commit your changes. In Git Bash, here is an example of how this flow will generally look:
git status git add scenes/quests/story_quests/yourStoryQuest/ git commit -m "Add your message here - explain to your team what you changed" git push --set-upstream origin your-branch-name
- Make sure the file path shows your actual story quest name, write your own descriptive commit message, and use your actual branch name.
- You can use
git addto add more than one file simply by putting a space between file paths you paste in. - You only need to use
--set-upstreamthe first time you push a new branch to GitHub.
Click here for a more detailed guide and more information on saving and pushing your changes to GitHub.
- Submit a pull request. Go to GitHub, navigate to your fork, and click Compare & pull request. Write a clear title and description indicating what you changed and why, then click Create pull request.
Click here for a more detailed guide and more information on creating a pull request to your team's forked repo.
Note: Pull requests are better with a peer review! Click here to learn more. If you are working alone, you can merge your own pull request after submitting it.
✅ Done! Your StoryQuest now has personalized music and sound effects !
Use the Threadbare Melody Loom app to create your own soundtracks and SFX!
Resources for some royalty free game audio: Freesound, Kevin MacLeod's Incompetech
Beta Was this translation helpful? Give feedback.