Gamestudio Links
Zorro Links
Newest Posts
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 1,454 guests, and 9 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19058 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Get length of audio file? #329906
06/23/10 18:59
06/23/10 18:59
Joined: Jul 2008
Posts: 223
Pittsburgh
The_Clyde Offline OP
Member
The_Clyde  Offline OP
Member

Joined: Jul 2008
Posts: 223
Pittsburgh
Is there a way to get the length of an audio file in seconds, from the file name?

I'm hoping to make audio cues in my cutscene editor show up on the timeline with their actual length shown, to make sound and action easier to synchronize...

Re: Get length of audio file? [Re: The_Clyde] #329913
06/23/10 20:24
06/23/10 20:24
Joined: Dec 2002
Posts: 616
Austria
Stromausfall Offline
User
Stromausfall  Offline
User

Joined: Dec 2002
Posts: 616
Austria
if you load the audio file with "snd_create" that's possible through snd_buffer afaik

if you don't want to load it (to save memory), you can read it from the file header (for wave files at least)


get the C# wrapper:
for A7.85.4 and A8.30.4, Version 2.3.9
at http://acknexwrapper2.matthias-auer.net/ or visit the thread
Re: Get length of audio file? [Re: Stromausfall] #329929
06/23/10 23:13
06/23/10 23:13
Joined: Jul 2008
Posts: 223
Pittsburgh
The_Clyde Offline OP
Member
The_Clyde  Offline OP
Member

Joined: Jul 2008
Posts: 223
Pittsburgh
That sounds like it would work- since I mostly planned for it to just use .WAV's

How do I go about reading a wave file header?

Re: Get length of audio file? [Re: The_Clyde] #329960
06/24/10 10:37
06/24/10 10:37
Joined: Dec 2002
Posts: 616
Austria
Stromausfall Offline
User
Stromausfall  Offline
User

Joined: Dec 2002
Posts: 616
Austria
well that's not really easy, there are several chunks in the header, and the number of these chunks also may vary from file to file. Then you have to get the wave data length, the sample rate, the bit rate and the number of channels...

I've built a small sample prog, that uses a c++ library (easier to code that difficult stuff imho), which offers such a function :

http://www.matthias-auer.net/Projects/WaveFileSize/WaveFileSize.zip

in that zip, there is a lite-c script, the dll (plus it's source (visual studio 2010)) and a small wave file

i only tested the dll with some samples, but it should work, if the dll isn't able to open the file or something it returns -2 or -1 !


get the C# wrapper:
for A7.85.4 and A8.30.4, Version 2.3.9
at http://acknexwrapper2.matthias-auer.net/ or visit the thread

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1