We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Please describe the problem you are having in as much detail as possible:
Trying to decode opus data that come from open-ai tts
Include a reproducible code sample here, if possible:
import fs from "fs"; import path from "path"; import "openai/shims/node"; import OpenAI from "openai"; import { OpusEncoder } from "@discordjs/opus"; const openai = new OpenAI({ apiKey: "***" // replace this with open-ai key, }); const speechFile = path.resolve("./speech.ogg"); const speechFilePCM = path.resolve("./speech.pcm"); async function main() { const opusEncoder = new OpusEncoder(24000, 1); const opus = await openai.audio.speech.create({ response_format: "opus", model: "tts-1", voice: "alloy", input: Hello I am a human trying to speech my voice", }); const buffer = Buffer.from(await opus.arrayBuffer()); const decoded = await fs.promises.writeFile(speechFile, buffer); const testDecodedPCM = opusEncoder.decode(buffer); // FAIL HERE // const decodedPCM = await fs.promises.writeFile(speechFilePCM, testDecodedPCM); } main();
Further details:
@discordjs/opus version: 0.9.0
Node.js version: 16.20.1
Operating system: Mac os 14.1.2
Priority this issue should have – please be realistic and elaborate if possible:
The text was updated successfully, but these errors were encountered:
Are you sure the opus from OpenAI is encoded as 24000 bitrate?
Sorry, something went wrong.
No branches or pull requests
Please describe the problem you are having in as much detail as possible:
Trying to decode opus data that come from open-ai tts
Include a reproducible code sample here, if possible:
Further details:
@discordjs/opus version: 0.9.0
Node.js version: 16.20.1
Operating system: Mac os 14.1.2
Priority this issue should have – please be realistic and elaborate if possible:
The text was updated successfully, but these errors were encountered: