Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
using NAudio.Wave;
using System;

class Program
{
static void Main(string[] args)
{
string filePath = "example.spx"; // replace with your file path
var reader = new NAudio.Vorbis.VorbisWaveReader(filePath);
TimeSpan duration = reader.TotalTime;
Console.WriteLine("Duration: " + duration.ToString());
}
}

What I have tried:

I tried using NAudio and libraries related to it but not able to find anything useful
Posted
Updated 30-Apr-23 6:05am

1 solution

There was a similar question asked a few years back that appears to have a solution: How to get the duration of Audio file in asp.net[^]
 
Share this answer
 
Comments
Pratik Ingole 2023 2-May-23 9:26am    
Graeme_Grant thanks, I checked those links but couldn't find what I was looking for. I need it specifically for .spx audio file

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900