Created
March 17, 2019 17:22
-
-
Save sammosummo/ea1b006d1541c4f26ed6d554433d9c96 to your computer and use it in GitHub Desktop.
Simply generates a pure tone using numpy and plays it via sounddevice.
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
"""Simply generates a pure tone using numpy and plays it via sounddevice. | |
As always, make sure your volume settings are low before running this script, especially | |
if you are using headphones! | |
""" | |
import numpy as np | |
import sounddevice as sd | |
if __name__ == '__main__': | |
tone = np.sin(2 * np.pi * 440 * np.arange(0, 1, 1/44100)) # generate the tone | |
sd.play(tone, 44100) # play it | |
sd.wait() # wait for the tone to finish |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment