Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Sounds for parts with Wwise and Unity: Difference between revisions

From Kerbal Space Program 2 Modding Wiki
Spacewarp>JiMKesa
No edit summary
Spacewarp>JiMKesa
No edit summary
Line 59: Line 59:
Normaly, now, your Wwise project will appear on the Wwise Launcher. I work on my projects with the 2021 version of Wwise. I will open the Wwise project that was created:
Normaly, now, your Wwise project will appear on the Wwise Launcher. I work on my projects with the 2021 version of Wwise. I will open the Wwise project that was created:
[[File:2024-02-09 18 31 21-Audiokinetic Launcher.png|center|thumb]]
[[File:2024-02-09 18 31 21-Audiokinetic Launcher.png|center|thumb]]
=== Step 2 : Wwise project ===
You need to create your sound databank :
[[File:2024-02-09 18 32 27-Kesa solar - Wwise 2021.1.13.png|center|thumb]]
[[File:2024-02-09 18 33 01-Kesa solar - Wwise 2021.1.13.png|center|thumb]]
Your soundbank is now created.
[[File:2024-02-09 18 34 25-Kesa solar - Wwise 2021.1.13.png|center|thumb]]
I'm only using windows plateform and English language but you can add/remove/modify :
[[File:2024-02-10 08 38 58-.png|center|thumb]]
[[File:2024-02-10 08 38 19-.png|center|thumb]]
Next step : importing your audio files. I'm using .wav format.
[[File:2024-02-09 18 35 12-.png|center|thumb]]
[[File:2024-02-09 18 36 43-Kesa solar - Wwise 2021.1.13.png|center|thumb]]
Select your wave file on your computer.
Then, import :
[[File:2024-02-09 18 37 25-Audio File Importer.png|center|thumb]]
My new sound appears on the list :
[[File:2024-02-09 18 38 28-Kesa solar - Wwise 2021.1.13.png|center|thumb]]
You can double click on you audio (for example if you want to set a loop) :
[[File:2024-02-09 18 40 54-Property Editor.png|center|thumb]]
And close the window.
Now, you have to set events with your audio for using in Unity : one for playing it, one for stopping it :
[[File:2024-02-09 18 44 46-.png|center|thumb]]
[[File:2024-02-10 05 45 52-Kesa solar - Wwise 2021.1.13.png|center|thumb]]
Clic on your new event for setting it :
[[File:2024-02-10 05 47 01-Kesa solar - Wwise 2021.1.13.png|center|thumb]]
Right clic on Target field for assign an audio to this event :
[[File:2024-02-10 05 47 57-Kesa solar - Wwise 2021.1.13.png|center|thumb]]
Select your audio :
[[File:2024-02-10 05 48 24-Kesa solar - Wwise 2021.1.13.png|center|thumb]]
Same event creation for stopping audio action :
[[File:2024-02-10 05 49 57-Kesa solar - Wwise 2021.1.13.png|center|thumb]]
Same for playing, assign your audio to this envent.
Now both events appear on the list :
[[File:2024-02-10 05 51 23-Kesa solar - Wwise 2021.1.13.png|center|thumb]]
To finish, you must assign new events to your soundbank. For that, select your soundbank and drag and drop your events on the bottom window :
[[File:2024-02-10 05 52 56-Kesa solar - Wwise 2021.1.13.png|center|thumb]]
Ok, ready now.
Now, just generate your soundbank for using it with Unity and your final mod :
[[File:2024-02-10 05 54 02-Kesa solar - Wwise 2021.1.13.png|center|thumb]]
[[File:2024-02-10 05 55 16-Generating SoundBanks - Completed.png|center|thumb]]
Your soundbank is now in your wwsise folder '''<Wwise Project>/GeneratedSoundBanks/Windows'''
You have to copy the file .bnk in your KSP2 mod folder '''<Your Mod>/assets/soundbanks/'''
Now, keep your Wwise Project open and start Unity.
=== Step 3 : Unity project ===
Normaly, both are connected. We will verify in the wwise picker window :
[[File:2024-02-10 06 18 27-kesasolar.Unity - Default - Windows, Mac, Linux - Unity 2022.3.5f1 DX11 .png|center|thumb]]
All your soundbank events normaly appear on this window.
I will show you 2 ways for using them.
==== Example 1 : add an engine sound ====
First, I create an empty gameobject for sound : u_amb_Engine
[[File:2024-02-10 06 24 23-kesa.Unity - Default - Windows, Mac, Linux - Unity 2022.3.5f1 DX11 .png|center|thumb]]
And on it few Components :
[[File:2024-02-10 06 25 59-Kesa solar - Wwise 2021.1.13.png|center|thumb]]
'''In Rigidbody, check "Is Kinematic" and uncheck "Use Gravity" !'''
Next, add audio Components :
[[File:2024-02-10 06 27 52-kesa.Unity - Default - Windows, Mac, Linux - Unity 2022.3.5f1 DX11 .png|center|thumb]]
[[File:2024-02-10 06 28 21-kesa.Unity - Default - Windows, Mac, Linux - Unity 2022.3.5f1 DX11 .png|center|thumb]]


END
END

Revision as of 09:07, 10 February 2024

[[Category:Parts modding]]

Sounds for parts with Wwise and Unity

First, install your Unity environment, SpaceWarp template, ....

There are already excellent tutorials that explain these steps:

https://github.com/SpaceWarpDev/SpaceWarp.Template

Category:Getting started

First step: Wwise

You need to create an account : https://www.audiokinetic.com/fr/products/wwise/

File:2024-02-09 16 13 04-Wwise Audiokinetic.png

Next : Install Wwise Launcher

File:2024-02-09 16 15 29-Wwise Audiokinetic.png

Wwise is free for a 200 sounds databank.


Ok, now a warning : When I started my mod, I couldn't get the sound to work with the latest 2023 version of Wwise.

So I continued to use version 2021 of Wwise to prepare my sounds and I integrated version 2023 of the Wwise libraries into Unity for maximum compatibility.

So I will explain how I did it but maybe you can try directly with the latest 2023 versions. If you succeed, let me know so that I can modify this tutorial.

So, this tutorial will first install version 2021 to be able to have a Wwise project in 2021 format then I update the Wwise libraries in Unity in 2023 format.


For these reasons, here are the versions of Wwise on my computer:

File:2024-02-09 16 17 46-Audiokinetic Launcher.png

Ok, now let's prepare the environment for Unity. Wwise normaly will found your existing projects. We'll integrate Wwise on projects now :

File:2024-02-09 16 24 33-Audiokinetic Launcher.png

Next, select Wwise version (2021.1.13.8036 for me) and plateform(s) you want :

File:2024-02-09 16 33 22-Audiokinetic Launcher.png

If some packages are missions for destination plateform(s), this message will appear :

File:2024-02-09 16 34 07-Audiokinetic Launcher.png

Clic Modify Wwise…. And add it.

The SDK is required. It should also be added.

File:2024-02-09 16 35 29-Paramètres.png

Clic on Next to perform installation.

When ok, come back to Unity integration.

If SDK is not set, choose it :

File:2024-02-09 16 30 58-Audiokinetic Launcher.png

Wwise project need to be created. For that, leave the field empty :

File:2024-02-09 16 32 18-Audiokinetic Launcher.png

Unity integration is ready :

File:2024-02-09 16 38 02-Paramètres.png

Then, clic on Integrate.

File:2024-02-09 16 48 45-Audiokinetic Launcher.png

Now that the Wwise project is created in 2021 format, I can update the Wwise libraries in the Unity project.

File:2024-02-09 17 21 46-Audiokinetic Launcher.png

It's OK. In the screenshot I can update to the latest version 2023. I won't do that because I'm sure everything is fine with the versions I chose.

I will do a test later for the latest updates.

File:2024-02-09 18 29 10-Audiokinetic Launcher.png

Normaly, now, your Wwise project will appear on the Wwise Launcher. I work on my projects with the 2021 version of Wwise. I will open the Wwise project that was created:

File:2024-02-09 18 31 21-Audiokinetic Launcher.png

Step 2 : Wwise project

You need to create your sound databank :

File:2024-02-09 18 32 27-Kesa solar - Wwise 2021.1.13.png
File:2024-02-09 18 33 01-Kesa solar - Wwise 2021.1.13.png

Your soundbank is now created.

File:2024-02-09 18 34 25-Kesa solar - Wwise 2021.1.13.png

I'm only using windows plateform and English language but you can add/remove/modify :

File:2024-02-10 08 38 58-.png
File:2024-02-10 08 38 19-.png

Next step : importing your audio files. I'm using .wav format.

File:2024-02-09 18 35 12-.png
File:2024-02-09 18 36 43-Kesa solar - Wwise 2021.1.13.png

Select your wave file on your computer.

Then, import :

File:2024-02-09 18 37 25-Audio File Importer.png

My new sound appears on the list :

File:2024-02-09 18 38 28-Kesa solar - Wwise 2021.1.13.png

You can double click on you audio (for example if you want to set a loop) :

File:2024-02-09 18 40 54-Property Editor.png

And close the window.

Now, you have to set events with your audio for using in Unity : one for playing it, one for stopping it :

File:2024-02-09 18 44 46-.png
File:2024-02-10 05 45 52-Kesa solar - Wwise 2021.1.13.png

Clic on your new event for setting it :

File:2024-02-10 05 47 01-Kesa solar - Wwise 2021.1.13.png

Right clic on Target field for assign an audio to this event :

File:2024-02-10 05 47 57-Kesa solar - Wwise 2021.1.13.png

Select your audio :

File:2024-02-10 05 48 24-Kesa solar - Wwise 2021.1.13.png

Same event creation for stopping audio action :

File:2024-02-10 05 49 57-Kesa solar - Wwise 2021.1.13.png

Same for playing, assign your audio to this envent.

Now both events appear on the list :

File:2024-02-10 05 51 23-Kesa solar - Wwise 2021.1.13.png

To finish, you must assign new events to your soundbank. For that, select your soundbank and drag and drop your events on the bottom window :

File:2024-02-10 05 52 56-Kesa solar - Wwise 2021.1.13.png

Ok, ready now.

Now, just generate your soundbank for using it with Unity and your final mod :

File:2024-02-10 05 54 02-Kesa solar - Wwise 2021.1.13.png
File:2024-02-10 05 55 16-Generating SoundBanks - Completed.png

Your soundbank is now in your wwsise folder <Wwise Project>/GeneratedSoundBanks/Windows

You have to copy the file .bnk in your KSP2 mod folder <Your Mod>/assets/soundbanks/

Now, keep your Wwise Project open and start Unity.

Step 3 : Unity project

Normaly, both are connected. We will verify in the wwise picker window :

File:2024-02-10 06 18 27-kesasolar.Unity - Default - Windows, Mac, Linux - Unity 2022.3.5f1 DX11 .png

All your soundbank events normaly appear on this window.

I will show you 2 ways for using them.

Example 1 : add an engine sound

First, I create an empty gameobject for sound : u_amb_Engine

File:2024-02-10 06 24 23-kesa.Unity - Default - Windows, Mac, Linux - Unity 2022.3.5f1 DX11 .png

And on it few Components :

File:2024-02-10 06 25 59-Kesa solar - Wwise 2021.1.13.png

In Rigidbody, check "Is Kinematic" and uncheck "Use Gravity" !

Next, add audio Components :

File:2024-02-10 06 27 52-kesa.Unity - Default - Windows, Mac, Linux - Unity 2022.3.5f1 DX11 .png
File:2024-02-10 06 28 21-kesa.Unity - Default - Windows, Mac, Linux - Unity 2022.3.5f1 DX11 .png






END