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

How to play/load audio source from base64 #196

Closed
beig opened this issue Jul 26, 2023 · 1 comment
Closed

How to play/load audio source from base64 #196

beig opened this issue Jul 26, 2023 · 1 comment

Comments

@beig
Copy link

beig commented Jul 26, 2023

Hello,

I am pretty new to rust but creating a discord bot seems like a nice project.

I am storing my mp3 as base64 string in jammdb.
Is there a way to load the sound directly from memory?
The only way I found is writing the base64 to a file and then load it

Thanks

@FelixMcFelix
Copy link
Member

If you're on next, then you should be able to play any supported file format from memory (every owned byte slice e.g., &'static [u8], Bytes, or Vec<u8>). Obviously you'd need to parse the Base64 string back into actual bytes.

If you're on current, then you're correct, you either need to write it out to a local file, transform and pipe it to ffmpeg, or decode it locally into raw f32s/i16s.

@beig beig closed this as completed Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants