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

Support sending voice messages #1780

Open
1 task done
davfsa opened this issue Dec 7, 2023 · 2 comments
Open
1 task done

Support sending voice messages #1780

davfsa opened this issue Dec 7, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@davfsa
Copy link
Member

davfsa commented Dec 7, 2023

Summary

Add support for setting and sending waveform in the payload when creating a message.

Should also be documented how to calculate the waveform (discord/discord-api-docs#6082 (comment))

Ideal implementation

Add support for waveform and send it along with message creates

Usage example:

await bot.rest.create_message(
    attachment=hikari.File("voice.mp3"),
    waveform=calculated_waveform,  # or just ""
    flags=hikari.MessageFlag.IS_VOICE_MESSAGE
)

Checklist

  • I have searched the issue tracker and have made sure it's not a duplicate. If it is a follow up of another issue, I have specified it.
@davfsa davfsa added the enhancement New feature or request label Dec 7, 2023
@hypergonial
Copy link
Contributor

hypergonial commented Jan 5, 2024

I'm pretty sure the waveform= kwarg should be added to attachments, unless I'm mistaken.

Also, based on this, should waveform= be added to all hikari resource base types? Or should a new basetype be created?

@PythonTryHard
Copy link
Contributor

PythonTryHard commented Mar 27, 2024

I vouch for creating a new base type, something like VoiceMessage. Adding waveform= to all hikari resource bases sounds...iffy. I can't describe why, but intuition says it's iffy.

For implementation, I found librosa that does the downsampling in Python rather than having to offload to ffmpeg. The only pain is that librosa only does sample rate, not bit depth, though I assume with some nparray shenanigan the bit depth should be easy enough. It's just a graphical representation, not some audio nerd stuffs.

Although, considering librosa's dependencies, if we were to go with it as a "battery included", I'd rather we put it as another extra like hikari[voicemsg]. How many times do you see a Discord bot library ship with number-crunching dependencies?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants