async function synthesizeSpeechInternal()

in src/index.js [252:275]


async function synthesizeSpeechInternal(text, textType, voiceID, languageCode) {
  let pollyparams = {
    'Text': text,
    'TextType': textType,
    'OutputFormat': 'pcm',
    'SampleRate': '8000',
    'VoiceId': voiceID,
    'LanguageCode': languageCode
  };

  var pollyResult;
  try {
    pollyResult = await polly.synthesizeSpeech(pollyparams).promise();
  } catch (error) {
    console.log(error);
    return null;
  }
  if (pollyResult.AudioStream.buffer) {
    return pollyResult.AudioStream.buffer;
  }
  else {
    return null;
  }
}