def test_method(self): source = procedural.WhiteNoise(0.5) source = media.StaticSource(source) source = media.StaticSource(source) player = media.Player() player.queue(source) player.play() while player.source: player.dispatch_events()
def test_static_static(self): """You should hear white noise (static) for 0.5 seconds. The test will exit immediately after. """ source = procedural.WhiteNoise(0.5) source = media.StaticSource(source) source = media.StaticSource(source) player = media.Player() player.queue(source) player.play()
def load_source(name, path): """ Registers a new sound with the name "name" from the source specified by "path". Once a source has been loaded, you can play it by calling AudioPlayer.play("name") """ global _sources # Use pyglet.media to load the Source source = media.load(path, None, False) if source is not None: # Convert our source to a static source to allow for # overlapping playback static_source = media.StaticSource(source) _sources[name] = static_source else: print "Unable to load " + path + ", check path."
def load_sound(filename): fname = resource_filename(__name__, 'assets/sounds/%s' % filename) return media.StaticSource(media.load(fname))
from os.path import join from pyglet import media laser = media.StaticSource( media.load(join('sound_FX', 'Digital_SFX_Set', 'laser6.mp3'))) powerup = media.StaticSource( media.load(join('sound_FX', 'Digital_SFX_Set', 'powerUp6.mp3'))) projectile_generate_one = media.StaticSource( media.load(join('sound_FX', 'Digital_SFX_Set', 'phaseJump2.mp3'))) sword_slice = media.StaticSource( media.load(join('sound_FX', 'freesound.org', 'sword_slice.wav'))) sword_sharpen = media.StaticSource( media.load(join('sound_FX', 'freesound.org', 'sword_sharpen.wav'))) explosion = media.StaticSource( media.load(join('sound_FX', 'freesound.org', 'explosion.wav'))) music = media.StaticSource( media.load(join('sound_FX', 'Orbit-Beat-130', 'music.wav'))) win_music = media.StaticSource( media.load(join('sound_FX', 'freesound.org', 'triumph.wav'))) enemy_hit = media.StaticSource( media.load(join('sound_FX', 'freesound.org', 'hit.wav'))) enemy_die = media.StaticSource(