Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Sound Demo
# Simple demo of playing a looping sound using the (currently undocumented) sound.Player class
import sound
import os
from scene import *
class MyScene (Scene):
def setup(self):
self.player = sound.Player(os.path.expanduser('~/'))
self.player.number_of_loops = -1 #repeat forever
self.playing = False
def draw(self):
background(0, 0, 0)
x, y = self.size.w * 0.5, self.size.h * 0.5
text('Touch to play/pause', 'Helvetica', 30, x, y)
def touch_began(self, touch):
if self.playing:
self.playing = not self.playing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.