Code archives/Audio/(BMX) Determine length of an audio sample in seconds
This code has been declared by its author to be Public Domain code.
Download source code
| |||||
| (BMX) Determine length of an audio sample in seconds (tested with OGG files, but it should be the same for any file) | |||||
SuperStrict
Local sample:TAudioSample = LoadAudioSample("battle.ogg")
Local length:Float = getSampleLength(sample)
Print "Length in seconds: " + length
Print "Length: " + Int(Floor(length/60))+"m "+Int(length Mod 60)+"s"
Function getSampleLength:Float(sample:TAudioSample)
Return Float( (sample.length / Float( (sample.hertz * 60) ) ) * 60)
End Function |
Comments
None.
Code Archives Forum