Simple Audio Solution is a audio middleware for Unity to keep your audio nice and clean. It is an open-source alternative to proprietary tools like FMOD and Wwise and is completely free to use.
Here are the reasons why we like working with the Simple Audio Solution.
The complete sound configuration is placed in one prefab. Each sound event has an ID, e.g. /SFX/Common/UI/Dialog/Fade In
, which is its path in the prefab.
Why does this help?
-
When your sound designer wants to add sounds to the project in Unity he doesn't have to look through complicated UI or other hierarchies to find the right place. He just needs to know where to find the prefab. Everything else can be safely ignored by him.
-
As a programmer you can easily add a placeholder sound and tell your sound desginer to replace e.g. sound
/SFX/Common/UI/Dialog/Whoosh
in the next step. -
When working with version control systems like Git, you want to have prefabs to prevent merge conflicts in the scene. Your sound designer can make changes to the prefab without modifying a scene, allowing you as a programmer to keep working with the scene without conflicts.
Obviously, the Simple Audio Solution can and does not have the features of FMOD and Wwise. It tries to focus on the problems that everyone has when not relying on a proprietary solution. For those problems it provides a simple API / Editor.
For example, you want to randomize footsteps. Just drag more than one AudioClip
in the Audio Clips section and the Simple Audio Solution will select one randomly. If you want to make sure it is always a different one select Shuffle for Multi Sound Event Playmode.
Let's say you want to add a button click sound. Simply use the following code:
SoundAccess.GetInstance().PlayOneShot2D("/SFX/Common/UI/Button/Click");
First install the Git Dependency Resolver For Unity by adding the following lines to your manifest.json
:
{
"dependencies": {
"com.coffee.git-dependency-resolver": "https://github.com/mob-sakai/GitDependencyResolverForUnity.git"
}
}
Other ways to install the Git Dependency Resolver For Unity can be found on their GitHub page.
Then install the Simple Audio Solution by adding the following lines to your manifest.json
:
{
"dependencies": {
"com.produktivkeller.simple-audio-solution": "https://github.com/PRODUKTIVKELLER/simple-audio-solution.git"
}
}
-
Copy and paste the example prefab
Packages/com.produktivkeller.simple-audio-solution/Prefabs/SoundAccess
to yourAssets
folder. Otherwise, your changes to the prefab will be overriden when updating the Simple Audio Solution! -
Copy the
AudioMixer
found atPackages/com.produktivkeller.simple-audio-solution/Audio Mixer/Audio Mixer - Example
to anyResources
folder in your project and rename it toAudio Mixer
. -
Drag and drop the prefab from step one to your scene.
-
That's it!
There are two ways to play a sound.
- Use a
SoundEmitter
. It basically works like the UnityAudioSource
. It has methods forSoundEmitter.Play()
andSoundEmitter.Stop()
. The key of the sound can be specified in the Inspector window. The key is a path to aSoundEvent
in theSoundAccess
prefab. It always starts with a/
and can contain any characters Unity allows in the hierarchy, e.g./SFX/Temple/Arrow Trap/Shoot
. Right now there is no auto-completion but we plan to add it in a later update.
// Use it just like an AudioSource
SoundEmitter soundEmitter = GetComponent<SoundEmitter>();
soundEmitter.Play();
soundEmitter.Stop();
// You can change the key via API. When you call SoundEmitter.Play() the next time, the new event will be played.
soundEmitter.key = "/SFX/Temple/Spike Trap/Snap";
- Use a one-shot by calling any of the following methods. This is convenient when the position of your object does not change, e.g. for 2D sounds like UI sounds or 3D sounds like a bullet impact.
SoundAccess.GetInstance().PlayOneShot2D(string key);
SoundAccess.GetInstance().PlayOneShot(string key, Vector3 position);
SoundAccess.GetInstance().PlayOneShot2DDelayed(string key, float delayInSeconds);
The Simple Audio Solution is used in Pin Them. It is developed by two German game studios, PRODUKTIVKELLER Studios and Creactstudios.
As an open-source project we would love to see you contributing to the project. If you have feature requests or want to contribute, feel free to reach out to us via GitHub, join our Discord or write us an email at [email protected]
.