fuck
This commit is contained in:
26
tts/watson/index.js
Normal file
26
tts/watson/index.js
Normal file
@@ -0,0 +1,26 @@
|
||||
const BaseEngine=require('../BaseEngine');
|
||||
const fetch = require('node-fetch');
|
||||
const querystring = require('querystring');
|
||||
|
||||
module.exports= class extends BaseEngine {
|
||||
constructor() {
|
||||
super("IBM Watson TTS","ogg");
|
||||
}
|
||||
async getSpeech(text, voice='en-us', params={}) {
|
||||
const url = process.env.watsonURL+"/v1/synthesize";
|
||||
let buff=new Buffer('apikey:'+process.env.watsonAPIKey);
|
||||
let b64auth=buff.toString('base64');
|
||||
const authorization='Basic '+b64auth;
|
||||
const opts={
|
||||
method: "post",
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': authorization
|
||||
},
|
||||
body: {
|
||||
text: text
|
||||
}
|
||||
};
|
||||
return fetch(url);
|
||||
}
|
||||
};
|
Reference in New Issue
Block a user