-
-
Notifications
You must be signed in to change notification settings - Fork 194
Open
Labels
Description
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!
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
bilhox commentedon Oct 17, 2024
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.Good question.
MrRedstone058 commentedon Oct 17, 2024
will the all --> alter, perhaps.
celeritydesign commentedon Oct 17, 2024
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 commentedon Oct 17, 2024
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 commentedon Oct 17, 2024
Related issue: #1328
bilhox commentedon Oct 17, 2024
I'm moving it to the 2.5.3 milestone so it's not left behind and I don't forget it.
celeritydesign commentedon Jun 3, 2025
@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!