jaemil
jaemil
Explore posts from servers
DIAdiscord.js - Imagine an app
Created by jaemil on 3/22/2024 in #djs-voice
Problem saving audioBuffer to file - whisper api
Hi, how can i convert the audioBuffer into a e.g. wav file? I want to use whisper for spech regognition. this is my code:
const tmpFile = await new Promise((resolve, reject) => {
tmp.file({ postfix: ".ogg" }, (err, path, fd, cleanup) => {
if (err) {
reject(err);
return;
}

fs.writeFile(path, msg.audioBuffer, (err) => {
if (err) {
reject(err);
return;
}

resolve({ path, cleanup });
});
});
});
const tmpFile = await new Promise((resolve, reject) => {
tmp.file({ postfix: ".ogg" }, (err, path, fd, cleanup) => {
if (err) {
reject(err);
return;
}

fs.writeFile(path, msg.audioBuffer, (err) => {
if (err) {
reject(err);
return;
}

resolve({ path, cleanup });
});
});
});
The file is written successfully, but I can't play it (unrecognized file format) I also tried to post audioBuffer directly, but that doesn't work either.
async function resolveSpeechWithWhisper(audioBuffer) {
const transcription = await openai.audio.transcriptions.create({
file: audioBuffer,
model: "whisper-1",
response_format: "verbose_json",
timestamp_granularities: ["word"],
});
}
async function resolveSpeechWithWhisper(audioBuffer) {
const transcription = await openai.audio.transcriptions.create({
file: audioBuffer,
model: "whisper-1",
response_format: "verbose_json",
timestamp_granularities: ["word"],
});
}
error: BadRequestError: 400 Could not parse multipart form at APIError.generate (/home/git/discord-speech-recognition/examples/simpleBot/node_modules/openai/error.js:44:20) at OpenAI.makeStatusError (/home/git/discord-speech-recognition/examples/simpleBot/node_modules/openai/core.js:263:33) at OpenAI.makeRequest (/home/git/discord-speech-recognition/examples/simpleBot/node_modules/openai/core.js:306:30) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Object.resolveSpeechWithWhisper [as speechRecognition] (/home/git/discord-speech-recognition/examples/simpleBot/index.js:20:25) {
"@discordjs/opus": "^0.8.0",
"@discordjs/voice": "^0.11.0",
"discord-speech-recognition": "^3.4.1",
"discord.js": "^14.3.0",
"dotenv": "^16.4.5",
"openai": "^4.29.2",
"tmp": "^0.2.3",
"tweetnacl": "^1.0.3"
"@discordjs/opus": "^0.8.0",
"@discordjs/voice": "^0.11.0",
"discord-speech-recognition": "^3.4.1",
"discord.js": "^14.3.0",
"dotenv": "^16.4.5",
"openai": "^4.29.2",
"tmp": "^0.2.3",
"tweetnacl": "^1.0.3"
Can anyone help me with this? Thanks
8 replies
RRailway
Created by jaemil on 4/28/2023 in #✋|help
Umami template doesn't work
Project id: c1b97597-d640-41a8-bc75-faba2aae29c4 There are no deployments listed (your project has no deploys), do I need to add them manually, how can I do that? Shouldn't it be deployed automatically?
25 replies
RRailway
Created by jaemil on 4/27/2023 in #✋|help
Problem with hosting authentication service
Hello, i have a problem with hosting my nodejs express application (getting a 503). Frontend and backend is successfully running as excepted. Link to auth server: https://auth.findnlink.com/ Service id: ffd2f9a6-afc0-4546-aa43-bc9b1935038a const PORT = process.env.PORT || 3000; const HOST = "0.0.0.0"; server.listen(PORT, HOST, () => { console.log(Findnlink Auth Server running on ${HOST}:${PORT}); app.emit("ready"); }); Thanks in advance
26 replies
RRailway
Created by jaemil on 4/26/2023 in #✋|help
Bitbucket support?
Is there a way to deploy a bitbucket repo?
6 replies