当前位置: 首页>>代码示例>>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;未经允许,请勿转载。