tor-speech

    1.0.11 • Public • Published

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

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

    langCodes

    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' }
    }

    saveFile

    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: 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.

    Install

    npm i tor-speech

    DownloadsWeekly Downloads

    4

    Version

    1.0.11

    License

    ISC

    Unpacked Size

    26.9 kB

    Total Files

    7

    Last publish

    Collaborators

    • prohetamine