resonance-audio / resonance-audio-unity-sdk

Resonance Audio SDK for Unity
https://resonance-audio.github.io/resonance-audio/develop/unity/getting-started
Other
297 stars 38 forks source link

Custom SurfaceMaterials #66

Open therusln opened 4 years ago

therusln commented 4 years ago

How can I access SurfaceMaterials to create my own and add properties? I'm aware that the enum with materials are on RoomManager, but couldn't find anything about their properties.

PatrickFSLin commented 4 years ago

I have the same issue

amilo commented 3 years ago

I also would like to know if there is a way to change them from Unity (maybe an overriding/writing script ?) It would be nice if rather than recompiling the source code we could add our own to the list. Maybe it can be helpful for you to know that their definition is here: https://github.com/resonance-audio/resonance-audio/blob/master/platforms/common/room_effects_utils.cc

jkammerl commented 3 years ago

Correct, the reflection coefficients for the different materials are defined here: https://github.com/resonance-audio/resonance-audio/blob/2fbf9c3b77de42aef5570b08243965226b48fdf4/platforms/common/room_effects_utils.cc#L34

See also comment: // Air absorption coefficients at 20 degrees Celsius and 50% relative humidity, according to: http://www.music.mcgill.ca/~gary/courses/papers/Moorer-Reverb-CMJ-1979.pdf

The Resonance Audio API can be configured with an individual set of RT60s via SetRoomProperties, see here: https://github.com/resonance-audio/resonance-audio/blob/f71b9d0ee508af724a46c87e894500eba4e23913/platforms/unity/UnityIntegration/Assets/ResonanceAudio/Scripts/ResonanceAudio.cs#L105

void SetRoomProperties(RoomProperties room_properties, float rt60s) If room_properties==null, then the second argument, the set of RT60s is used to configure the reverb. You need to provide 9 RT60's for the reverberation tail at the following octave band centres: 31.25 62.5 125 250 500 1000 2000 4000 8000 Hz.

I hope this helps!