Every line of 'play sound in python' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.
152 def play_sound(filename): 153 """Play the given sound file using the `afplay` command line utility.""" 154 subprocess.Popen(['afplay', filename])
143 def __reduce_ex__(self,*args): 144 pass 145 def __str__(self,*args): 146 pass 147 CanRaiseEvents=property(lambda self: object(),lambda self,v: None,lambda self: None) 148 """Gets a value indicating whether the component can raise an event. 149 150 """
50 def playmusic2(soundfile): 51 """Stream music with mixer.music module using the event module to wait 52 until the playback has finished. 53 54 This method doesn't use a busy/poll loop, but has the disadvantage that 55 you neet to initialize the video module to use the event module. 56 57 Also, interrupting the playback with Ctrl-C does not work :-( 58 59 Change the call to 'playmusic' in the 'main' function to 'playmusic2' 60 to use this method. 61 """ 62 63 pygame.init() 64 65 pygame.mixer.music.load(soundfile) 66 pygame.mixer.music.set_endevent(pygame.constants.USEREVENT) 67 pygame.event.set_allowed(pygame.constants.USEREVENT) 68 pygame.mixer.music.play() 69 pygame.event.wait()
24 def play_sound(self): 25 try: 26 logging.info("Playing sound button") 27 # -- Play the sound -- 28 pygame.mixer.Sound(SOUND_PATH + self.sound_name).play() 29 # -- End play the sound -- 30 logging.info("End of sound button") 31 except: 32 logging.info("Fail to open the sound")
89 def play(self, track=None): 90 pass
11 def play_file(wavfile): 12 audio_file = open(wavfile, "rb") 13 wav = audioio.WaveFile(audio_file) 14 speaker.play(wav) 15 while speaker.playing: 16 pass
37 def play_file(wavfile): 38 f = open(wavfile, "rb") 39 wav = audioio.WaveFile(f) 40 a.play(wav)
169 def playSound(self, path, volume = 1): 170 pathes = game_settings['sfxpathes'] 171 types = game_settings['soundtypes'] 172 for ft in ((folder,type) for folder in pathes for type in types): 173 if exists(ft[0] + path + ft[1]): 174 path = ft[0] + path + ft[1] 175 break 176 play(path,self.sfxMgr, volume = volume)
36 def play_wav(cfn): 37 38 global wav16_dir, tts, corpus 39 40 wavfn = '%s/%s/%s.wav' % (wav16_dir, corpus, cfn) 41 42 with open(wavfn) as wavf: 43 wav = wavf.read() 44 45 tts.play_wav(wav, async=True)
152 DesignMode=property(lambda self: object(),lambda self,v: None,lambda self: None) 153 """Gets a value that indicates whether the System.ComponentModel.Component is currently in design mode. 154 155 """ 156 157 Events=property(lambda self: object(),lambda self,v: None,lambda self: None) 158 """Gets the list of event handlers that are attached to this System.ComponentModel.Component. 159 160 """