-
-
Notifications
You must be signed in to change notification settings - Fork 219
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 32 bit floating point audio #570
Comments
Hi @svenskmand, the function signature of
However, you might need to divide the data length by four as C's float is usually four bytes:
The sample calculation might also need to be modified to:
as I'm guessing float audio sample range is only between -1.0 and 1.0. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Go version: 1.20.4
Go-SDL2 version: v0.4.35
SDL2 version: 2.0.20+dfsg-2build1
OS: Ubuntu 22.04
Architecture: 64 Bit
I am trying to follow the example on how to play audio, and the example works fine, but I would really want to use another format than 8 bit sound. How do I use 32 bit floating point?:
I tried simply changing all references to the type
C.Uint8
withC.float
as this should be the 32 bit floating point number in C, and then i changed theFormat
field in theAudioSpec
tosdl.AUDIO_F32SYS
, but unfortunately it does not work, then I just get this segfault when running the program:I have not work with Cgo before so I might be missing something completely trivial. Any help here would be awesome :)
The text was updated successfully, but these errors were encountered: