AudioMeasurement/Waveform.gd

29 lines
634 B
GDScript3
Raw Permalink Normal View History

2022-12-21 17:00:36 +00:00
extends ImmediateGeometry
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
func prepare():
self.clear()
self.begin(Mesh.PRIMITIVE_POINTS)
self.set_color(Color(0.5, 1, 0, 0.8))
func add_frame(frame):
self.add_vertex(Vector3(0,0,0))
for vec2 in frame: # should actually be frame[freq] = amplitude
var vec3 = Vector3(vec2[0], vec2[1], 0)
print(vec2)
self.add_vertex(vec3)
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass