Page 1 of 1

Sound Duration

Posted: Wed Mar 18, 2009 11:55 am
by Motu
a command like GetSoundDuration(#Sound) that returns to duration of a sound in ms would be nice.

BTW: Does anyone have a good workaround for that? For wav you can do somthing like this:

; *Pointer is a Pointer to the wav file in memory
; FileSize if the Size of the wav file in memory

Size.l = FileSize - 44
Channels.l = PeekW(*Pointer+22)
SampleRate.l = PeekL(*Pointer+24)
ByteRate.l = PeekL(*Pointer+28)

Valuef1.f = Size
Valuef2.f = ByteRate
TrackLenght.f = Valuef1/Valuef2 * 1000
TrackLenght.l = Int(TrackLenght)

but it's not very clean and it does noch work for OGG or FLAG

Posted: Fri Apr 03, 2009 11:39 am
by Motu
For people with the same problem:

http://www.purebasic.fr/english/viewtopic.php?t=23336

can help you :-)

Anyway, it would be good if these functions could be added to the native library :)