Skip to content
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

WAV sound effect is looped although Loop is not checked #46164

Closed
BorisBrock opened this issue Feb 18, 2021 · 9 comments · Fixed by #59170
Closed

WAV sound effect is looped although Loop is not checked #46164

BorisBrock opened this issue Feb 18, 2021 · 9 comments · Fixed by #59170

Comments

@BorisBrock
Copy link

Godot version:
3.2.3 stable

OS/device including version:
Windows 10 20H2, x64, GLES2

Issue description:
When I call play() once on a AudioStreamPlayer3D, the sound keeps looping endlessly. I already checked in the sound's import settings that Loop is not enabled.

Steps to reproduce:
Create new project
Add .wav file, make sure Loop is not enabled in import settings
Add AudioSteamPlayer3D and assign the .wav to it
Call play() once on the audio stream player
-> Sound is looped endlessly

Minimal reproduction project:
SoundTest.zip

@YuriSizov
Copy link
Contributor

Did you reimport the resource after checking that looping is disabled in the Import dock?

@BorisBrock
Copy link
Author

Did you reimport the resource after checking that looping is disabled in the Import dock?

Loop was disabled from the beginning. But I explicitly enabled it, then disabled it and re-imported again.

@nisovin
Copy link

nisovin commented Feb 19, 2021

I think this has something to do with this particular wav file. If you import into audacity and re-export, the problem goes away. Also, adding this line makes the problem go away as well: $AudioStreamPlayer3D.stream.loop_mode = 0.

@Calinou
Copy link
Member

Calinou commented Feb 19, 2021

Maybe this is an issue with the loop point defined in the WAV file? Godot reads this loop point and sets it automatically. You can see the assigned loop point value by selecting the WAV file in the FileSystem dock then going to the Import dock.

@sairam4123
Copy link

Well, would it be possible to just ignore the loop points? I would love to have a way to loop the sound with loop points and play a sound from start without looping.

@Calinou
Copy link
Member

Calinou commented Apr 9, 2021

Well, would it be possible to just ignore the loop points? I would love to have a way to loop the sound with loop points and play a sound from start without looping.

After importing the WAV file, you should be able to set the loop point to 0 manually in the Import dock and click Reimport.

@sairam4123
Copy link

Well, I would love to have both, the ability to loop between loop points and also the ability to play only once without changing the loop points.

@akien-mga akien-mga changed the title Sound effect is looped although Loop is not checked WAV sound effect is looped although Loop is not checked Oct 2, 2021
@akien-mga
Copy link
Member

akien-mga commented Oct 2, 2021

To clarify about this which seems to confuse many users (I agree the UX is bad), here's what is happening:

  • The WAV format has support for metadata that defines whether the sample should loop, and if so the start and end loop points. Godot's WAV importer imports these metadata by default.
  • The "Edit > Loop" import option for WAV can be used to force loop on, but not to disable it. It should likely be changed to an enum (Detect, On, Off). Currently it's basically just (Detect, On).
  • Imported resources cannot be edited by default, so changing the Stream > Loop Mode property doesn't actually work. That's why it says "Changes may be lost!" (see screenshot below). You can work this around by saving the Stream as a resource (Save As > name.tres), which can then be modified. This can let you force Loop off.
  • As per the first point, another option is to edit the WAV file with an audio editor that supports WAV metadata to disable its built-in loop hints.

Screenshot_20211002_120117
Screenshot_20211002_120229

@yudi-azvd
Copy link

yudi-azvd commented Oct 23, 2021

I tried re importing with Loop checkbox unchecked. Did not work. Tried checking, reimport, uncheck and re import again. Did not work

Tried setting Loop Mode to Disabled in the inspector, didn't work as well.

I think this has something to do with this particular wav file. If you import into audacity and re-export, the problem goes away. Also, adding this line makes the problem go away as well: $AudioStreamPlayer3D.stream.loop_mode = 0.

I'm using an AudioStreamPlayer and doing AudioStreamPlayer.stream.loop = false has worked for me 😄 .

Reading @akien-mga's comment makes me think this should be described in the docs. Maybe it is, I just haven't found it.

akien-mga added a commit to akien-mga/godot that referenced this issue Mar 15, 2022
The new `edit/loop_mode` import options lets user choose to either:
- Detect loop points from the WAV (default, same behavior as before)
- Set the loop mode and loop points manually like in AudioStreamSample

Fixes godotengine#46164.
@akien-mga akien-mga added this to the 3.5 milestone Mar 22, 2022
akien-mga added a commit to akien-mga/godot that referenced this issue Mar 28, 2022
The new `edit/loop_mode` import options lets user choose to either:
- Detect loop points from the WAV (default, same behavior as before)
- Set the loop mode and loop points manually like in AudioStreamSample

Fixes godotengine#46164.

(cherry picked from commit b389ce5)
gaudecker pushed a commit to gaudecker/godot that referenced this issue Apr 3, 2022
The new `edit/loop_mode` import options lets user choose to either:
- Detect loop points from the WAV (default, same behavior as before)
- Set the loop mode and loop points manually like in AudioStreamSample

Fixes godotengine#46164.
Riordan-DC pushed a commit to Riordan-DC/godot that referenced this issue Jan 24, 2023
The new `edit/loop_mode` import options lets user choose to either:
- Detect loop points from the WAV (default, same behavior as before)
- Set the loop mode and loop points manually like in AudioStreamSample

Fixes godotengine#46164.

(cherry picked from commit b389ce5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants