from math import exp, log import numpy as np import matplotlib.pyplot as plt plt.style.use("bmh") import sounddevice as sd def frec(nota: int, octava: int) -> int: expo = octava * 12 + (nota - 58) return int(440 * ((2 ** (1 / 12)) ** expo)) framerate = 44100 duration = 1000 t = np.linspace(0, duration / 1000, int(framerate * duration / 1000)) frequency = frec(10, 4) # LA4 data = np.sin(2 * np.pi * frequency * t) def beep(nota: int, octava: int, duracion: int) -> None: framerate = 44100 t = np.linspace(0, duracion / 1000, int(framerate * duracion / 1000)) frequency = frec(nota, octava) data = np.sin(2 * np.pi * frequency * t) sd.play(data, framerate) sd.wait() for i in range(1, 13): beep(i, 4, 1000)