如何在Windows中为VBS SAPI语音脚本设置输出音频设备?

时间:2019-09-18 19:00:53

标签: vbscript sapi

如何在SAPI语音脚本中更改输出音频设备?

下面的代码效果很好,但是我需要将音频发送到其他音频设备(特别是虚拟音频电缆,以便将其与Voicemeeter混合使用)。它可能看起来像“ CABLE-A输入(VB-音频电缆A)”。我在Google周围搜索,但找不到设置SAPI设备的有用信息。

从Windows 10命令行运行的现有VBS脚本如下:

Dim speaks, speech
mm_now=Month(date)
mmm_now=MonthName(mm_now)
dd_now=day(date)
yyyy_now=Right(year(date), 2)
speaks = " . . " & mmm_now & " " & dd_now & " twenty" & yyyy_now & ampm
Set speech=CreateObject("sapi.spvoice")
speech.Speak speaks

如何修改此脚本以将音频发送到其他设备?感谢您的帮助。

1 个答案:

答案 0 :(得分:0)

好的,我找到了一个解决方案,可能写得不好,但似乎可行。如果有人知道更优雅的解决方案,请随时答复。

(((all code above the line "sapi.Speak speaks")))

for i = 0 to speech.GetAudioOutputs.Count - 1
  s = speech.GetAudioOutputs.item(i).getdescription
  if (instr(s,"CABLE-B Input") > 0) then
     Set speech.AudioOutput = speech.GetAudioOutputs.item(i)
  End If
next

speech.Speak speaks
相关问题