Godot: Audio files too small will loop indefinitely when played

Created on 24 Jun 2020  路  6Comments  路  Source: godotengine/godot

Platform: Windows v3.2.1 stable-official

Steps to reproduce: I simply imported an audio sample with total size <0,15s, set it to not loop, force 8-bit. Whenever AudioStreamPlayer.play() was called it would loop indefinitely, even after calling stop().

archived audio

Most helpful comment

I'll add something about WAV files holding looping metadata which Godot honours, as it's not obvious.

All 6 comments

Can you provide a minimal project that can reproduce the issue?

@akien-mga

Can you provide a minimal project that can reproduce the issue?

For sure my man.
gd_sound_test.zip

Steps I took in order to reproduce:

  1. New project, default settings, nothing changed
  2. New Node Main
  3. Add child node AudioStreamPlayer
  4. Put the 4359__noisecollector__pongblipf4.wav file into res://
  5. Reimport the file above making sure Edit -> Loop is set to off in the import tab
  6. Attached a new script to node AudioStreamPlayer with a call to play() on _ready()
  7. Run

Thanks.

I checked the project and it turns out that it's not a bug: WAV files have metadata to hardcore loop points, and 4359__noisecollector__pongblipf4.wav has such a loop point defined. You can check it with LoopAuditioneer:

Screenshot_20200624_154517

Godot's WAV importer respects this metadata and will thus set loop information for the WAV file on import as encoded in the file.

The edit/loop import option is actually not a toggle to disable the use of this metadata, but instead it's used to force a WAV file without loop points to be imported with loop.

You can see that your AudioStreamSample is imported with non-default values for Loop Mode and Loop End, taken from the WAV loop points metadata:
Screenshot_20200624_154722

As the screenshot shows it, changes made here will not be kept as it's an imported resource, but you can save it as a custom .tres resource:
Screenshot_20200624_154831

And then you can change the values and use this new resource as your stream in AudioStreamPlayer. Alternatively, you can remove the hardcoded loop point from the WAV file.

Thanks a lot man. I read the following in the docs:

Keep in mind Ogg Vorbis files don鈥檛 contain looping information. If looping an Ogg Vorbis file is desired, it must be set up using the import options

And for some reason I inferred that it also applied to WAV files. My mistake lol.

Thank you again for your time and have a great day 馃槃

I'll add something about WAV files holding looping metadata which Godot honours, as it's not obvious.

I created a draft PR here.

Was this page helpful?
0 / 5 - 0 ratings