-
Notifications
You must be signed in to change notification settings - Fork 12
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
float32 buffer to int buffer conversation should be corrected #18
Comments
It's expected to use a transform prior to converting things. https://github.com/go-audio/audio/blob/master/float_buffer.go#L111 and https://godoc.org/github.com/go-audio/transforms#PCMScaleF32 |
Egon is right and that's obviously confusing... I wonder if we can make the API more obvious or less complicated to use. |
My currnet solution is buggy which introduces too much noise. Actually, we need to do resample for a better result. |
I would like to try to implement this stuff these days. |
Out of curiosity is it expected that if you have an Admittedly I simply don't know. |
No, the int scale values depend if the bit depth of the package and would be converted to the range -1, 1 |
I wnated to convert an ogg file to aiff format, so I used oggvorbis to decode an ogg audio file and the package give me a decoded float32 array, and then I used go-audio/aiff to encode float32 pcm data to aiff.Later I found that the encoder only accepts an IntBuffer, so I made a FloatBuffer and use its AsIntBuffer method to make a conversation, and this method didn't give me the proper result. I look into the code and found that inside the AsIntBuffer method the float value is simply converted to int using int(float_value). This is absolutly incorrect. After some researches, I wrote this to resolve the problem and lucikly it works fine.
I wonder if we can tell that if the current implemation is a bug or not ,but at least the document should be more clear so that people won't be misleading.
The text was updated successfully, but these errors were encountered: