
Tor -Speech - Synthesizer คำพูดจากข้อความ
เมื่อฉันมีงานแปลงข้อความจากการแชทเป็นเสียงฉันสงสัยว่าจะทำอย่างไร แต่ฉันไม่พบสิ่งอื่นใดนอกจากบริการที่ชำระเงินหรือสคริปต์ที่ใช้ทรัพยากรมากในระหว่างการทดลองที่ฉันจัดการเพื่อเข้าถึง API ที่ชำระเงินของบริการค้นหา Yandex และ Google ฟรี ฉันหวังว่าการมีส่วนร่วมของฉันจะทำให้ง่ายขึ้นสำหรับชีวิตใครบางคน
ติดตั้งโมดูล NPM tor-speech
$ npm install tor-speechหรือ
$ yarn add tor-speechการเชื่อมต่อโมดูล
const TorSpeech = require ( 'tor-speech' ) ฟังก์ชั่น Torspeech เริ่มต้นการเชื่อมต่อกับเครือข่าย TOR ใช้เส้นทางไปยังไฟล์ไบนารี Tor เป็นพารามิเตอร์เดียวและส่งคืนวัตถุด้วยปุ่ม: Killtor, Yandex, Google, Langcodes, SaveFile อย่าลืมฆ่ากระบวนการ TOR หากคุณไม่ได้ใช้โมดูลกับ Killtor
const TorSpeech = require ( 'tor-speech' )
; ( async ( ) => {
const { killTor } = await TorSpeech ( )
killTor ( )
} ) ( ) ฟังก์ชั่น Google เหมือนกับฟังก์ชั่น Yandex ยอมรับวัตถุที่มีคีย์รวมถึงข้อความและ Langcodes ส่งคืน NULL หรือไฟล์เสียงใน Base64
| สำคัญ | ค่า | ค่าเริ่มต้น | ที่จำเป็น | ข้อมูล |
|---|---|---|---|---|
| ข้อความ | ข้อความ | ทดสอบโมดูล Tor-Speech | เลขที่ | สคริปต์ |
| langcode | วัตถุ | Langcodes ชาวรัสเซีย | เลขที่ | ภาษาสคริปต์ |
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 นั้นเหมือนกับฟังก์ชั่น Google ยอมรับวัตถุที่มีคีย์รวมถึงข้อความและ Langcodes ส่งคืน NULL หรือไฟล์เสียงใน Base64
| สำคัญ | ค่า | ค่าเริ่มต้น | ที่จำเป็น | ข้อมูล |
|---|---|---|---|---|
| ข้อความ | ข้อความ | ทดสอบโมดูล Tor-Speech | เลขที่ | สคริปต์ |
| langcode | วัตถุ | langcodes.russian | เลขที่ | ภาษาสคริปต์ |
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 นี่คือชุดรหัสภาษาสำหรับ Yandex และ Google synthesizers
| สำคัญ | Yandex | |
|---|---|---|
| ชาวรัสเซีย | ru_ru | ร. |
| ภาษาอังกฤษ | en_en | en |
const langCodes = {
russian : { yandex : 'ru_RU' , google : 'ru' } ,
english : { yandex : 'en_EN' , google : 'en' }
} ฟังก์ชั่น SaveFile บันทึก Base64 เป็นไฟล์เสียง
| พารามิเตอร์ | ค่าเริ่มต้น | ที่จำเป็น | ข้อมูล |
|---|---|---|---|
| สาย | โมฆะ | ใช่ | base64 สตริง |
| สาย | โมฆะ | ใช่ | PATH เพื่อบันทึกไฟล์เสียง |
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 ( )
} ) ( )โทรเลขของฉัน: @prohetamine, Channel
อีเมล: [email protected]
Donat Money: Patreon
หากคุณมีคำถามและ/หรือคำแนะนำใด ๆ โปรดส่งอีเมลถึงฉันในโทรเลขหากคุณพบข้อบกพร่องใด ๆ ก็แจ้งให้เราทราบฉันจะขอบคุณมาก