Resources | VB | Audio Durations

Duration of Audio Files:


To use the following code to get the duration time of MP3s and WMAs you will need to download the Windows Media Encoder SDK.

Create a VB Project and set a reference (Project --> References) to Windows Media Encoder. The Encoder Object will return the duration of the audio file in milliseconds. Add the following code to your project:



Unfortunately, the Encoder object does not work with .WAVs. To get the length of a WAV you must use an API call. Add this code to your VB Project:



Related Links: Updating WMA files


Want to discuss this article, or other development issues? Visit our message boards!

Or contact us directly with a comment or question on this article: click here !
armbrustconsulting.com