async function synthesizeWelcomeSpeech()

in src/index.js [164:189]


async function synthesizeWelcomeSpeech(phrase, s3Key) {
  console.log("phrase: ", phrase, " s3Key: ", s3Key);

  let audioBuffer = '';
  let audioBuffer2 = '';

  try {
    audioBuffer = await synthesizeSpeechInternal(phrase, 'ssml', 'Joanna', 'en-US');
  } catch (error) {
    console.log(error);
    return null;
  }
  if (audioBuffer) {
    try {
      audioBuffer2 = await addWaveHeaderAndUploadToS3(audioBuffer, wavFileBucket, s3Key);
    } catch (error) {
      console.log(error);
      return null;
    }
  } else { return null; }

  if (audioBuffer2) {
    return audioBuffer2;
  }
  return null;
};