我一直在遵循
調頻調制示例
extends Control
var time: float = 0.0
var frequency: float = 2
var modulation_index : float = 4
var modulation_frequency : float = 0.2
const pixels_per_x = 100; # zoom on x
const pixels_per_y = 100; # zoom on y
func _physics_process(delta):
var point : Vector2
time = delta
var fm_signal = cos( (2 * PI * frequency * time) modulation_index*sin(2 * PI * modulation_frequency * time) ) # this is another method that adds offset onto phase
point.y = pixels_per_y * (fm_signal)
point.x = pixels_per_x * (time)
$Line2D.add_point(point)

uj5u.com熱心網友回復:
你的 AM 對我來說看起來不錯,我沒有看到頻率變化,公式也可以(如果你的amplitude(time) = 200.0*time)。但是我看到一個問題,那就是你“增加”了y =錯誤但應該是的軸y=,因為 x 值沒問題。
調頻是錯誤的,我希望至少是線性插值,你首先需要一些約束/常量:
f0 - min output frequency
f1 - max output frequency
a0 - min value of input signal
a1 - max value of input signal
A(t) - input signal you want to modulate with
B - output amplitude
t - time
然后:
// constants
B = 200.0
a0 = 0.0
a1 = amplitude * time_duration
f0 = 1500.0
f1 = 2500.0
---------------------
t = delta
A = amplitude*time
f = f0 (f1-f0)*(A-a0)/(a1-a0)
point.y = B * cos(f * t) * delta
point.x = 100.0 * delta
您可能還想將夾緊添加f到<f0,f1>...
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/537660.html
標籤:数学公式三角函数戈多脚本
上一篇:根據角度查找橢圓中點的坐標
