2

Festival 音声合成プログラムが合成音声を Skype 通話にパイプできるように、PulseAudio を設定する小さな Python スクリプトがあります。これは、話すことができない人が通常の Skype グループ会議で発言できるようにするためです。

それは機能しますが、セットアップを機能させるには、PulseAudio ボリューム コントロール GUI との対話が多く含まれます。ターミナルのスクリプトで PulseAudio ストリームを設定するにはどうすればよいですか?

小さなスクリプトは次のとおりです。

import os
import subprocess
import signal

def main():

    raw_input(
        "\nReady to load a dummy sound card driver...\n" +\
        "Press Enter to continue."
    )
    os.system("sudo modprobe snd-dummy")
    raw_input(
        "\nReady to set Festival running...\n" +\
        "Press Enter to continue."
    )
    process_Festival = subprocess.Popen(
        ["festival", "--tts", "/var/log/dmesg"],
        preexec_fn = os.setsid
    )
    raw_input(
        "\nReady to open PulseAudio Volume Control...\n" +\
        "Press Enter to continue.")
    os.system("pavucontrol &")
    raw_input(
        "\nIn PulseAudio Volume Control, select the tab \"Playback\".\n" +\
        "Identify Festival in operaton.\n" +\
        "Change the output sink of Festival to \"Dummy Analog Stereo\".\n" +\
        "Press Enter to continue."
    )
    raw_input(
        "\nReady to stop Festival running...\n" +\
        "Press Enter to continue."
    )
    os.killpg(os.getpgid(process_Festival.pid), 9)
    raw_input(
        "\nIn PulseAudio Volume Control, select the tab \"Recording\".\n" +\
        "Start a Skype call to \"Skype Test Call\".\n" +\
        "In PulseAudio Volume Control, identify Skype in operation.\n" +\
        "Change the input source of Skype to \"Monitor of Dummy Analog " +\
        "Stereo\"\n" +\
        "End the Skype call.\n" +\
        "Press Enter to continue."
    )
    raw_input(
        "\nReady for text entry speech synthesis broadcast to Skype...\n" +\
        "Press Enter to continue (and then make the Skype call when ready).\n"
    )
    while True:
        text = raw_input("> ")
        os.system("echo \"{text}\" | festival --tts".format(text = text))

if __name__ == "__main__":
    main()
4

0 に答える 0