Created
June 12, 2021 00:30
-
-
Save hyuki/c56227c71999d0a0d388a2761db8199a to your computer and use it in GitHub Desktop.
text-to-speech-quick-example-with-azure-in-japanese.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// cf. https://github.com/Azure-Samples/cognitive-services-speech-sdk/blob/master/quickstart/javascript/node/text-to-speech/index.js | |
var subscriptionKey = "99999999999999999999999999999999"; // Your Subscription Key. | |
var serviceRegion = "japaneast"; // "westus" | |
var filename = "output.mp3"; | |
var audioConfig = sdk.AudioConfig.fromAudioFileOutput(filename); | |
var speechConfig = sdk.SpeechConfig.fromSubscription(subscriptionKey, serviceRegion); | |
// https://docs.microsoft.com/en-us/javascript/api/microsoft-cognitiveservices-speech-sdk/speechsynthesisoutputformat?view=azure-node-latest | |
speechConfig.speechSynthesisOutputFormat = 5; // Audio16Khz64KBitRateMonoMp3; | |
// https://docs.microsoft.com/ja-jp/azure/cognitive-services/speech-service/language-support | |
speechConfig.speechSynthesisVoiceName = 'ja-JP-Ayumi'; // 'ja-JP-HarukaRUS','ja-JP-Ichiro' | |
// Example Result: https://audio.hyuki.net/20210612092121-780f03380bf2910f-output.mp3 | |
やったことは、
- Azureにアカウント作る
- 音声サービスとは - Azure Cognitive Services | Microsoft Docsというあたりを読んで、リソースの作成などの手順に従う。
- SDKダウンロードしてあちこち読んでサンプルを作って試す。
という感じです。
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ここにあるサンプルのままだと英語でWAVファイルになっちゃうので、config情報を書き換えたということです。