Python winsound.SND_FILENAME Examples

The following are 14 code examples of winsound.SND_FILENAME(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module winsound , or try the search function .
Example #1
Source File: ksp_plugin.py    From SublimeKSP with GNU General Public License v3.0 6 votes vote down vote up
def play(self, **kwargs):
        sound_path = os.path.join(self.dir, '{}.wav'.format(kwargs['command']))

        if sublime.platform() == "osx":
            if os.path.isfile(sound_path):
                call(["afplay", "-v", str(1), sound_path])

        if sublime.platform() == "windows":
            if os.path.isfile(sound_path):
                winsound.PlaySound(sound_path, winsound.SND_FILENAME | winsound.SND_ASYNC | winsound.SND_NODEFAULT)

        if sublime.platform() == "linux":
            if os.path.isfile(sound_path):
                call(["aplay", sound_path]) 
Example #2
Source File: action_playsound.py    From dragonfly with GNU Lesser General Public License v3.0 5 votes vote down vote up
def __init__(self, name='', file=None):
        """
            Constructor arguments:
             - *name* (*str*, default *empty string*) --
               name of the Windows system sound to play. This argument is
               effectively an alias for *file* on other platforms.
             - *file* (*str*, default *None*) --
               path of wave file to play when the action is executed.

            If *name* and *file* are both *None*, then waveform playback
            will be silenced on Windows when the action is executed. Nothing
            will happen on other platforms.

        """
        ActionBase.__init__(self)
        self._flags = 0
        if file is not None:
            self._name = file
            if os.name == 'nt':
                self._flags = winsound.SND_FILENAME
        else:
            self._name = name
            if os.name == 'nt':
                self._flags = winsound.SND_ALIAS

        # Expand ~ constructions and shell variables in the file path if
        # necessary.
        if file is not None or os.name != 'nt':
            self._name = os.path.expanduser(os.path.expandvars(self._name))

        self._str = str(self._name) 
Example #3
Source File: beep.py    From NoobSec-Toolkit with GNU General Public License v2.0 5 votes vote down vote up
def _win_wav_play(filename):
    import winsound

    winsound.PlaySound(filename, winsound.SND_FILENAME) 
Example #4
Source File: beep.py    From NoobSec-Toolkit with GNU General Public License v2.0 5 votes vote down vote up
def _win_wav_play(filename):
    import winsound

    winsound.PlaySound(filename, winsound.SND_FILENAME) 
Example #5
Source File: beep.py    From NoobSec-Toolkit with GNU General Public License v2.0 5 votes vote down vote up
def _win_wav_play(filename):
    import winsound

    winsound.PlaySound(filename, winsound.SND_FILENAME) 
Example #6
Source File: beep.py    From NoobSec-Toolkit with GNU General Public License v2.0 5 votes vote down vote up
def _win_wav_play(filename):
    import winsound

    winsound.PlaySound(filename, winsound.SND_FILENAME) 
Example #7
Source File: action_playsound.py    From dragonfly with GNU Lesser General Public License v3.0 5 votes vote down vote up
def __init__(self, name=None, file=None):
        ActionBase.__init__(self)
        if name is not None:
            self._name = name
            self._flags = winsound.SND_ASYNC | winsound.SND_ALIAS
        elif file is not None:
            self._name = file
            self._flags = winsound.SND_ASYNC | winsound.SND_FILENAME

        self._str = str(self._name) 
Example #8
Source File: _test_playsound.py    From dragonfly with GNU Lesser General Public License v3.0 5 votes vote down vote up
def __init__(self, name=None, file=None):
        ActionBase.__init__(self)
        if name is not None:
            self._name = name
            self._flags = winsound.SND_ASYNC | winsound.SND_ALIAS
        elif file is not None:
            self._name = file
            self._flags = winsound.SND_ASYNC | winsound.SND_FILENAME

        self._str = str(self._name) 
Example #9
Source File: gstreamer.py    From pychess with GNU General Public License v3.0 5 votes vote down vote up
def play(self, uri):
            try:
                winsound.PlaySound(None, 0)
                winsound.PlaySound(
                    url2pathname(uri[5:]), winsound.SND_FILENAME | winsound.SND_ASYNC)
            except RuntimeError:
                log.error("ERROR: RuntimeError while playing %s." %
                          url2pathname(uri[5:])) 
Example #10
Source File: core.py    From face_recognition_py with GNU General Public License v3.0 5 votes vote down vote up
def bellProcess(queue):
        logQueue = queue
        logQueue.put('Info:设备正在响铃...')
        winsound.PlaySound('./alarm.wav', winsound.SND_FILENAME)

    # TelegramBot推送进程 
Example #11
Source File: text2speech.py    From Printed-Text-recognition-and-conversion with MIT License 5 votes vote down vote up
def textPlay():
    f = open("output.txt", "r")

    text = f.read()


    # Language in which you want to convert
    language = 'en'

    # Passing the text and language to the engine, 
    # here we have marked slow=False. Which tells 
    # the module that the converted audio should 
    # have a high speed
    myobj = gTTS(text=text, lang=language, slow=False)
    myobj.save("welcome.wav")
    '''
    print('Playing')
    winsound.PlaySound("This is real this is me",winsound.SND_FILENAME)
    pygame.init()
    t= pygame.mixer.Sound("welcome.wav")
    t.play()'''

    os.system("start welcome.wav") 
Example #12
Source File: beep.py    From POC-EXP with GNU General Public License v3.0 5 votes vote down vote up
def _win_wav_play(filename):
    import winsound

    winsound.PlaySound(filename, winsound.SND_FILENAME) 
Example #13
Source File: beep.py    From EasY_HaCk with Apache License 2.0 5 votes vote down vote up
def _win_wav_play(filename):
    import winsound

    winsound.PlaySound(filename, winsound.SND_FILENAME) 
Example #14
Source File: wsr_module_loader_plus.py    From dragonfly with GNU Lesser General Public License v3.0 4 votes vote down vote up
def play_sound(sound, async_=True):
    if sound in sound_mappings: sound = sound_mappings[sound]
    winsound.PlaySound(sound, winsound.SND_FILENAME | (winsound.SND_ASYNC if async_ else 0))


# --------------------------------------------------------------------------
# Sleep/wake grammar.