如何在C#中获取音乐曲目的长度

编程入门 行业动态 更新时间:2024-10-26 06:33:08
本文介绍了如何在C#中获取音乐曲目的长度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

嗨... 我想知道如何获取C#中音乐曲目(具有mp3类型)的长度(持续时间).(例如:3:45). 我之前问过这个问题,但没人能回答正确! 如果您有解决方案,请与以前的解决方案进行比较,因为它们没有用!!! 关于(.Length),我应该告诉细节没有长度"选项!!! 而ID3并没有使用它只给艺术家,专辑使用的长度... !!! :D 谢谢

Hi... I want to know how can i get the length(duration) of a music track (with mp3 type).(for example: 3:45) in C#. I asked this question before but no one couldn''t answer it right! If you a solution please compare it with the ex-solutions because they weren''t useful !!! and about the (.Length) I should tell the details doesn''t have Length option !!! and the ID3 doesnt give use the length it just give artist, album...!!! :D Thank you

推荐答案

这些链接可能有帮助- 一个简单的C#Wave编辑器,第1部分:背景和分析 [ ^ ] social.msdn.microsoft /forums/zh-CN/Vsexpressvcs/thread/b83106f2-e16d-4f30-ac31-854055c9efdc/#2685871 [ ^ ] These links could help - A simple C# Wave editor, part 1: Background and analysis[^] social.msdn.microsoft/forums/en-US/Vsexpressvcs/thread/b83106f2-e16d-4f30-ac31-854055c9efdc/#2685871[^]

检查这篇文章: www.codeproject/KB/vb/Windows_Media_Player_COM.aspx [ ^ ] 尽管它在VB中,但是您可以使用以下工具对其进行转换: www.developerfusion/tools/convert/vb-to-csharp/ [ ^ ] Check out this article : www.codeproject/KB/vb/Windows_Media_Player_COM.aspx[^] Though its in VB, you can convert it using this tool : www.developerfusion/tools/convert/vb-to-csharp/[^]

我认为您正在寻找返回TimeSpan对象的 I think you are looking for the TagLib.File.Properties.Duration

.从那里,您可以使用TotalSeconds来获取mp3的长度(以秒为单位). 或通过此链接- 链接 [ ^ ]

which returns a TimeSpan object. From there you can use TotalSeconds to get the length of the mp3 in seconds. or go through this link- Link[^]

更多推荐

如何在C#中获取音乐曲目的长度

本文发布于:2023-07-11 09:27:31,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1093579.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:曲目   长度   如何在   音乐

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!