Created
September 13, 2025 13:38
-
-
Save elderica/1c8bdda90ea2d72e38657b8fab006b13 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
import numpy | |
import pedalboard.io | |
wav_hz = 44100 | |
musictime = wav_hz * 5 | |
root = 1/(2**(1/2)) | |
frq1 = 1./440. | |
frq2 = 440. * root * root | |
def main(): | |
rawframes = [] | |
for t in range(musictime): | |
d1 = float(math.sin(2. * math.pi * frq1 * t / wav_hz)) | |
d2 = float(math.sin(2. * math.pi * frq2 * t / wav_hz)) | |
r = 12767. * (d1 + d2 / 2.0) | |
rawframes.append(r) | |
devname = pedalboard.io.AudioStream.output_device_names[0] | |
with pedalboard.io.AudioStream(output_device_name=devname) as stream: | |
audio = numpy.array(rawframes, dtype=numpy.float32) | |
stream.write(audio, wav_hz) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment