1.1.16 • Published 3 months ago

tiktok-tts v1.1.16

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

tiktok-tts

This package provides a simple way to generate text-to-speech audio files from TikTok's text-to-speech (TTS) API in Node.js.

example workflow downloads

Installation

npm i tiktok-tts

Usage

Basic example

const { config, createAudioFromText } = require('tiktok-tts')

config('Your TikTok sessionid here');
createAudioFromText('Text to be spoken goes here');

Custom filename example

const { config, createAudioFromText } = require('tiktok-tts')

config('Your TikTok sessionid here');
createAudioFromText('Text to be spoken goes here', 'myAudio');

Generated audio file will be saved as myAudio.mp3

Custom path example

const { config, createAudioFromText } = require('tiktok-tts')

config('Your TikTok sessionid here');
createAudioFromText('Text to be spoken goes here', './myDirectory/myAudio');

Generated audio file will be saved as myAudio.mp3 inside the myDirectory directory.

⚠️ Please keep in mind that myDirectory needs to be an existing directory.

Custom voice example

const { config, createAudioFromText } = require('tiktok-tts')

config('Your TikTok sessionid here');
createAudioFromText('Text to be spoken goes here', 'myAudio', 'en_us_stormtrooper');

Using await with the createAudioFromText() function

const { config, createAudioFromText } = require('tiktok-tts')

config('Your TikTok sessionid here');

async function yourFunction(){
    await createAudioFromText('Text that will be spoken');
    console.log("Audio file generated!");
}

yourFunction();

Get TikTok Session id 🍪

  • Install Cookie Editor extension for your browser.
  • Log in to TikTok Web
  • While on TikTok web, open the extension and look for sessionid
  • Copy the sessionid value. (It should be an alphanumeric value)

Available functions

config(tiktokSessionId, customBaseUrl)
ParameterDescriptionDefaulttype
tiktokSessionIdYour TikTok sessionidnullString
customBaseUrlCustom TikTok API url optional-String
  • By default https://api16-normal-c-useast1a.tiktokv.com/media/api/text/speech/invoke will be used if no customBaseUrl is specified.
createAudioFromText(text, fileName, speaker)
ParameterDescriptionDefaulttype
textText to be converted to audionullString
fileNamefilename/path for the generated audio file optionalaudioString
speakerTikTok speaker code optionalen_us_001String

Speaker Codes

The following speaker codes are supported:

LanguageSpeakerSpeaker Code
EnglishGame Onen_male_jomboy
Jessieen_us_002
Warmes_mx_002
Wackyen_male_funny
Screamen_us_ghostface
Empatheticen_female_samc
Seriousen_male_cody
Beauty Guruen_female_makeup
Bestieen_female_richgirl
Tricksteren_male_grinch
Joeyen_us_006
Story Telleren_male_narration
Mr. GoodGuyen_male_deadpool
Narratoren_uk_001
Male English UKen_uk_003
Metroen_au_001
Alfreden_male_jarvis
ashmagicen_male_ashmagic
olantekkersen_male_olantekkers
Lord Cringeen_male_ukneighbor
Mr. Meticulousen_male_ukbutler
Debutanteen_female_shenna
Varsityen_female_pansino
Martyen_male_trevor
Pop Lullabyen_female_f08_twinkle
Classic Electricen_male_m03_classical
Baeen_female_betty
Cupiden_male_cupid
Grannyen_female_grandma
Cozyen_male_m2_xhxs_m03_christmas
Authoren_male_santa_narration
Caroleren_male_sing_deep_jingle
Santaen_male_santa_effect
NYE 2023en_female_ht_f08_newyear
Magicianen_male_wizard
Operaen_female_ht_f08_halloween
Euphoricen_female_ht_f08_glorious
Hypetrainen_male_sing_funny_it_goes_up
Melodramaen_female_ht_f08_wonderful_world
Quirky Timeen_male_m2_xhxs_m03_silly
Peacefulen_female_emotional
Toon Beaten_male_m03_sunshine_soon
Open Micen_female_f08_warmy_breeze
Jingleen_male_m03_lobby
Thanksgivingen_male_sing_funny_thanksgiving
Cottagecoreen_female_f08_salut_damour
Professoren_us_007
Scientisten_us_009
Confidenceen_us_010
Smoothen_au_002
DisneyGhost Faceen_us_ghostface
Chewbaccaen_us_chewbacca
C3POen_us_c3po
Stitchen_us_stitch
Stormtrooperen_us_stormtrooper
Rocketen_us_rocket
Madame Leotaen_female_madam_leota
Ghost Hosten_male_ghosthost
Pirateen_male_pirate
FrenchFrench - Male 1fr_001
French - Male 2fr_002
SpanishSpanish (Spain) - Malees_002
Spanish MX - Malees_mx_002
PortuguesePortuguese BR - Female 1br_001
Portuguese BR - Female 2br_003
Portuguese BR - Female 3br_004
Portuguese BR - Malebr_005
Ivete Sangalobp_female_ivete
Ludmillabp_female_ludmilla
Lhays Macedopt_female_lhays
Laizzapt_female_laizza
Galvão Buenopt_male_bueno
GermanGerman - Femalede_001
German - Malede_002
IndonesianIndonesian - Femaleid_001
JapaneseJapanese - Female 1jp_001
Japanese - Female 2jp_003
Japanese - Female 3jp_005
Japanese - Malejp_006
りーさjp_female_fujicochan
世羅鈴jp_female_hasegawariona
Morio’s Kitchenjp_male_keiichinakano
夏絵ココjp_female_oomaeaika
低音ボイスjp_male_yujinchigusa
四郎jp_female_shirou
玉川寿紀jp_male_tamawakazuki
庄司果織jp_female_kaorishoji
八木沙季jp_female_yagishaki
ヒカキンjp_male_hikakin
丸山礼jp_female_rei
修一朗jp_male_shuichiro
マツダ家の日常jp_male_matsudake
まちこりーたjp_female_machikoriiita
モジャオjp_male_matsuo
モリスケjp_male_osada
KoreanKorean - Male 1kr_002
Korean - Femalekr_003
Korean - Male 2kr_004
VietnameseFemaleBV074_streaming
MaleBV075_streaming
OtherAltoen_female_f08_salut_damour
Tenoren_male_m03_lobby
Sunshine Soonen_male_m03_sunshine_soon
Warmy Breezeen_female_f08_warmy_breeze
Gloriousen_female_ht_f08_glorious
It Goes Upen_male_sing_funny_it_goes_up
Chipmunken_male_m2_xhxs_m03_silly
Dramaticen_female_ht_f08_wonderful_world
1.1.16

3 months ago

1.1.15

4 months ago

1.1.14

6 months ago

1.1.13

7 months ago

1.1.9

12 months ago

1.1.8

12 months ago

1.1.7

12 months ago

1.1.6

12 months ago

1.1.12

8 months ago

1.1.11

8 months ago

1.1.10

11 months ago

1.1.5

1 year ago

1.1.4

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.0

1 year ago