Sound keeps looping

CaribaLedonCaribaLedon Posts: 5Member

Hi there!
I want to play a sound effect ONCE. To do so, I imported a .wav file into Godot. In the import panel, 'Loop' is NOT checked.
Then I assigned the wav to an AudioStreamPlayer3D.

When I call $MySound.play() once in a script, the sound keeps on repeating endlessly.

How can I make sure the sound is only played once?
Thanks! :)

Comments

  • TwistedTwiglegTwistedTwigleg Posts: 3,956Admin

    This discussion was caught in the moderation queue since you have not confirmed your account yet.

    Upon creating your account you should have received an account verification email. The confirmation email may have been incorrectly flagged as spam, so please also check your spam filter. Without confirming your account, future posts may also be caught in the moderation queue. You can resend a confirmation email when you log into your account if you cannot find the first verification email.

    (Note: You do not need to repost, the discussion has been moved out and is visible now)

    If you need any help, please let us know! You can find ways to contact forum staff on the Contact page. Thanks! :smile:

  • DaveTheCoderDaveTheCoder Posts: 164Member
    edited February 15

    I saw a tip that might help:

    Select the sound file in the File System dock, verify that Loop is unchecked in the Import panel and click Reimport.

  • ZeltaZelta Posts: 83Member

    @DaveTheCoder said:
    I saw a tip that might help:

    Select the sound file in the File System dock, verify that Loop is unchecked in the Import panel and click Reimport.

    yeah, .ogg files are imported with loop by default, I went crazy a day for this

  • CaribaLedonCaribaLedon Posts: 5Member

    @DaveTheCoder said:
    I saw a tip that might help:

    Select the sound file in the File System dock, verify that Loop is unchecked in the Import panel and click Reimport.

    Yeah, Loop is unchecked. I also hit the Reimport button more than once ;-)
    Sadly this does not change a thing. The sound is still looping...

  • MegalomaniakMegalomaniak Posts: 3,337Admin

    Your code might just be the one on loop/reevaluated such that it effectively loops.

  • CaribaLedonCaribaLedon Posts: 5Member

    I have created a minimal example project that shows the issue. It is just a single camera + audio player. When the scene starts, play() is called once. Still the sound keeps on looping forever.

    You can download the scene here:
    https://drive.google.com/file/d/1GPMw0UH9tTqye9F_Ud0OReMM2aCuemKM/view?usp=sharing

    Am I missing something very simple here? Or is this a bug in Godot?

  • MegalomaniakMegalomaniak Posts: 3,337Admin
    edited February 18

    Interesting, I set stream paused to true and then false again and it's not playing anymore. But even with the line commented out it previously played without stream paused set to true.

    edit: So the actual resource seems to still have Looping set to Forward:

    However even with it set to disabled via inspector, during runtime it is still somehow set back to "Forward" state according to remote inspection. I think it's a bug.

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file