diff --git a/src/client/voice/VoiceConnection.js b/src/client/voice/VoiceConnection.js index 42b7fabe0..4fca12952 100644 --- a/src/client/voice/VoiceConnection.js +++ b/src/client/voice/VoiceConnection.js @@ -432,7 +432,8 @@ class VoiceConnection extends EventEmitter { * Options that can be passed to stream-playing methods: * @typedef {Object} StreamOptions * @property {number} [seek=0] The time to seek to - * @property {number} [volume=1] The volume to play at + * @property {number|boolean} [volume=1] The volume to play at. Set this to false to disable volume transforms for + * this stream to improve performance. * @property {number} [passes=1] How many times to send the voice packet to reduce packet loss * @property {number} [plp] Expected packet loss percentage * @property {boolean} [fec] Enabled forward error correction diff --git a/src/client/voice/player/AudioPlayer.js b/src/client/voice/player/AudioPlayer.js index 8ef3d7673..a681f3a95 100644 --- a/src/client/voice/player/AudioPlayer.js +++ b/src/client/voice/player/AudioPlayer.js @@ -55,8 +55,12 @@ class AudioPlayer extends EventEmitter { playPCMStream(stream, options, streams = {}) { this.destroyDispatcher(); - const volume = streams.volume = new prism.VolumeTransformer16LE(null, { volume: 0.2 }); const opus = streams.opus = new prism.opus.Encoder({ channels: 2, rate: 48000, frameSize: 960 }); + if (options && options.volume === false) { + stream.pipe(opus); + return this.playOpusStream(opus, options, streams); + } + const volume = streams.volume = new prism.VolumeTransformer16LE(null, { volume: options ? options.volume : 1 }); stream.pipe(volume).pipe(opus); return this.playOpusStream(opus, options, streams); }