From Schmid.wiki
Jump to: navigation, search

winsound Module

A teeny tiny example that plays 'Tubular Bells':

from winsound import *
class Player:
    def note(self, p, o): return 261.625565301 * 2**(p/12.+o)
    def play(self, music):
        for n in music: Beep(int(self.note(n,0)), 130)
music = ([5,0,7,0,3,5,0,8,0,10,0,7,8,0] * 2 + [7,0]) * 2 + [5,5,5]
Player().play(music)

References