(Godot 3.0) Retrieving METADATA from OGG/Vorbis Files?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Corruptinator
:warning: Old Version Published before Godot 3 was released.

Hello! This may be a very advanced question to ask but recently I was able to find this interesting tutorial: http://www.rpgmakercentral.com/topic/3825-make-looping-bgm-part-1-ogg-vorbis/

It explains how to set loop points in Audacity and set the Starting Loop and the End loop in the Metadata when exporting to an audio file such as the OGG file format.

The idea is that I want to be able to set up a music stream loop point so then it repeats seamlessly forever or when stopped by command and I couldn’t find anything about getting Metadata information from the Godot Documentation other than the Object Metadata. I did notice however that when loading the OGG from resource there is a scripting command called PoolByteArray that can read files, but in RAW format.

So with that in mind, could PoolByteArray be used to fetch Metadata from OGG files or is there a better way to implement the loop point number from the OGG file metadata?


P.S: This may be extra but from learning about the audio loop tutorial above I realize that there is an algorithm to convert the samples into seconds by for set _ loop _ offset():

(Sample / Analog Audio[Hz]) * .001

If the sample was exported in the metadata and loaded in Godot through GDScript it would divide the Analog Audio[Hz] (such as 44.1 for example) and multiply it by .001 to get the number of seconds in float to set the loop point. :slight_smile:

:bust_in_silhouette: Reply From: Zylann

PoolByteArray is not a command, it’s just an array of bytes.
Setting up loop points is done in Godot AFAIK: Audio streams — Godot Engine (latest) documentation in English
I’m not aware of ways to do it from within the imported file, thought it would be a nice addition to be proposed on Github.
I think it was not done yet because supported audio formats don’t have a standard way of defining loop points (and they dont necessarily contain this info).