Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deno TTS aws s3 example is broken #57

Open
khcd opened this issue Oct 18, 2024 · 0 comments
Open

deno TTS aws s3 example is broken #57

khcd opened this issue Oct 18, 2024 · 0 comments

Comments

@khcd
Copy link

khcd commented Oct 18, 2024

examples/text-to-speech/deno/text-to-speech/text-to-speech-aws.ts

Screenshot 2024-10-18 at 11 00 30 am

current code results in data loss you can see via the files only sized in bytes

modified code to prevent data loss:

replace:
const content = new Uint8Array(chunks.flat());
with:
`
const totalLength = chunks.reduce((acc, chunk) => acc + chunk.length, 0);
const content = new Uint8Array(totalLength);

let offset = 0;
for (const chunk of chunks) {
content.set(chunk, offset);
offset += chunk.length;
}
`

above code is LLM suggested but I have functionally tested it.

Can submit PR if allowed.

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

No branches or pull requests

1 participant