13 lines
351 B
JavaScript
13 lines
351 B
JavaScript
const BaseEngine=require('../BaseEngine');
|
|
const fetch = require('node-fetch');
|
|
const tts = require('google-tts-api');
|
|
|
|
module.exports= class extends BaseEngine {
|
|
constructor() {
|
|
super("Google Translate TTS","mp3");
|
|
}
|
|
async getSpeech(text, voice='en-us', params={}) {
|
|
const url = tts.getAudioUrl(text, {lang: voice});
|
|
return fetch(url);
|
|
}
|
|
}; |