The Big E in Math -> Σ
The Big E in Math -> Σ
Explore posts from servers
DIAdiscord.js - Imagine an app
Created by The Big E in Math -> Σ on 5/26/2024 in #djs-voice
Reduce playing audio latency
Hi, I'm currently trying to convert an incoming audio stream (mulaw) to raw opus bitstream. Using ffmpeg and inputType as raw, I'm able to achieve it, but that introduces 3s of latency. Unfortunately, the incoming stream is real-time data, so this latency has to be reduced. I did manipulate around with ffmpeg, and got it to play a quiet popping noise under 1s (ofc that only happens when the stream audio is very loud). Here's my current ffmpeg setup (which doesn't work). Is there anything else I need to transform in stream for it to work?
// receiveRawStream is the raw mulaw Buffer
ffmpeg(receiveRawStream)
.inputOptions([
"-f mulaw",
"-ar 8000",
"-ac 1"
])
.outputOption([
"-c:a libopus",
"-f ogg",
"-ar 48000",
"-ac 2",
])
.on("error", (err)=>{
console.log(err);
})
.pipe(new opus.OggDemuxer(), {end: false}) // The demuxer is from "prism-media" package
.pipe(receiveffmpegStream);
/// receiveffmpegStream is the final stream before it's piped to createAudioResource (configured with StreamType.Opus)
// receiveRawStream is the raw mulaw Buffer
ffmpeg(receiveRawStream)
.inputOptions([
"-f mulaw",
"-ar 8000",
"-ac 1"
])
.outputOption([
"-c:a libopus",
"-f ogg",
"-ar 48000",
"-ac 2",
])
.on("error", (err)=>{
console.log(err);
})
.pipe(new opus.OggDemuxer(), {end: false}) // The demuxer is from "prism-media" package
.pipe(receiveffmpegStream);
/// receiveffmpegStream is the final stream before it's piped to createAudioResource (configured with StreamType.Opus)
Node Version: 20.12.2 DJS Version: 14.15.2
6 replies
DIAdiscord.js - Imagine an app
Created by The Big E in Math -> Σ on 10/21/2022 in #djs-questions
401 error when editing command permission
Hey, when I tried to use bot's token to set command permission, I get 401 error. Am I missing any permission scopes?
guild.commands.permissions.set({
command: "CmDID",
token: config['botToken'],
permissions: commandPermConfig,
})
guild.commands.permissions.set({
command: "CmDID",
token: config['botToken'],
permissions: commandPermConfig,
})
6 replies