Can't stop the sound after deleting a game object

According to documentation (API and manual):
“A sound will continue to play even if the game object the sound component belonged to is deleted. You can call sound.stop() to stop the sound (see below)”
Below is sound.stop(“go#sound”)

But, I got error:
ERROR:GAMEOBJECT: Instance ‘/go’ could not be found when dispatching message ‘stop_sound’ sent from board_5x5:/go#board_script
Using url leads to different error related to invalid hash after go was deleted.

Why I want to stop (and operate) sound after deleting a game object?
In my game I have game object stars, spawning and flying with looped sound of sparkles (and changing panning in update to hear stars flying from left to right etc). I can’t abruptly stop looped sound (because of harsh click) and need to fade out it. So, when star reached target, I start impact particles, stop sparkle particles, delete go and want to start fading out looped sound.

To avoid suggestions to have separate soundManager with all sounds inside to manage sounds separately. Actually, I have this with all great features as gating etc. But, let’s say, you spawned 5 stars at similar time. Then you have 5 voices for the same sound in manager. You can stop sound on separate voice like this sound.stop(“#sound”, {play_id = id}) but you can’t manipulate pan and gain for separate voices unfortunately. go.set(“#sound”, “gain”, 0.2, {play_id = id}) sets gain to all voices at once (and for all future plays for some reason, like there is hidden sound group for all voices).
Just abruptly stopping voice is useless because it usually generates clicks. I need fade out. I need to change pan on the fly.

I would hide the graphic you want to vanish first, and wait to delete the object until you’re done with it.

Thank you. There are some workarounds/solutions. But would be nice to know if this case is a bug or intentional thing. I mean, defold team mentioned earlier, that this is a part of approach - particles, sounds should be live after deletion of game object to allow explosions etc on impact.

My mistake; you’re just asking about the behavior. :ok_hand:

I suppose this may be an intended compromise. Although it is potentially strange with a sound effect longer than a second, it is sensible for a brief sound effect like the collision (& deletion) of a conventional bullet.

I bet you the engine diligently frees the sound resource once it is finished playing. :grinning_face_with_smiling_eyes:

This is covered in this feature request: sound.set_gain() and sound.set_pan() for individual voices · Issue #8454 · defold/defold · GitHub

Great! It would be much better than idea to attach sound to game object to automatically update pan, because in most cases you want more control.