2 Commits

Author SHA1 Message Date
Logan Cusano
999affce93 Remove double buffer and added logging
Would likely work on RPI3 but need to figure out issue with opus and RPi4
2023-03-30 18:09:47 -04:00
Logan Cusano
2a3893b0e7 Update comment 2023-03-30 18:09:04 -04:00
2 changed files with 3 additions and 3 deletions

View File

@@ -52,7 +52,7 @@ async function createAudioInstance() {
channels: 2,
format: "S16_BE",
rate: 48000,
device: selectedDevice.name ?? "default", // Use -1 or omit the deviceId to select the default device
device: selectedDevice.name ?? "default", // Omit the deviceId to select the default device
periodSize: 100, //(48000 / 1000) * 20, //(48000 * 16 * 2) / 1000 * 20 // (48000 * (16 / 8) * 2) / 60 / 1000 * 20 //0.025 * 48000 / 2
periodTime: undefined,
// highwaterMark: 3840

View File

@@ -42,9 +42,9 @@ exports.join = async function join({interaction= undefined, guildID= undefined,
const audioInstance = await createAudioInstance();
audioInstance.on('audio', (buffer) => {
buffer = Buffer.from(buffer);
log.DEBUG("Audio buffer: ", buffer);
const encoded = encoder.encode(buffer);
const encoded = encoder.encode(buffer);
log.DEBUG("Encoded packet: ", encoded);
// TODO Add a function here to check the volume of either buffer and only play audio to discord when there is audio to be played
voiceConnection.playOpusPacket(encoded);
})