Updated SpatialiseScene Readme.

This commit is contained in:
Niall Moody 2020-12-08 15:47:09 +00:00
parent 2afa7e8414
commit 19d40ab8eb
2 changed files with 52 additions and 48 deletions

View file

@ -1,47 +1,51 @@
SpatialiseScene Notes SpatialiseScene Notes
--------------------- ---------------------
This scene demonstrates a couple of methods for spatialising Pure Data patches This scene demonstrates a couple of methods for spatialising Pure Data patches
in Unity. in Unity.
OculusSpatializer Plugin Method Working with Unity's default spatialisation
------------------------------- -------------------------------------------
This is the simplest method of spatialising patches in Unity. It requires the This method makes use of Unity's default audio spatialisation framework. It is a
following steps: bit more involved than the alternative approach, but doesn't an external
spatial audio framework.
For the project:
1.) Edit -> Project Settings... -> Audio. The first thing to note is that, by default, Unity only spatialises
2.) Set Spatializer Plugin to OculusSpatializer. AudioSources. It won't apply spatialisation to any other audio producing
Components (like LibPdInstance). In order to get around that limitation, we'll
For each Audio Source in the scene: need to cheat the system a bit.
1.) Toggle 'Spatialize' and 'Spatialize Post Effect' on.
After adding an AudioSource and LibPdInstance to a GameObject in your scene,
In testing it, the OculusSpatializer plugin seems to attenuate the sound quite the steps you'll need to take to spatialise your PD patch are:
aggressively, so an alternative approach is also included.
1.) Set the AudioSource's AudioClip to the included SpatialiserFix.wav file.
2.) Set the AudioSource to Play On Awake and Loop.
Alternative Method 3.) Adjust the Spatial Blend slider to 1 (3D).
------------------ 4.) In your PD patch, multiply the 2 outputs of an adc~ object by the output of
your patch before feeding it to the dac~ object.
This method makes use of Unity's default audio spatialisation framework. It is a
bit more involved than the OculusSpatializer approach, but doesn't attenuate the This process will ensure that the spatialisation applied to the AudioSource gets
sound as aggressively. applied to the output of your patch. See FilteredNoise-ADC.pd for more
information.
The first thing to note is that, by default, Unity only spatialises
AudioSources. It won't apply spatialisation to any other audio producing
Components (like LibPdInstance). In order to get around that limitation, we'll Working with spatializer plugins
need to cheat the system a bit. --------------------------------
After adding an AudioSource and LibPdInstance to a GameObject in your scene, Alternatively you can work with a custom spatialisation framework, using a
the steps you'll need to take to spatialise your PD patch are: Spatializer Plugin. Spatializer Plugins make implementation a bit simpler, but
they do require you to import a spatialisation framework into your project. The
1.) Set the AudioSource's AudioClip to the included SpatialiserFix.wav file. following example uses Steam Audio, but the steps are identical regardless of
2.) Set the AudioSource to Play On Awake and Loop. which framework you use.
3.) Adjust the Spatial Blend slider to 1 (3D).
4.) In your PD patch, multiply the 2 outputs of an adc~ object by the output of It should be noted that Spatializer Plugins are almost always intended for VR
your patch before feeding it to the dac~ object. (i.e. headphone) use. So this approach may not make sense if you're building a
project intended for speaker output.
This process will ensure that the spatialisation applied to the AudioSource gets
applied to the output of your patch. See FilteredNoise-ADC.pd for more For the project:
information. 1.) Edit -> Project Settings... -> Audio.
2.) Set Spatializer Plugin to Steam Audio Spatializer.
For each Audio Source in the scene:
1.) Toggle 'Spatialize' and 'Spatialize Post Effect' on.

View file

@ -492,7 +492,7 @@ public class LibPdInstance : MonoBehaviour
/// UnityEvent that will be invoked whenever we recieve a message from the PD patch. /// UnityEvent that will be invoked whenever we recieve a message from the PD patch.
public StringStringObjArrEvent Message; public StringStringObjArrEvent Message;
}; };
[Header("libpd -> Unity Events")] [Header("libpd Unity Events")]
public PureDataEvents pureDataEvents; public PureDataEvents pureDataEvents;
/// Events placed in a struct so they don't clutter up the Inspector by default. /// Events placed in a struct so they don't clutter up the Inspector by default.