How to get a duration of mp3 file via .NET/C#? [closed] - c#

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I need to create a M3U playlist of mp3 songs.
Is there any way to read the duration attribute of MP3 files?

Don't reinvent the wheel. Use an external library such as NAudio to do the hard work.
NAudio is available at GitHub.
You can use it like this:
Mp3FileReader reader = new Mp3FileReader("<YourMP3>.mp3");
TimeSpan duration = reader.TotalTime;
Of course, an alternative would be this answer.
To use the Mp3FileReader class, you must add using NAudio.Wave; to your file.

Thanks everyone for help.
I tryed using TagLib and it works fine.
TagLib.File f = TagLib.File.Create(<pathToFile>, TagLib.ReadStyle.Average);
var duration = (int)f.Properties.Duration.TotalSeconds;

Related

Is there a way to programmatically disable then re-enable a mic [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I have been having some problems with my mic when I boot my pc I have to either disable and re-enable my mic in recording devices or unplug the usb and put it in again to reset it...
I'm a pretty novice programmer but do know my way around bat and C# (sort of).
Is there a way I can do this either through a program or through making a script and chucking it in the startup folder.
Thanks...
One easy solution is to use devcon in a .bat file.
Here are some additional details:
https://msdn.microsoft.com/en-us/windows/hardware/drivers/devtest/devcon-disable
You can try the devcon command, available here: https://msdn.microsoft.com/windows/hardware/drivers/devtest/devcon?f=255&MSPPError=-2147217396

cronjob in asp c# [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I have a question:
I have to do a project, which has something to do with reading data from txt into MSSQL. This function I solved it with a click-event. Right now, the reading process has to read the whole data automatically every day on the server, even without open the website. Can I do it with a cronjob or there are also other better solutions?
Have a look at Quartz.Net - it's a decent job-scheduling system.
It's probably overkill if you only have a single job.
Quickstart documentation is here: http://www.quartz-scheduler.net/documentation/quartz-2.x/quick-start.html
In addition to Quartz.NET you can also look at http://hangfire.io/.

Way to extract mp3 sample in .NET and C# [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
How can I extract some MP3 sample from an MP3 file?
I want to extract some sample of about 10 seconds from these files.
Is there any way or some documentation that I can study in order to do that by myself?
Thanks to everyone!
You could try a C# wrapper around ffmpeg, to convert the file to wav.
From there, you can extract whatever sample you want.
WAV-file documentation:
http://www-mmsp.ece.mcgill.ca/Documents/AudioFormats/WAVE/WAVE.html

what the fastest way to get snapshot from ip-cam [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I have an IP-cam that i want to get a snapshot from it when event get fired.
I have tried to get images from it using an option in it's firmware but it's taking much time about 4-11 sec.
I need another way to get a snapshot from it using c# code.
I'm developing app using c# 3.5
OS windows server 2008
Any sample is very welcome and I will try it now.
Thanks in advance.
You might also want to look into OpenCV. There are a couple C# ports available out there:
Emgu CV
opencvdotnet
opencvsharp

How can I make a desktop video and audio recorder in .NET, using .NET libraries? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I need to make a project for my university. My project is a desktop video and audio recorder in C#... I know that I must use some of the libraries in .NET... But which or how?
It's like Camtasia...
There's at least one article on http://www.codeproject.com that shows how to do this: Capturing the Screen Image in C#

Categories

Resources