Skip to content

Perform trim() on the text after it has been modified (#13) - #17

Open
mahovich wants to merge 1 commit into
travisvn:mainfrom
mahovich:trim-text-after-modified
Open

Perform trim() on the text after it has been modified (#13)#17
mahovich wants to merge 1 commit into
travisvn:mainfrom
mahovich:trim-text-after-modified

Conversation

@mahovich

@mahovich mahovich commented Dec 3, 2025

Copy link
Copy Markdown

Perform a trim() on the text after deleting a chunk from it.

This solves issue #13.

If you don't clear the text in this example:

import { EdgeTTS } from 'edge-tts-universal';
import fs from 'fs/promises';

const text = 'The next paragraph is longer than 4096 characters.\n' + 'Lorem Ipsum. '.repeat(320);

const tts = new EdgeTTS(text);
const result = await tts.synthesize();
const audioBuffer = Buffer.from(await result.audio.arrayBuffer());
await fs.writeFile('output.mp3', audioBuffer);

then after changing the text, an error occurs where the next chunk size is 0, and further processing is interrupted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant