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 Profile Posts

Ami
--- Stolen Item ---

M.Figher: I want to sell this Stone
Fence: Then...i can buy you 1500G
M.Figher: It's Deal!
(3 Days Later)
F.Fighter: M.Figher,Do you know about Stone that Mayor keep it in his Office? It's missing
M.Figher: Ahh,is that so... (Actually,i Stole it and Sell it to the Fence a few Days ago)
I've spent some cash on foley and other sound effects. I wonder sometimes if I made a poor choice, but I remember that I really want to improve the sound of my games. n...n; My frugalness haunts me sometimes.
elex 50s face.png

Experimenting with an old 50's style face set. I have done about a dozen variations of face sets for my characters, but am never happy with the results for very long. Different attempts. Second one is the same character as the first image. The third is Ivan, another character entirely.

Forum statistics

Threads
108,846
Messages
1,040,004
Members
141,311
Latest member
Flaa
Top