simple tts mp3
1.1.0
このパッケージは、Google-TTS-APIモジュールを使用してテキストからMP3オーディオファイルを作成する2つの方法を提供します。TypeScriptとも互換性があり、NPMで見つけてください!
あなたがそれが好きなら、githubに星を残してください
| 方法 | オプション[オプション] | 説明 |
|---|---|---|
| createaudiofile | テキスト、ファイル名、[言語= 'en'] | テキストからMP3オーディオファイルを作成し、その最終パスを返します-Promise(String) |
| Audiobufferを取得します | テキスト、[言語= 'en'] | テキストからMP3オーディオバッファーを作成して返します-Promise(バッファー) |
ex: ./folder/nameを含めることができます)。このパッケージでサポートされているすべての言語を表示するには、Wikiを確認してください。
npm install simple-tts-mp3 // Importing create file method from package
const { createAudioFile } = require ( 'simple-tts-mp3' ) ;
// Creates an "output.mp3" audio file with default English text
createAudioFile ( 'Hi, How are you?' , 'output' ) ;
// Creates an "output.mp3" audio file with Spanish text and promise resolved
createAudioFile ( 'Hola, ¿Cómo estás?' , 'output' , 'es' ) . then ( ( filepath ) => {
console . log ( filepath ) ;
} ) ;
// Creates an "output.mp3" audio file with Spanish text inside the "audios" folder and awaits filepath
const filepath = await createAudioFile ( 'Todo bien, gracias' , './audios/output' , 'es' ) ; // Importing create
const { getAudioBuffer } = require ( 'simple-tts-mp3' ) ;
// Creates an MP3 audio buffer with Spanish text and resolves the promise with it
getAudioBuffer ( 'Hola, ¿cómo estás?' , 'es' )
. then ( buffer => {
// Do something with the buffer
} ) ;
// Creates an MP3 audio buffer with default English text and awaits it
const buffer = await getAudioBuffer ( 'Hi, How are you?' ) ;