# # soundExample.py # Version: June 10, 2009 # Loads a sound from the location specified by the user and plays it back. # JT's note: It appears that JES only works with certain types of sound files # which aren't too large. As a rule of thumb it's best to try playing only # wav files that are less than 100 Kilobytes (~100,000 bytes) in size. # (To help you out I included a sound file that I know will work). def soundExample (): # Prompt the user for the sound file to play. The location and name of the # file are stored in path. path = pickAFile () # Echo back what the user entered in case they selected so they can see # possible errors (e.g., selected a file that wasn't a sound). print "You want to play the sound ", path # Create a sound by loading the file from the location specified by the # user. aSound = makeSound (path) # Play the sound variable. play (aSound)