RMMV Trying to find the duration of a sound effect. How can I access WebAudio attributes?

Oatilis

Veteran
Veteran
Joined
Mar 16, 2016
Messages
41
Reaction score
15
First Language
Hebrew
Primarily Uses
Hey guys, I want to get the duration (play length) of a sound effect which is being played.
I've looked into:

JavaScript:
AudioManager.playSe
AudioManager.createBuffer
AudioManager.updateBufferParameters

I tried printing to console fields from WebAudio class, like totalTime, loopLength etc, but it seems like the WebAudio is still not fully populated in these functions, and all I get is null or undefined values (however, printing the buffer to console I can see the values populated, I guess this happens later).

I've been banging my head for a while now! How can I access the actual Web Audio data?
 

akoniti

Veteran
Veteran
Joined
Mar 4, 2020
Messages
140
Reaction score
127
First Language
English
Primarily Uses
RMMV
One approach would be to open the audio file in a media player (e.g. VLC) and view the length of the track.

You should see the file in the audio/se folder.

I may be misunderstanding your need, but this would be the easiest approach to finding the length I can think of.

EDIT: Also, what's the usecase for the track length?
 

Oatilis

Veteran
Veteran
Joined
Mar 16, 2016
Messages
41
Reaction score
15
First Language
Hebrew
Primarily Uses
One approach would be to open the audio file in a media player (e.g. VLC) and view the length of the track.

You should see the file in the audio/se folder.

I may be misunderstanding your need, but this would be the easiest approach to finding the length I can think of.

I need to get the length while the game is running because I'm using it to close the text window after a voiceover has finished playing.
 

akoniti

Veteran
Veteran
Joined
Mar 4, 2020
Messages
140
Reaction score
127
First Language
English
Primarily Uses
RMMV
Ahh, I see. You could add a Wait command (based on length of SE) after you initiate the SE, then close the window.
 

Oatilis

Veteran
Veteran
Joined
Mar 16, 2016
Messages
41
Reaction score
15
First Language
Hebrew
Primarily Uses
Ahh, I see. You could add a Wait command (based on length of SE) after you initiate the SE, then close the window.
I don't want to manually enter each file length - I want to program it in automatically. I know my way around events well enough, looking for a JS solution to this.
 

Latest Threads

Latest Posts

Latest Profile Posts

You know you've been working on RPGMaker for a while when you go to move your projects to a 16 GB USB drive and get told not enough space to do this operation.
The latest post on TheDazzlingsAreBack...
besides itch and occasionally here where are people doing game jams at y'all? (plz do not cross reference this with my previous status lol)
Go out all day!
★No work★
Just want to sleep when I get home Zzzzz
just went through 50 issues of Fables, only to left kind of disappointed by it, I guess I have to wait for season 2 of TWAU instead.

Forum statistics

Threads
110,442
Messages
1,053,320
Members
143,509
Latest member
AfterDarkPro
Top