Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] AudioVolume volume is ignored when playing #1606

Open
4 tasks done
jgold189 opened this issue Feb 21, 2024 · 1 comment
Open
4 tasks done

[BUG] AudioVolume volume is ignored when playing #1606

jgold189 opened this issue Feb 21, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@jgold189
Copy link

jgold189 commented Feb 21, 2024

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 the ActiveVoiceState. This means you can't actually control the volume of a specific piece of audio using the AudioVolume 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

  1. Create an AudioVolume object
  2. Set that AudioVolume object to have a very loud volume such as 4.0
  3. Play that audio using context.voice_state.play(audio) and it will sound as if the volume was never changed

Expected Results

The volume should be much louder than the default volume of 0.5.

Minimal Reproducible Code

Python
from interactions import Client, slash_command
from interactions.api.voice.audio import AudioVolume

bot = Client()

@slash_command(name="play")
async def play(ctx):
    if not context.voice_state:
      await context.author.voice.channel.connect()
    audio = AudioVolume("music.mp3")
    audio.volume = 4.0
    await context.voice_state.play(audio)

bot.start("token")

Traceback

No response

Checklist

  • I have searched the open issues for duplicates.
  • I have shown the entire traceback, if possible.
  • I have removed my token from display, if visible.
  • I have attempted to debug this myself, and I believe this issue is with the library

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 the ActiveVoiceState._volume, should there be a multiplicative effect, maybe a max or min call, or just taking the average of the two?

@AstreaTSS
Copy link
Member

@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.

@AstreaTSS AstreaTSS added the bug Something isn't working label Mar 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants