Open jgold189 opened 9 months ago
@LordOfPolls has been MIA as far as we're aware, but suggesting he knows the most about anything audio related in interactions.py, I'm still going to mention him here so he can take a look at it once he's back.
The intended API design requires setting volume through the VoiceState interface, although this may be limiting for some use cases.
AudioVolume includes a volume property because volume adjustment capabilities vary between audio sources - some can be adjusted with a simple audioop.mul
(iirc), while others cannot without additional processing which would be out-of-scope and down to the dev themselves.
Having two paths to control volume (through VoiceState and directly via AudioVolume) creates state inconsistencies... which you've noticed. The audio suite effectively treates VoiceState as the gospel of truth.
Id half consider just removing the AudioVolume.volume setter from the docs, or refactor to make it private.
@AstreaTSS @jgold189
Library Version
5.11.0
Describe the Bug
When playing an
AudioVolume
object the volume on the actual object will always get overridden with the volume on theActiveVoiceState
. This means you can't actually control the volume of a specific piece of audio using theAudioVolume
itself.I found this chunk of code which is doing the overwriting but I'm not sure if I'm missing additional context to this and maybe the volume should be getting pulled through from some other method. https://github.com/interactions-py/interactions.py/blob/stable/interactions/api/voice/player.py#L97-L99
Steps to Reproduce
AudioVolume
objectAudioVolume
object to have a very loud volume such as4.0
context.voice_state.play(audio)
and it will sound as if the volume was never changedExpected Results
The volume should be much louder than the default volume of
0.5
.Minimal Reproducible Code
Traceback
No response
Checklist
Additional Information
I'm happy to put up a PR to fix this but I'm not sure what the exact intended behavior is. Should the
AudioVolume.volume
always override theActiveVoiceState._volume
, should there be a multiplicative effect, maybe amax
ormin
call, or just taking the average of the two?