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
107
Reaction score
89
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
107
Reaction score
89
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 Posts

Latest Profile Posts

The light has gone out of my life.

About time they finally press the kill switch button for older makers.
Sorry everyone, I am here sporadically. After 6 years of delays after delays in my life, I try to do all mat once and that means that I spread thin everywhere because it just is impossible to crunch 6 years in one or even two, but I try! I wish many of that I would already given you and put behind but... well...
I'm looking for an experienced gamer who has played a few games created with RPG Maker, who knows what an alpha build is, who may remember the old days when cliché was the favorite word on Creation Asylum, who, if a reviewer, would ask for my permission before making a review to post on YouTube, or whatever, since I will be messaging you a 10 minute, or so, DEMO based on an alpha build of Effervesce Fallacy™.
No matter how many times I listen to him, I know this is Joker speaking, but my brain can only hear Dagda.

Forum statistics

Threads
108,821
Messages
1,039,825
Members
141,283
Latest member
sphynxcatsforsale
Top