Socket
Socket
Sign inDemoInstall

tor-speech

Package Overview
Dependencies
35
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    tor-speech

Text speech api Yandex & Google + Tor


Version published
Weekly downloads
8
decreased by-42.86%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

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')
TorSpeech

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()
})()
google

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
keyvaluedefault valuerequiredinformation
texttexttest tor-speech modulenoscript
langCodeobjectlangCodes. russiannoscript 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()
})()
yandex

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
keyvaluedefault valuerequiredinformation
texttexttest tor-speech modulenoscript
langCodeobjectlangCodes.russiannoscript 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()
})()
langCodes

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

object
keyyandexgoogle
russianru_RUru
englishen_ENen
const langCodes = {
  russian: { yandex: 'ru_RU', google: 'ru' },
  english: { yandex: 'en_EN', google: 'en' }
}
saveFile

The saveFile function saves base64 as an audio file.

parametersdefault valuerequiredinformation
stringnullyesbase64 string
stringnullyespath 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: prohetamine@gmail.com

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.

Keywords

FAQs

Last updated on 08 Feb 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc