Skip to content

Instantly share code, notes, and snippets.

@rniwase
Last active September 17, 2017 18:46
Show Gist options
  • Save rniwase/f36f037a4440104b5889 to your computer and use it in GitHub Desktop.
Save rniwase/f36f037a4440104b5889 to your computer and use it in GitHub Desktop.
「主よ、人の望みの喜びよ」をBeepで演奏 (winのみ)
import winsound
import time
frq = [392, 587, 659, 740, 784, 880, 988, 1047, 1175, 1319, 1480, 1568]
note = [-3, 1, 2, 3, 5, 4, 4, 6, 5, 5, 8, 7,
8, 5, 3, 1, 2, 3, 4, 5, 6, 5, 4, 3,
2, 3, 1, 0, 1, 2, -2, 0, 2, 4, 3, 2,
3, 1, 2, 3, 5, 4, 4, 6, 5, 5, 8, 7,
8, 5, 3, 1, 2, 3, -1, 5, 4, 3, 2, 1,
-2, 1, 0, 1, 3, 5, 8, 5, 3, 1, 3, 5, 8]
def beep(note, duration):
winsound.Beep(frq[note], duration)
if __name__ == "__main__":
print("amen")
for n in note:
beep(n + 3, 200)
time.sleep(0.1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment