forked from Talon/tardis-bot
Add code
This commit is contained in:
19
voice-test.js
Normal file
19
voice-test.js
Normal file
@@ -0,0 +1,19 @@
|
||||
const tts = require('google-tts-api');
|
||||
const fetch = require('node-fetch');
|
||||
const fs = require('fs');
|
||||
const buffer = require('buffer');
|
||||
|
||||
async function generateVoice(string) {
|
||||
const url = tts.getAudioUrl(string, {lang: "en-us"});
|
||||
console.log("Generated url: " + url);
|
||||
const data = await fetch(url);
|
||||
const contents = await data.arrayBuffer();
|
||||
const buf = Buffer.from(contents);
|
||||
fs.writeFileSync('speak.mp3', buf);
|
||||
}
|
||||
|
||||
async function test() {
|
||||
const url = await generateVoice("Hi there bud");
|
||||
}
|
||||
|
||||
test();
|
||||
Reference in New Issue
Block a user