在 Unity3D 中更改音乐曲目的速度 [英] Changing tempo of music track in Unity3D

查看:788
本文介绍了在 Unity3D 中更改音乐曲目的速度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在不使用 FMOD 之类的任何声音引擎的情况下改变音乐曲目的速度?我知道通过在 AudioSource 中改变音高我可以改变音乐的速度,但你知道通过改变音高实际上可以完全改变音乐.

Is it possible to change tempo of music track without using any sound engines like FMOD ? I know by changing pitch in AudioSource I can change speed of music but you know by changing pitch actually the music can be completely changed.

推荐答案

如果您想要答案,这是我在 Unity 中找到的最佳方法.(实际上我的一个朋友建议采用这种方法)

If you want the answer it is the best approach which I've found in Unity. (Actually one of my friends suggest this approach)

  1. 创建混音器(左键单击项目文件夹 > 创建 > 混音器)
  2. 将混音器添加到检查器输出值中的 AudioSource
  3. 选择Audio Mixer > Master 在他的孩子下,点击Add Effect并选择Pitch shifter
  4. 选择 AudioSource 并将 Pitch 设置为 2(示例)
  5. AudioMixer Pitch 的 Pitch 设置为 0.5(示例)
  1. Create an Audio Mixer (Left click on project Folder > Create > Audio Mixer)
  2. Add the Audio Mixer to that AudioSource in Output value in the inspector
  3. Select the Audio Mixer > Master under his children, click Add Effect and select Pitch shifter
  4. Select the AudioSource and set the Pitch to 2 (Example)
  5. Set the Pitch of the AudioMixer Pitch to 0.5 (Example)

AudioSource PitchAudioMixer Pitch的计算公式:AudioMixer Pitch Value = 1/AudioSource Pitch Value

  • 如果您使用的 AudioSource Pitch 高于 2,那么您需要在 AudioMixer 中添加另一个 Audio Pitch Shifter 并设置两者的值以获得原始音高 (1)

这篇关于在 Unity3D 中更改音乐曲目的速度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆