Skip to content

Docs typo: mixer.Sound #3180

@celeritydesign

Description

@celeritydesign

ref: https://pyga.me/docs/ref/mixer.html

What should this say? :

"The Sound object represents actual sound sample data. Methods that change the state of the Sound object will the all instances of the Sound playback."

For context, I'm looking to make copies ( copy.copy() )of Sound objects from a cached dictionary, and am getting "cannot pickle Sound" errors. It would be great if the docs could address this.

Cheers!

Activity

bilhox

bilhox commented on Oct 17, 2024

@bilhox
Contributor

For context, I'm looking to make copies ( copy.copy() )of Sound objects from a cached dictionary, and am getting "cannot pickle Sound" errors. It would be great if the docs could address this.

This is not possible right now, but I started an implementation a few weeks ago, I still have some bugs to fix. You can turn yourself to sndarray though.

What should this say? :
"The Sound object represents actual sound sample data. Methods that change the state of the Sound object will the all instances of the Sound playback."

Good question.

MrRedstone058

MrRedstone058 commented on Oct 17, 2024

@MrRedstone058
Contributor

"The Sound object represents actual sound sample data. Methods that change the state of the Sound object will the all instances of the Sound playback."

will the all --> alter, perhaps.

celeritydesign

celeritydesign commented on Oct 17, 2024

@celeritydesign
Author

This is not possible right now, but I started an implementation a few weeks ago, I still have some bugs to fix. You can turn yourself to sndarray though.

That sounds great! I'm hoping you are either going to make it possible to copy.deepcopy(mysound) and/or add a Sound.copy() method ?

celeritydesign

celeritydesign commented on Oct 17, 2024

@celeritydesign
Author

For the docs, maybe something like:

The Sound object represents actual sound sample data. Methods that change the state of the Sound object will alter all instances of the Sound playback.
Note, it is not currently possible to shallow copy or deep copy Sound objects. For multiple instances of the same sound that need to loop and play independently it is recommended to...

It's the recommendation that I am not sure about - at the moment I am just reloading the same sound file multiple times :-)

celeritydesign

celeritydesign commented on Oct 17, 2024

@celeritydesign
Author

Related issue: #1328

bilhox

bilhox commented on Oct 17, 2024

@bilhox
Contributor

I'm moving it to the 2.5.3 milestone so it's not left behind and I don't forget it.

added theissue type on Apr 28, 2025
celeritydesign

celeritydesign commented on Jun 3, 2025

@celeritydesign
Author

@bilhox - sorry to bump, but did you ever revisit your code that would allow pygame.mixer.Sound objects to be pickled?

Also, could someone look at expanding my documentation amend above to include a sensible recommendation, as this didn't make it into 2.5.3 - thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @celeritydesign@bilhox@MrRedstone058

        Issue actions

          Docs typo: mixer.Sound · Issue #3180 · pygame-community/pygame-ce