Sound libraries in MNSI take the form of a struct asset. Pictured bellow.
A blank sound library can be found in Located in MNSI-MainPlugin/MNSI_BasicSoundSet called MyCustomSoundSet, it is advised to copy this struct, rename the copy and work off of that.
What are they
They are essentially, a structure composed out of String->SoundBaseActor dictionaries. Strings act as a sort of key in of them selves. A key composed of two physical material names.
In essence, MNSI iterates over all sound libraries loaded and looks for a string key that matches either the collision event between the prop's own physical material, and the physical material of the surface being hit, Or if it fails to find one, to find the default sound set for the prop's own physical material.
The Structure part of the sound library struct should not be edited. It even says so in the Tooltip. The only area a user cares about is the Default Values below.
To add custom set, simply create a new blank value and write the name of the two physical materials to define a sound for the impact of.
Let's say Default_Stone and Default_Wood are two physical materials.
To define the sound that MNSI will play when A prop with the physical material Default_Stone will play when it collides with a surface using Default_Wood, simple add a new key for each of the 4 default values, and name it;
Then load a sound cue for each.
To create a fallback sound set for Default_Stone for MNSI to use when a Default_Stone prop collides with a physical material that is not defined, name it;
It is possible to define most of the physical materials as just DEFINTs and maybe add one or two specific keys for really noticeable differences.
For example cardboard sounds almost the same when it collides with wood or stone or metal, but when it collides with a grassy surface, the sound is perceptually different.
In this example the sound library might look like this;
Since a MNSI component can have several sound library structs, there are two ways they can be thought of.
A struct containing all the sounds needed in your project, Or. A struct per physical material. For example, all sounds related to wood physical materials can be held in a Wooden sound library and loaded alongside others.
Currently, it is advised to use as few sound libraries as possible, but for organizational purposes, several structs can end up being more practical to manage.
Loading sound libraries in MNSI
There is a pseudo-node like way to load sound libraries. It is an easy way to manage which libraries are loaded. Here is an example from the train demo on the main page. There is the default sound library loaded alongside the Train Set and MyCustomSoundLibrary.
How to load a library
- Open the MNSI component blueprint used in your project, located in MNSI-MainPlugin. It is called MNSI-PhysicsSounds. ((Or MNSI-PhysicsSounds_SkeletalMesh if adding libraries or skeletal meshes.)) Then navigate to the SoundLibraryHolder function, located under the Functions tab on the left. By default it looks like this.
- Sound libraries are loaded by adding a new struct variable. First click the plus to add a new variable, and give it any name needed.
- Change the variable type to be of the type of the new sound library needed. Sound Library Structs become their own types. So a sound library named "WoodCollection" will need a variable type of "WoodCollection.". Simply start typing the name of the sound library and it will get displayed automatically. Once that's done, Compile the blueprint.
- Once that's done drag it to the graph, and add a new Break node. Easiest way to do that is to drag out a connection from the pin of the struct, and type Break.
- Drag out the Concat function. It is what combines sound libraries together.
- Connect the outputs of the previous concat function to the new one. Make sure to link the pins properly. Concat pins go to the top, and bottom ones are for the new sound library. Make sure to connect the Type as well.
- That's all.