Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hyuki/c56227c71999d0a0d388a2761db8199a to your computer and use it in GitHub Desktop.
Save hyuki/c56227c71999d0a0d388a2761db8199a to your computer and use it in GitHub Desktop.
text-to-speech-quick-example-with-azure-in-japanese.js
// 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
@hyuki
Copy link
Author

hyuki commented Jun 12, 2021

ここにあるサンプルのままだと英語でWAVファイルになっちゃうので、config情報を書き換えたということです。

@hyuki
Copy link
Author

hyuki commented Jun 12, 2021

やったことは、

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment