如何使用 C# 合并/加入 MP3 文件? [英] How do I merge/join MP3 files with C#?
问题描述
我有一个包含不同单词/短语的库,为了构建句子,目前我将这些短语的组合添加到播放列表中以构成句子.不幸的是,如果用户正在运行 CPU 密集型应用程序(我的大多数用户都是这样),句子中间(短语之间)可能会有几秒钟的延迟.
I have a library of different words/phrases, and in order to build sentences at present I add a combination of these phrases into a playlist to make a sentence. Unfortunately if the user is running CPU intensive applications (which most of my users are) there can be a lag of a few seconds mid-sentence (in between phrases).
为了解决这个问题,我正在考虑一种方法,可以将 MP3 文件的正确组合动态合并成一个适当的短语,将其保存在 %temp% 目录中,然后播放这个 1 MP3 文件,它应该克服我遇到的差距问题.
In order to combat this I was thinking of an approach which will merge the right combination of MP3 files on the fly into an appropriate phrase, save this in the %temp% directory, and then play this 1 MP3 file which should overcome the problem I'm experiencing with gaps.
在 C# 中最简单的方法是什么?是否有捷径可寻?这些文件相当小,每个文件长 3-4 秒,一个句子可以包含 3-20 个词组.
What is the easiest way to do this in C#? Is there an easy way to do this? The files are fairly small, 3-4 seconds long each, and a sentence can consist of 3-20ish phrases.
推荐答案
MP3 文件由帧"组成,每个帧代表一段简短的音频片段(我认为大约 25 毫秒).
MP3 files consist of "frames", that each represent a short snippet (I think around 25 ms) of audio.
所以是的,您可以将它们连接起来没有问题.
So yes, you can just concatenate them without a problem.
这篇关于如何使用 C# 合并/加入 MP3 文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!