We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b3c27c6 commit a1eac01Copy full SHA for a1eac01
views/array_sound.gd
@@ -2,8 +2,7 @@ class_name ArraySound
2
extends Node
3
4
const SAMPLE_HZ = 44100
5
-const MIN_HZ = 110
6
-const MAX_HZ = 440
+const MIN_HZ = 110 # A2
7
8
var frac: float
9
var player = AudioStreamPlayer.new()
@@ -17,7 +16,8 @@ func _fill_buffer(pulse_hz):
17
16
_phase = fmod(_phase + increment, 1.0)
18
19
func _process(delta):
20
- _fill_buffer(MIN_HZ + (MAX_HZ - MIN_HZ) * frac)
+ # Each step of an already sorted array of size 32 <-> one semitone
+ _fill_buffer(MIN_HZ * pow(pow(2, 1.0 / 12), frac * 32))
21
22
func _init():
23
add_child(player)
0 commit comments