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
14
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
112
Reaction score
90
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
14
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
112
Reaction score
90
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
14
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 Profile Posts

Observation Log 1 on the planet of "RPGMAKERWEB": Local RMXP community seems to have very few survivors. Their script tech-level is in the early Stone Age(about the same as 66RPG in 2007).
Some cats/wolves/squirrels are spotted, they are likely friendly. :3
Keep working on establishing more meaningful contacts.
May try to use the "I Come in Peace" protocol if encounter any hostiles.
Using hiddenone's QTE tutorial I've been able to setup a simple fishing system. Instead of just the pointer moving, the goal moves as well. Holding the action button scrolls the pointer and pressing the down arrow key hooks the fish. The speed of both is variable as well as the number of successful hooks needed for a catch.
When someone helps you solve a problem, it's good to report the thread so it can be closed, but it's also nice to go back and post in the thread to let them know their suggestion actually worked. And, you know, to say thanks for helping.
Yes, I made made my profile picture into a poorly edited fat cat

Forum statistics

Threads
108,924
Messages
1,040,617
Members
141,374
Latest member
semih4472
Top