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 converting in memory bytes? #22

Open
LeiYangGH opened this issue Oct 30, 2019 · 2 comments
Open

Support converting in memory bytes? #22

LeiYangGH opened this issue Oct 30, 2019 · 2 comments

Comments

@LeiYangGH
Copy link

LeiYangGH commented Oct 30, 2019

I tried the converting from pcm to wav file and succeeded.
However in my go server I want to reduce disk IO becasue all my data are []bytes in memory(my server can generate pcm bytes by some TTS server and will serve as wav bytes for user to download).
NewEncoder function can only accept io.WriteSeeker, and I found a walkaround in stackoverflow to use a in memory one. However I think this walkaround is not elegant nor stable.

So could you consider add such in memory only convertion?

@mattetti
Copy link
Member

I'm honestly not too sure how to offer a transparent way to do that since the seeking is needed to finish writing the header of the file. However, as a potential alternative, consider using this package I wrote for this exact use case (short audio files that could stay in memory) https://github.com/mattetti/filebuffer

@LeiYangGH
Copy link
Author

thanks! I'll use it. seems it has more stars than https://github.com/orcaman/writerseeker(from above SO comment)

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