當前位置: 首頁>>代碼示例>>Python>>正文


Python winsound.SND_FILENAME屬性代碼示例

本文整理匯總了Python中winsound.SND_FILENAME屬性的典型用法代碼示例。如果您正苦於以下問題:Python winsound.SND_FILENAME屬性的具體用法?Python winsound.SND_FILENAME怎麽用?Python winsound.SND_FILENAME使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在winsound的用法示例。


在下文中一共展示了winsound.SND_FILENAME屬性的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: textPlay

# 需要導入模塊: import winsound [as 別名]
# 或者: from winsound import SND_FILENAME [as 別名]
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") 
開發者ID:ishita27,項目名稱:Printed-Text-recognition-and-conversion,代碼行數:25,代碼來源:text2speech.py

示例2: play

# 需要導入模塊: import winsound [as 別名]
# 或者: from winsound import SND_FILENAME [as 別名]
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]) 
開發者ID:nojanath,項目名稱:SublimeKSP,代碼行數:16,代碼來源:ksp_plugin.py

示例3: play_sound

# 需要導入模塊: import winsound [as 別名]
# 或者: from winsound import SND_FILENAME [as 別名]
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. 
開發者ID:dictation-toolbox,項目名稱:dragonfly,代碼行數:9,代碼來源:wsr_module_loader_plus.py

示例4: __init__

# 需要導入模塊: import winsound [as 別名]
# 或者: from winsound import SND_FILENAME [as 別名]
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) 
開發者ID:dictation-toolbox,項目名稱:dragonfly,代碼行數:33,代碼來源:action_playsound.py

示例5: _win_wav_play

# 需要導入模塊: import winsound [as 別名]
# 或者: from winsound import SND_FILENAME [as 別名]
def _win_wav_play(filename):
    import winsound

    winsound.PlaySound(filename, winsound.SND_FILENAME) 
開發者ID:krintoxi,項目名稱:NoobSec-Toolkit,代碼行數:6,代碼來源:beep.py

示例6: __init__

# 需要導入模塊: import winsound [as 別名]
# 或者: from winsound import SND_FILENAME [as 別名]
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) 
開發者ID:t4ngo,項目名稱:dragonfly,代碼行數:12,代碼來源:action_playsound.py

示例7: play

# 需要導入模塊: import winsound [as 別名]
# 或者: from winsound import SND_FILENAME [as 別名]
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:])) 
開發者ID:pychess,項目名稱:pychess,代碼行數:10,代碼來源:gstreamer.py

示例8: bellProcess

# 需要導入模塊: import winsound [as 別名]
# 或者: from winsound import SND_FILENAME [as 別名]
def bellProcess(queue):
        logQueue = queue
        logQueue.put('Info:設備正在響鈴...')
        winsound.PlaySound('./alarm.wav', winsound.SND_FILENAME)

    # TelegramBot推送進程 
開發者ID:winterssy,項目名稱:face_recognition_py,代碼行數:8,代碼來源:core.py


注:本文中的winsound.SND_FILENAME屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。