gpt4 book ai didi

python - Audiomath 中的动态平移并不完全平滑

转载 作者:行者123 更新时间:2023-12-02 22:30:47 24 4
gpt4 key购买 nike

我一直在尝试获得类似于 audiomath examples 中的动态平移演示的效果:

import math
import audiomath as am
s = am.TestSound('12').MixDownToMono()
p = am.Player(s)
period_in_seconds = 4.0
p.Play(loop=True, pan=lambda t: math.sin(2 * math.pi * t / period_in_seconds))

但是,pan 听起来并不平滑:声音在中间时音量会增大,而在两侧则略微减弱。关于如何使这样的过渡听起来流畅的任何建议?

最佳答案

来自 .pan property docstring :

The way levels are computed from scalar values between -1 and +1 depends on .norm.



因此从 .norm property docstring :

For a Player instance p, if you set p.pan to a scalar value between -1 and +1, the relative levels of left and right channels are computed such that::

left ** p.norm + right ** p.norm = 1

The value p.norm=2 produces a natural-sounding pan but it means that stereo sounds are reduced to 70.71% of their maximum amplitude by default. So instead, the default is to use the infinity-norm, p.norm='inf', which ensures that the larger of the two sides is always 1.0



所以默认设置确实是一个不光滑的平底锅。添加 norm=2给您的 Player属性可能是要走的路——这将保持跨 channel 的总信号功率恒定。顺便说一句,判断这一点最敏感的方法是使用连续的音调刺激,就像你从 ToneTest() 获得的一样。 :
import math, audiomath as am
am.RequireAudiomathVersion('1.10')

period_in_seconds = 4.0
p = am.ToneTest(norm=2, pan=lambda t: math.sin(2 * math.pi * t / period_in_seconds) )
p.Play()
# now experiment with `p.norm` while it's playing

你也可以试试 norm=1 (保持 channel 幅度的总和不变,而不是功率)。

关于python - Audiomath 中的动态平移并不完全平滑,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60307636/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com