Twilight
Explore posts from serversDIAdiscord.js - Imagine an app
•Created by kriskotooBG on 1/13/2024 in #djs-voice
Volume normalization
10 replies
DIAdiscord.js - Imagine an app
•Created by kriskotooBG on 1/13/2024 in #djs-voice
Volume normalization
Basic idea of audio processing is like
source
-> transformer
-> destination
(basically a pipeline of streams)
you can construct it like this (note: this is just an example code, dont expect it to work)
simplest transformer of all is the volume transformer, where volume = volume * (value between 0 and 1)
which you'd use like chunk.readInt16LE(...) * 0.5
(50% volume) considering the raw audio is in s16le
format, which you'd have to write using chunk.writeInt16LE(...)
. This transformer exists inside prism-media's source code, you can take a look10 replies
DIAdiscord.js - Imagine an app
•Created by kriskotooBG on 1/13/2024 in #djs-voice
Volume normalization
You must convert whatever the format you have into raw audio first. After that, perform digital signal processing algorithms to make it do what you want.
FFmpeg is excellent at digital audio signal processing, but if you want to avoid it, implement your own. For volume normalization, you have to detect peaks first and then write something like dynamics compressor
I don't know much of the helper libs on npm for this, but for web, WebAudioAPI exists.
Also if you are performing it in real time, make sure your algorithm is fast, slight delay above ~10ms to 20ms can cause lag. Workaround is to use SIMD, so might as well explore webassembly or native code?
And another thing, you should not process entire file at once, it is not efficient. Utilize streams and process it in chunks
tldr; if everything happens inside a web browser, just use web audio api, otherwise implement your own dsp
10 replies
DIAdiscord.js - Imagine an app
•Created by dargy on 7/30/2023 in #djs-voice
AudioPlayer auto pauses on Ubuntu VPS but not on Windows?
Especially on linux
19 replies
DIAdiscord.js - Imagine an app
•Created by dargy on 7/30/2023 in #djs-voice
AudioPlayer auto pauses on Ubuntu VPS but not on Windows?
ffmpeg-static is not stable enough
19 replies
DIAdiscord.js - Imagine an app
•Created by dargy on 7/30/2023 in #djs-voice
AudioPlayer auto pauses on Ubuntu VPS but not on Windows?
I think it is because you are using ffmpeg-static
19 replies