What an innovative plugin. Does it also come with support for OPUS files renamed as OGG?
Greater control when playing back BGM tracks · By
Here is all the research I did on the topic.
https://forums.rpgmakerweb.com/index.php?threads/bit-of-testing-with-opus.158209...
How can I attach files here?
Here is a converted audio file: https://www.mediafire.com/file/kau7l0fs9qtlwah/AUD_BGM_MiasmaLord_Normal.ogg/fil...
Okay, I attempted to convert the Jay's Journey tracks "Starboard Authority" and "Starboard Authority (Alt)" into OPUS files. They play just fine so long as I don't mess with the loopstart and looplength attributes (which, true to what you said in that topic, do not work properly). If I do alter those attributes, then upon playback I'm greeted with:
Failed to set the 'loopstart' property on 'AudioBufferSourceNode': the provided double value is non-finite.
So either there's a previously-undetected bug in my plugin, or there's an issue with OPUS files.
(Actually, I did discover an undetected bug in my plugin. I'll, uh, just go and release a new version for that. But it's not one related to looping or OPUS files.)
Figured it out. The calculated sample rate of the OPUS files I'm testing with is ZERO. There's some math in my plugin that divides by the sample rate at one point, and division by zero = bad result.
If there's some equivalent of the sample rate in the metadata, or if I could fake it somehow, this could be patched.
All this said: The variable mix stuff - the meatiest part of the plugin, and the whole reason I made the plugin in the first place - still work as intended. I haven't yet tested every feature, but the loops seem like the biggest thing likely to break that did, in fact, break.
EDIT: Nope, one more thing is broken: the "Play from" (or "Starting point") attribute hangs the game.
Okay, interesting results, and I don't know how meaningful they'll be to you:
When the OPUS file is loaded, it has a sample rate of zero, and an automatic loopstart of 0 and looplength of... the track's length in seconds, as a double (that is, number with a decimal place). This happens to be the length of the original OGG file in samples divided by its sample rate. This may be salvageable, but it means you'd have to give the loop properties in terms of timestamps instead of sample numbers, which may be less precise.
So Starboard Authority has a length of 7,631,360 samples and sample rate of 44100 Hz. Its loop data is set to loopstart: 265,970 and looplength: 6,881,514.
The OPUS file gets a natural "looplength" of 173.04672916666667, which is its (very precise) length in seconds. So what happens if I skip over the sample rate math and set the loopstart to 265970/44100 = 6.031065759637188 and 6881514/44100 = 156.0434013605442?
...
Failed to set the 'loopEnd' property on 'AudioBufferSourceNode': The provided double value is non-finite.
Well, that's disappointing. What the heck is "loopEnd"?
EDIT: Oh. That's stupid. It tried to add the two numbers... as strings, which of course doesn't work. Why the pfargtl did it do that?!
All right, success! I have a properly-looping OPUS file! The loopstart and looplength values given above do, in fact, work, with a tweaked plugin. Just trying to decide on the best way to package that for consumer use. I could do what I do for the tempo ratio and calculate fractions or let you input the sample rate for tracks that don't have one... or just let you do the math yourself and input decimal values.
A solution like this could repair the "Starting point" issue too.
EDIT: I'm leaning toward the sample rate option. Just have it ignored when the file actually has a proper sample rate.