how to get various sound waveforms in GDscript ? ....at least i got the Sin working!
as i follow the exemple on the Demo projects:
so, from this demo, the sin waveform is generated and it is working fine, even if it takes some memory.
i am now looking for other types of shapes:
i got this code for the sin:
var hz = 22050.0 var phase = 0.0 var pulse_hz = 440.0 var increment = (1.0 / (hz / pulse_hz)) ... playback.push_frame( Vector2(1.0,1.0) * sin(phase * (PI * 2.0)) ) # frames are stereo phase = fmod((phase + increment), 1.0) ...
how can i obtain the square waveform ? i am not so much into mathematic....