Twilight
Twilight
Explore posts from servers
SSolidJS
Created by Twilight on 5/23/2024 in #support
Universal rendering does not trigger re-render and onMount or onCleanup
🙏 it worked with node -C browser, thanks
7 replies
SSolidJS
Created by Twilight on 5/23/2024 in #support
Universal rendering does not trigger re-render and onMount or onCleanup
Thanks 🙏
7 replies
SSolidJS
Created by Twilight on 5/23/2024 in #support
Universal rendering does not trigger re-render and onMount or onCleanup
Hmm, is there no way to make it reactive on the server?
7 replies
SSolidJS
Created by Twilight on 5/23/2024 in #support
Universal rendering does not trigger re-render and onMount or onCleanup
output looks like this
interval 0 // inner interval
<root><view>The count is:<text>0</text></view></root> // outer interval
interval 1
<root><view>The count is:<text>0</text></view></root>
interval 2
<root><view>The count is:<text>0</text></view></root>
interval 0 // inner interval
<root><view>The count is:<text>0</text></view></root> // outer interval
interval 1
<root><view>The count is:<text>0</text></view></root>
interval 2
<root><view>The count is:<text>0</text></view></root>
7 replies
DIAdiscord.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)
// read your file
const input = fs.createReadStream('./my-file.ogg');
// create ogg demuxer, in this case it is used to parse opus packets
const oggDemuxer = new prism.opus.OggDemuxer(...);
// create opus decoder to get the raw audio packets
const decoder = new prism.opus.Decoder(...);

// create decoder pipeline
const pcm = input.pipe(oggDemuxer).pipe(decoder);

// define your transformer
class MyTransformer extends Transformer {
_transform(chunk, _, done) {
// perform some magic with the chunk
const modifiedChunk = ...;
this.push(modifiedChunk);
done();
}
}

// now pipe the raw audio stream to your transformer
const stream = pcm.pipe(new MyTransformer())

// now pass it to djs/voice for example, make sure to set stream type to raw
passToDiscordJS(stream, { type: StreamType.Raw })
// read your file
const input = fs.createReadStream('./my-file.ogg');
// create ogg demuxer, in this case it is used to parse opus packets
const oggDemuxer = new prism.opus.OggDemuxer(...);
// create opus decoder to get the raw audio packets
const decoder = new prism.opus.Decoder(...);

// create decoder pipeline
const pcm = input.pipe(oggDemuxer).pipe(decoder);

// define your transformer
class MyTransformer extends Transformer {
_transform(chunk, _, done) {
// perform some magic with the chunk
const modifiedChunk = ...;
this.push(modifiedChunk);
done();
}
}

// now pipe the raw audio stream to your transformer
const stream = pcm.pipe(new MyTransformer())

// now pass it to djs/voice for example, make sure to set stream type to raw
passToDiscordJS(stream, { type: StreamType.Raw })
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 look
10 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