Joopst
Joopst
DIAdiscord.js - Imagine an app
Created by Joopst on 2/1/2023 in #djs-questions
Replying to a message
Yeah found it mb
8 replies
DIAdiscord.js - Imagine an app
Created by Joopst on 11/12/2022 in #djs-voice
Getting amplitude value from pcm stream
Outputs something like this
23.079337219775482
23.079337219775482
40.7620869525427
44.53559919238725
44.06395586687512
43.951678273428044
44.03326819268514
44.6989977410556
44.47046882648833
44.447959109342385
44.66329382799398
44.72887957632754
44.67471010522133
43.98916272199328
44.462545011909796
23.079337219775482
23.079337219775482
23.079337219775482
-Infinity
-Infinity
-Infinity
-Infinity
-Infinity
-Infinity
-Infinity
-Infinity
-Infinity
-Infinity
23.079337219775482
23.079337219775482
40.7620869525427
44.53559919238725
44.06395586687512
43.951678273428044
44.03326819268514
44.6989977410556
44.47046882648833
44.447959109342385
44.66329382799398
44.72887957632754
44.67471010522133
43.98916272199328
44.462545011909796
23.079337219775482
23.079337219775482
23.079337219775482
-Infinity
-Infinity
-Infinity
-Infinity
-Infinity
-Infinity
-Infinity
-Infinity
-Infinity
-Infinity
5 replies
DIAdiscord.js - Imagine an app
Created by Joopst on 11/12/2022 in #djs-voice
Getting amplitude value from pcm stream
connection.receiver.speaking.on('start', userId => {
if (!connection.receiver.subscriptions.has(userId)){
const opusStream = connection.receiver.subscribe(userId, {
end: {
behavior: EndBehaviorType.Manual,
},
});

//decode opus stream to pcm
const decoder = new prism.opus.Decoder({
rate: 48000,
channels: 2,
frameSize: 960,
});

const pcmStream = opusStream.pipe(decoder);

pcmStream.on('data', (chunk) => {
console.log(calcrms_db(chunk));
});
}
});
connection.receiver.speaking.on('start', userId => {
if (!connection.receiver.subscriptions.has(userId)){
const opusStream = connection.receiver.subscribe(userId, {
end: {
behavior: EndBehaviorType.Manual,
},
});

//decode opus stream to pcm
const decoder = new prism.opus.Decoder({
rate: 48000,
channels: 2,
frameSize: 960,
});

const pcmStream = opusStream.pipe(decoder);

pcmStream.on('data', (chunk) => {
console.log(calcrms_db(chunk));
});
}
});
5 replies
DIAdiscord.js - Imagine an app
Created by Joopst on 11/10/2022 in #djs-voice
Getting amplitude from opusStream
Thank you that's a good idea. Any idea how i would do this to a live pcm stream?
9 replies
DIAdiscord.js - Imagine an app
Created by Joopst on 11/10/2022 in #djs-voice
Getting amplitude from opusStream
I tought i would be able to get the amplitude from the buffer data the pcm stream outputs
9 replies
DIAdiscord.js - Imagine an app
Created by Joopst on 11/10/2022 in #djs-voice
Getting amplitude from opusStream
Yes i know
9 replies
DIAdiscord.js - Imagine an app
Created by Joopst on 11/9/2022 in #djs-voice
Receiving and playing back voice
So it's trying to remove the subscription but that don't work
11 replies
DIAdiscord.js - Imagine an app
Created by Joopst on 11/9/2022 in #djs-voice
Receiving and playing back voice
Looks like this happens after the silence
11 replies
DIAdiscord.js - Imagine an app
Created by Joopst on 11/9/2022 in #djs-voice
Receiving and playing back voice
So it registers me talking twice then crashes
11 replies
DIAdiscord.js - Imagine an app
Created by Joopst on 11/9/2022 in #djs-voice
Receiving and playing back voice
11 replies
DIAdiscord.js - Imagine an app
Created by Joopst on 11/9/2022 in #djs-voice
Receiving and playing back voice
with this code i get the following
11 replies
DIAdiscord.js - Imagine an app
Created by Joopst on 11/9/2022 in #djs-voice
Receiving and playing back voice
11 replies
DIAdiscord.js - Imagine an app
Created by Joopst on 11/9/2022 in #djs-voice
Receiving and playing back voice
Looks like i found the problem however
11 replies
DIAdiscord.js - Imagine an app
Created by Joopst on 11/9/2022 in #djs-voice
Receiving and playing back voice
To add onto this. I just added await enterState(connection, VoiceConnectionStatus.Ready, 5_000); underneath the joinVoiceChannel and the program aborts.
11 replies
DIAdiscord.js - Imagine an app
Created by Joopst on 11/9/2022 in #djs-voice
Receiving and playing back voice
11 replies