1. pygame
  2. pygame
  3. pygame


illume  committed 54adbc9

Allow to pass in a file name for the sound. Makes it also useful for

  • Participants
  • Parent commits 26ccf2b
  • Branches default

Comments (0)

Files changed (1)

File examples/sound.py

View file
  • Ignore whitespace
 don't even bother loading all of the pygame package. Just
 pick the mixer for sound and time for the delay function."""
-import os.path
+import os.path, sys
 import pygame.mixer, pygame.time
 mixer = pygame.mixer
 time = pygame.time
 #load the sound    
-file = os.path.join('data', 'secosmic_lo.wav')
+if len(sys.argv) > 1 and "wav" in sys.argv[1]:
+    file = sys.argv[1]
+    file = os.path.join('data', 'secosmic_lo.wav')
 sound = mixer.Sound(file)