gs-translate-speak
v1.0.5
Published
gs translate speak
Downloads
10
Maintainers
Readme
INSTALL
npm i gs-translate-speak
EXAMPLE
Example for Interpreter
//const { Interpreter } = require("gs-translate-speak"); // cjs
import { Interpreter } from "gs-translate-speak"
(async () => {
let speaker = new Interpreter({
input: "xin chào việt nam",
to: "en",
speed:1 //support interger -2 <->2
})
let output = await speaker.translate()
console.log(output) // Hello Vietnam
speaker.read("hello bro, im tvhop2201")
let output2 = await speaker.translate("vi")
console.log(output2) // xin chào anh, tôi là tvhop2201
let voice = await speaker.say() // return base64
fs.writeFileSync("./hehe.mp3", voice, { encoding: 'base64', })
})()
Example for Simple
//const { Simple } = require("gs-translate-speak"); // cjs
import { Simple } from "gs-translate-speak"
(async () => {
let T = new Simple()
let detect = await T.detect({
to: "vi",
input: "Hello Viet Nam",
})
console.log(detect) // { language: 'en', confidence: 0.32941613, spell: {}
let output = await T.translate({
to: "vi",
input: "Hello Viet Nam",
})
console.log(output) //Xin chào Việt Nam
let voice = await T.speak({ input: "anh hợp vạn tuế", to: "vi" }) //return base 64
fs.writeFileSync("./hehe2.mp3", voice, { encoding: 'base64', }) //save the voice
})()
Using proxy
new Interpreter({
to: "vi",
input: "Hello Viet Nam",
proxy: "http://username:[email protected]:port"
})
new Simple({
to: "vi",
input: "Hello Viet Nam",
proxy: "http://username:[email protected]:port"
})
Options
{
from?: string,
to?: string,
host?: string,
proxy?: string,
input?: string,
}