見出し画像

Windowsの自然な声をプログラム経由で利用できないか?

結論:利用できない!

概要

  • 以下の記事で、英文を自然な声で読み上げてもらうことに成功した

  • ナレーターを起動する手法は手間がかかるので(操作も難しいので)

  • もう少し楽な方法を模索している

Windowsアプリ

  • Windows.Media.SpeechSynthesisを使って音声合成を行うUWPアプリ(WindowsのStore系のアプリ)を作ってみる

    • System.Speech.Synthesisではないことに注意(はまった)

  • 以下は声の一覧を列挙するコード

using System;
//using System.Speech.Synthesis;
using Windows.Media.SpeechSynthesis;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using System.Diagnostics;

namespace App1
{
    public sealed partial class MainPage : Page
    {
        public MainPage()
        {
            this.InitializeComponent();
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            SpeechSynthesizer synthesizer = new SpeechSynthesizer();
            foreach (var v in SpeechSynthesizer.AllVoices)
            {
                Debug.WriteLine($"DisplayName:{v.DisplayName}, Language:{v.Language}");
            }
        }
    }
}

結果

  • 自然な声(ナチュラル系の声)は取得できなかった

DisplayName:Microsoft David, Language:en-US
DisplayName:Microsoft Zira, Language:en-US
DisplayName:Microsoft Ayumi, Language:ja-JP
DisplayName:Microsoft Haruka, Language:ja-JP
DisplayName:Microsoft Mark, Language:en-US
DisplayName:Microsoft Ichiro, Language:ja-JP

PowerShell

  • PowerShellでSpeechSynthesizerを使ってみる

  • 以下は、声の一覧を表示するコード

Add-Type -AssemblyName System.speech
$speak = New-Object System.Speech.Synthesis.SpeechSynthesizer
$speak.GetInstalledVoices()|ForEach-Object { $_.VoiceInfo }

参考にしたページ

結果

  • 自然な声(ナチュラル系の声)は取得できなかった

Gender                : Female
Age                   : Adult
Name                  : Microsoft Haruka Desktop
Culture               : ja-JP
Id                    : TTS_MS_JA-JP_HARUKA_11.0
Description           : Microsoft Haruka Desktop - Japanese
SupportedAudioFormats : {}
AdditionalInfo        : {[Age, Adult], [Gender, Female], [Language, 411], [Name, Microsoft Haruka Desktop]...}

Gender                : Female
Age                   : Adult
Name                  : Microsoft Zira Desktop
Culture               : en-US
Id                    : TTS_MS_EN-US_ZIRA_11.0
Description           : Microsoft Zira Desktop - English (United States)
SupportedAudioFormats : {}
AdditionalInfo        : {[Age, Adult], [Gender, Female], [Language, 409], [Name, Microsoft Zira Desktop]...}

Gender                : Male
Age                   : Adult
Name                  : Microsoft David Desktop
Culture               : en-US
Id                    : TTS_MS_EN-US_DAVID_11.0
Description           : Microsoft David Desktop - English (United States)
SupportedAudioFormats : {}
AdditionalInfo        : {[Age, Adult], [Gender, Male], [Language, 409], [Name, Microsoft David Desktop]...}

まとめ

  • あくまで、アクセシビリティの強化として、自然な声で読み上げる機能が追加されたのであって

  • ローカル環境の音声合成に自然な声が追加されたわけではない

    • 現状(2024/4)、ナレーター経由でしか使えないと思われる

  • 一方で、オンラインかつEdgeブラウザならば、利用できるとのことなので、次回試してみようと思う(参考にしたページによると)


この記事が参加している募集

英語がすき

この記事が気に入ったらサポートをしてみませんか?