在unity3d无缝循环 [英] Gapless looping in unity3d

查看:344
本文介绍了在unity3d无缝循环的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在这个挣扎了几天现在已经...:(

I've been struggling with this for some days already now ... :(

我读过这些线程:无缝-的MP3播放无缝循环iOS上,的无缝循环iOS上生产无缝循环的MP3 的。也有点理论在这里: mp3Loops

I've read these threads: Gapless-MP3-playback, Gapless looping on iOS, Gapless looping on iOS Producing seamless looping mp3s. Also a bit of theory here: mp3Loops

我做的指示:导入WAV文件,选择MPEG编码,勾选无间隙循环框

I am doing as instructed: Import WAV files, select MPEG encoding, check the "gapless looping" box


  • 只是为未来的Google一记。在很老的版本统一,有一个无间隙循环按钮(自2014年左右删除)。事实上,该按钮被彻底打破,并没有采取任何行动。

  • just a note for future googlers. In very old versions of Unity, there was a "gapless looping" button (removed since about 2014). In fact, that button was completely broken and did nothing.

并使其循环:

    var gameObject2 = new GameObject("MyObject");
    audioSource2 = gameObject2.AddComponent<AudioSource>();

    var filename = "test01_1152x";
    audioClip2 = Resources.Load (filename) as AudioClip;
    audioSource2.clip = audioClip2;
    audioSource2.loop = true;
    audioSource2.Play();

然而,啪的声音是非常明显的。

However the "pop" sound is terribly obvious.

我不知道我缺少什么?

检查无缝循环只是好一点,但它并没有避免啪的一声100%。
如果给定的文件是错误的或不最好针对这种情况,什么情况下应该在文件中才能有一个很好的无缝循环BGM fullfill?

Checking "gapless looping" is just a bit better but it does not avoid the "pop" sound 100%. If the file given is wrong or not best for this situation, what conditions should the file fullfill in order to have a nice gapless looping bgm?

这是我试过的各种设置的图片,包括原始波形文件

These are the pictures of various settings I've tried, including the original wave file

原波:环路很好,因为它是WAV。

Original Wave: Loops nicely, because it is WAV.

的COM pressed如MPEG(非无缝循环选择),啪的声音是超级明显,而listeninig它。

Compressed as MPEG (Non gapless looping selected), "pop" sound is super obvious while listeninig it.

的COM pressed如MPEG(循环选择无间隙),啪的声音依然明显,只是有点不是设置好。

Compressed as MPEG (Gapless looping selected), "pop" sound is still obvious, just a bit better than setting.

推荐答案

很容易看到剪辑并不适合无缝循环。
我不需要玩这些剪辑听CLIC和你提到的流行,它是pretty从您发布的波形明显。想想音频剪辑重复的纹理或图案浑然一体的,起点和终点必须匹配,并且实现这一目标的最简单方法是通过削减剪辑时,波的振幅为0。

it is easy to see that the clips are not well suited for gapless looping. I don't need to play those clips to listen to the clic and the pop you mention, it is pretty obvious from the waveform you posted. Think of audio clips as repeatable textures or seamless patterns, the start and end needs to match, and the easiest way to achieve this is by cutting the clip when the amplitude of the wave is 0.

参见WAV格式的罪波是如何顺利相比其他格式?原因是pssed如MP3质量损失和信息格式,COM $ P $,恶化质量。看到COM pressed波不启动顺畅,他们开始用一条直线将呈现为噪声。

See how smooth is the "sin" wave on the WAV format compared to the other formats? The reason is that compressed format like MP3 loss quality and information, deteriorating the quality. See that the compressed waves don't start smooth, they start with a straight line which will render as noise.

所以,如果你增加kbps的(少COM pression),你将有更好的结果。但我仍强烈建议你去争取更好的成绩WAV格​​式,这就是团结的短的声音说:

So if you increase the kbps (less compression) you will have far better results. But still I strongly suggest that you go with the WAV format for better results, this is what Unity states for short sounds:

根据经验,一般情况下,COM pressed音频(或模块)是最好的长文件,例如背景音乐或对话,而原住民是短的声音效果更好

"As a general rule of thumb, Compressed audio (or modules) are best for long files like background music or dialog, while Native is better for short sound effects"

音频片段 - 导入音频资产

和关于有一个很好的无间隙BGM你需要将其导出为WAV文件之前使用应该是一个很好的工具,一个可以让你砍,修剪,拉伸和测试音频回路。我个人使用步态声纳。这里是你的图像组成一个很好的循环的声音,看我怎么砍的声音在振幅接近0。

And regarding "have a nice gapless bgm" you need to use a good tool for that, one that allows you to cut, trim, stretch and test the audio loop before you export it to a wav file. I personally use Cakewalk SONAR. Here is an image of you compose a nice looping sound, see how I cut the sound when the amplitude is near "0".

最后一件事,如果你有多个同时播放的声音,你就不能充分利用MP3的硬件解码,大多数移动设备只允许一个声音是DECOM $ P $硬件pssed,其他的声音将被CPU呈现

One last thing, if you have several sounds playing simultaneously you won't be able to take advantage of hardware decoding of MP3, most mobile devices only allow for one sound to be decompressed by hardware, the other sounds will be rendered by the CPU.

在此另一幅画我将展示如何正确地从一个不褪色像previous例如一段较长的切割声加入影片箱

In this other picture I show how to properly cut a loopable sound from a longer piece that does not fade like in the previous example.

这篇关于在unity3d无缝循环的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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