@jambonz/speech-utils 0.0.9 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,14 +2,12 @@ const assert = require('assert');
2
2
  const fs = require('fs');
3
3
  const bent = require('bent');
4
4
  const ttsGoogle = require('@google-cloud/text-to-speech');
5
- //const Polly = require('aws-sdk/clients/polly');
6
5
  const { PollyClient, SynthesizeSpeechCommand } = require('@aws-sdk/client-polly');
7
6
 
8
7
  const sdk = require('microsoft-cognitiveservices-speech-sdk');
9
8
  const TextToSpeechV1 = require('ibm-watson/text-to-speech/v1');
10
9
  const { IamAuthenticator } = require('ibm-watson/auth');
11
10
  const {
12
- AudioConfig,
13
11
  ResultReason,
14
12
  SpeechConfig,
15
13
  SpeechSynthesizer,
@@ -302,8 +300,7 @@ const synthMicrosoft = async(logger, {
302
300
  if (!content.startsWith('<speak')) content = `<speak>${text}</speak>`;
303
301
  }
304
302
  speechConfig.speechSynthesisOutputFormat = SpeechSynthesisOutputFormat.Audio16Khz32KBitRateMonoMp3;
305
- const config = AudioConfig.fromAudioFileOutput(filePath);
306
- const synthesizer = new SpeechSynthesizer(speechConfig, config);
303
+ const synthesizer = new SpeechSynthesizer(speechConfig);
307
304
 
308
305
  if (content.startsWith('<speak>')) {
309
306
  /* microsoft enforces some properties and uses voice xml element so if the user did not supply do it for them */
@@ -329,11 +326,8 @@ const synthMicrosoft = async(logger, {
329
326
  break;
330
327
  case ResultReason.SynthesizingAudioCompleted:
331
328
  stats.increment('tts.count', ['vendor:microsoft', 'accepted:yes']);
329
+ resolve(result.audioData);
332
330
  synthesizer.close();
333
- fs.readFile(filePath, (err, data) => {
334
- if (err) return reject(err);
335
- resolve(data);
336
- });
337
331
  break;
338
332
  default:
339
333
  logger.info({result}, 'synthAudio: (Microsoft) unexpected result');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jambonz/speech-utils",
3
- "version": "0.0.9",
3
+ "version": "0.0.10",
4
4
  "description": "TTS-related speech utilities for jambonz",
5
5
  "main": "index.js",
6
6
  "author": "Dave Horton",