Code Monkey home page Code Monkey logo

tor-speech's Introduction

logo

README is available in the following languages: Russian | English

Tor Speech

tor-speech - Speech synthesizer from text.

Why ?

When I had the task to convert text from chat to voice, I wondered how to do it, but I did not find anything other than paid services or very resource-intensive scripts, during the experiments I managed to get access to the paid API of search services yandex and google free of charge. I hope my contribution will make it easier for someone life.

Get started

Install the npm module tor-speech

$ npm install tor-speech

or

$ yarn add tor-speech

Examples and description

Connecting the module

const TorSpeech = require('tor-speech')

The function TorSpeech initializes the connection to the Tor network takes the path to the tor binary file as a single parameter and returns an object with the keys: killTor, yandex, google, langCodes, saveFile. Don't forget to kill the Tor process if you don't use the module with killTor.

const TorSpeech = require('tor-speech')

;(async () => {
  const { killTor } = await TorSpeech()

  killTor()
})()

The function google is identical to the function yandex accepts an object whose keys include text and langCodes returns null or an audio file in base64.

object
key value default value required information
text text test tor-speech module no script
langCode object langCodes. russian no script language
const TorSpeech = require('tor-speech')

;(async () => {
  const { killTor, google, langCodes } = await TorSpeech()

  const result = await google({
    text: 'Hi, how are you?',
    langCode: langCodes.english
  })

  console.log(result)

  killTor()
})()

The function yandex is identical to the function google accepts an object whose keys include text and langCodes returns null or an audio file in base64.

object
key value default value required information
text text test tor-speech module no script
langCode object langCodes.russian no script language
const TorSpeech = require('tor-speech')

;(async () => {
  const { killTor, yandex, langCodes } = await TorSpeech()

  const result = await yandex({
    text: 'Hi, how are you?',
    langCode: langCodes.english
  })

  console.log(result)

  killTor()
})()

ObjectlangCode this is a set of language codes for yandex and google synthesizers.

object
key yandex google
russian ru_RU ru
english en_EN en
const langCodes = {
  russian: { yandex: 'ru_RU', google: 'ru' },
  english: { yandex: 'en_EN', google: 'en' }
}

The saveFile function saves base64 as an audio file.

parameters default value required information
string null yes base64 string
string null yes path to save the audio file
const TorSpeech = require('tor-speech')

;(async () => {
  const { killTor, google, langCodes, saveFile } = await TorSpeech()

  const base64 = await google({
    text: 'Hi, how are you?',
    langCode: langCodes.english
  })

  const isSave = await saveFile(base64, __dirname + '/google_hi_how_fuck_you.mp3')

  console.log(isSave)

  killTor()
})()

Contacts

My Telegram: @prohetamine, channel

Email: [email protected]

Donat money: patreon

If you have any questions and/or suggestions, please email me in telegram, if you find any bugs also let me know, I will be very grateful.

tor-speech's People

Contributors

prohetamine avatar jerroldneal avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.