-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
pygame.mixer.Sound(buffer) does not attempt to identify stream type #556
Comments
I'm pretty sure the buffer / array arguments aren't meant to accept the contents of a file but rather raw samples which will be played back in the format that I think if you can convince people that a flag for interpreting the buffer argument as file contents (ogg and wav files have easy, clear headers) would be a useful feature, someone (or me) might add this; but without anyone else approving this feature request I won't work on this. |
My idea is that all the data I have is packed into a single data file to reduce file count, including a large number of sounds and images. While the images can be transmitted this way to pygame.image using a BytesIO, sounds are a problem and I am currently working around this problem by creating a temporary directory, writing them to a file there and then rereading using pygame.mixer. Basically, I'd like to be able to reduce the number of files that are packaged with the game. |
Hi, are you having issues using BytesIO like below? This seems to work for me. python 2 version...
python 3 version
|
...you're absolutely right and I don't know why I didn't think of that considering I already used it for images. Thanks! |
pygame.mixer.Sound(file="example.ogg")
Reads and loads an ogg file properly without a problem, however
attempts to read the buffer in a different format. Could we change the behaviour to interpret the buffer as the contents of a while or if ogg files don't have a header for identifying them, can we at least get a flag to note that the buffer should be interpreted as an ogg?
The text was updated successfully, but these errors were encountered: