VR系列——Oculus Audio sdk文档:四、传统Oculus声场定位技术的统一集成指南(4)——如何在Unity中使用Oculus声场定位技术

  准备好开始的时候,我们建议您创建一个新的Unity项目并导入OculusSpatializer.unitypackage,然后在OSP测试场景文件夹中观察OSPTest场景。这对熟悉相关资源和声场定位技术是一个很好的方法。
  To get started, we recommend that you create a new Unity project and import OculusSpatializer.unitypackage, and then have a look at the test scene OSPTest found in the folder OSPTestScene. This is a good way to become familiar with the OSP resources and to hear what the spatializer sounds like.

  在Unity中给音频添加空间定位,从/OSP/ Prefabs下预设的OSPManagerOSPAudioSource开始。
  To add spatialization to audio in Unity, start with the prefabs OSPManager and OSPAudioSource in /OSP/Prefabs.


OSPManager

  在场景中添加OSPManager来初始化空间定位引擎。OSPManager包含应用程序可以使用来改变声场定位特性的全局属性。
  Add OSPManager to a scene to initialize the spatialization engine. OSPManager contains global properties that the application can use to change the characteristics of the spatializer.


这里写图片描述

OSPManager属性

Bypass 禁用空间化。所有通过OSP音源的声音将会获取Unity本地二维平移。
Disables spatialization. All sounds routed through OSPAudioSource will get Unity native 2D panning.
Global Scale 传送到声场定位规模的刻度值必须设置为米。一些应用程序对单元有分配不同的刻度值。对于这样的应用,使用此字段来调整声场定位规模的刻度值。Unity默认每单元1米。
The scale of positional values fed into the spatializer must be set to meters. Some applications have different scale values assigned to a unit. For such applications, use this field to adjust the scale for the spatializer. Unity defaults to 1 meter per unit.
例如:对于一个在单元中设置为1厘米的应用程序,全局刻度为0.01(1厘米= 100米)。
Example: for an application with unit set to equal 1 cm, set the Global Scale value to 0.01 (1 cm = 100 m).
Gain 针对所有空间化的声音设置一个全局增益。由于空间化使整体的音量衰减,调整这个值,使得空间化与非空间化(或本地平移)的声音以相同的音量进行播放是非常重要的。
Sets a global gain to all spatialized sounds. Because the spatializer attenuates the overall volume, it is important to adjust this value so spatialized sounds play at the same volume level as non-spatialized (or native panning) sounds.
Enable(Early eflections) 允许早期反射被打开。早期反射增强空间化的效果,但会导致CPU受影响。
Allows early reflections to be turned on. Early reflections enhance the spatialization effect, but incurs a CPU hit.
Reverb On 当启用时,在输出增加一个固定的混响尾巴。这个混响是基于已经设置好的计算反射的房间参数计算的。
Adds a fixed reverb tail to the output when enabled. This reverb is calculated based on the room parameters that are set up to calculate the reflections.
Room Dimensions 设置用于计算反射的理论上房间的尺寸。尺寸越大,反射的距离越远。在当前描述符显示的范围内大写。
Sets the dimensions of the theoretical room used to calculate reflections. The greater the dimensions, the further apart the reflections. Room size currently caps at the range shown in the descriptor.
Reflection Values 设置每堵墙(左/右、向前/向后、向上/向下)反射的声音的百分比。值为0时,反射是完全吸收。值为1.0时,反射从墙上反弹回来没有任何吸收。上限低于1,以避免反馈。
Sets the dimensions of the theoretical room used to calculate reflections. The greater the dimensions, the further apart the reflections. Room size currently caps at the range shown in the descriptor.
Reflection Gain 此值将调整对反射信号的增益(包括早期反射和混响)。它是基于米为单位,代表反射信号衰减到零之前的移动距离。数字越大,反射信号的声音就越大。
This value will adjust the gain on the reflection signal (both early reflections and reverb). It is based in meters, which represents how far the reflection signal would travel before attenuating to zero. The greater the number, the louder the reflection signal will be in the final output.


笔记和最佳实践(Notes and Best practices)

  多达64位的声音可以被空间化。另外的声音使用本地的Unity2D平移直到立体音效槽被释放(例如,一个声音被空间化)。
  Up to 64 sounds may be spatialized. Additional sounds use native Unity 2D panning until a spatialized sound slot becomes free (e.g., a sound being spatialized stops).

  设置您的音频输出配置设置为2.1或2立体声声道配置(扬声器或耳机)。声场定位技术不会在更高信道的配置上工作。
  Set your audio output configuration is set to a 2.1 or 2 Stereo Channel Configuration (Speakers or Headphones). The spatializer will not work on higher channel configurations.

  请注意,用于计算反射的理论房间跟随听者的位置,并且根据听者的方向旋转。早期反射未来的实现将允许听者在固定的空间中自由走动。
  Note that the theoretical room used to calculate reflections follows the listener’s position and rotates with the listener’s orientation. Future implementation of early reflections will allow for the listener to freely walk around a static room.

  当使用早期反射时,确定要设置为非对称的空间维度。一个完美的立方体空间可以创建加强的回声,这可以导致声音被极低的空间化。空间大小应该大致与游戏中房间大小相符,游戏音频可以增强视觉效果。鞋盒模型模拟房间时效果最好。因为有了大的空间和室外区域,它应该在一个单独的混响上受到表扬。
  When using early reflections, be sure to set non-symmetrical room dimensions. A perfectly cubical room may create re-enforcing echoes that can cause sounds to be poorly spatialized. The room size should roughly match the size of the room in the game so the audio reinforces the visuals. The shoebox model works best when simulating rooms. For large spaces and outdoor areas, it should be complimented with a separate reverb.

  重要提示:当启用早期反射时,您必须确保将用来包含声音的房间大小设置为足够大的空间。如果一个声音跑到了房间相对听者的位置外面,早期反射将不会被听见。
  IMPORTANT: When early reflections are enabled, you must ensure that the room size is set to be large enough to contain the sound. If a sound goes outside the room size relative to the listeners position, early reflections will not be heard.


OSPAudioSource

  使用OSPAudioSource创造要被空间化的声音。OSPAudioSource由本地的Unity音频源组件和与Spatializer交互的OSPAudioSource脚本组件组成。
  Use OSPAudioSource to create sounds that will be spatialized. OSPAudioSource consists of a native Unity Audio Source component and an OSPAudioSource script component that interacts with the spatializer.


这里写图片描述

OSPAudioSource属性

  OSP作为一个附加到本地Unity音频源的组件运行。它的功能来自于音频源组件,包括距离衰减曲线。
  OSP works as an add-on to the native Unity Audio Source component. It derives much of its functionality from the Audio Source component, including the distance attenuation curves.

  注意:当手动触发声音时,你必须调用OSP音频源组件的播放停止功能。请参看OSPAudioSource.cs脚本,以获取一个可用的控制一个空间化声源的公共功能清单。
  Note: When triggering the sounds manually, you must call the OSPAudioSource component Play and Stop functions. Please look at the OSPAudioSource.cs script for a list of the public functions available to control a spatialized sound source.

  一些注意事项在下面的“注释与最佳实践”中详细列出。
  A few caveats are detailed in “Notes and Best Practices” below.

Bypass 如果你想跳过三维空间化并通过原生2D Unity播放音频,可使用此开关。此功能可在运行时方便的切换,可以更容易和更灵活的使OSP的音频源集成到现有的音频管理者中。
Use this toggle if you want the audio to skip 3D spatialization and play via native 2D Unity panning. This feature can be toggled for convenience during run-time, and may make integration of OSP Audio Sources into existing audio mangers easier and more flexible.
Play On Awake 我们建议你在OSPAudioSource而不是在本地的Unity AudioSource组件中使用此开关。启用在使用本地AudioSource组件启用Play On Awake,将会生效,但你可能会听到声音在声场定位技术试图获取空间资源时出现短暂的卡顿。
We recommend that you use this toggle in the OSPAudioSource instead of the one found in the native Unity AudioSource component. Enabling Play On Awake in the native AudioSource component will work, but you may hear a hiccup in the sound as the spatializer tries to obtain spatialization resources.
Disable Reflections 如果设置为true,这个声音实例将不计算反射/混响。对不需要有反射功能的声音使用此属性。反射占用额外的CPU资源,因此,对于降低整体音频处理器成本,这是一个很好的方法。注意,如果在全局OSP管理器禁用反射,此设置将不起作用。
If set to true, this sound instance will not calculate reflections/reverberation. Use this for sounds that do not need to have reflections enabled. Reflections take up extra CPU, so this is a good way to reduce the overall audio CPU cost. Note that if reflections are disabled globally within OSP manager, this setting will have no effect.

笔记和最佳实践(Notes and Best Practices)

  在Unity本地音频源组件内的三维音效设置,可被声音设计师使用。然而,当音频被空间化时,平移和扩散是被OSPAudioSource组件重写的:
  3D Sound Settings within the Unity native Audio Source component are available to be used by the sound designer. However, Pan Level and Spread are overridden by the OSPAudioSource component while audio is being spatialized:


这里写图片描述

  很重要的一点是当声音正在通过声场定位器时不要去修改这些值,否则将极大地影响空间化的输出。
  It is important not to modify these values while sound is running through the spatializer, or it will dramatically affect the output of the spatialization.

  请确保在音频资源导入设置中您勾选了【3D Sound】复选框(仅有Unity 4有;Unity 5没有该选项)。
  Please ensure that you check the 3D Sound check box in audio asset import settings (Unity 4 only; Unity 5 does not include this option).

  目前,只有单声道声音可以空间化。立体声无法坍缩成单声道声(即使在Unity 中用户设置为3D选项)。因此,空间化的声音不会使用立体声来传播从而使声音环绕聆听者仿佛一切都很近一样。这是目前空间化技术比较普遍的经验。
  Currently, only monophonic sounds will spatialize. A stereo sound will not be collapsed down to a monophonic sound (even if it is set by the user in Unity as a 3D sound). As such, a spatialized sound may not use stereo spread to make a sound encompass the listener as it gets closer - this a common practice for current spatialization techniques.


Unity 中OSP版本迁移(OSP Version Migration in Unity)

  要迁移到一个新版本的Oculus声场定位插件的Unity,只需打开一个现有的Unity项目然后导入OculusSpatializer.unitypackage(包名)的新版本,它被包含在Audio SDK中。
  To migrate to a new version of the Oculus Spatializer Plugin for Unity, just open an existing Unity project and import the new version of OculusSpatializer.unitypackage included in the Audio SDK.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值