Using DirectShow library to edit and save an mp3 file
I want to read an mp3 file, crop section of it, fade in & out and finally save it as a new mp3 file. I found a library called 开发者_Python百科DirectShow that apparently can do this, but I can figure out how to do it. Has anyone done something like this?
I recommend using SoX (Sound eXchange):
SoX is a cross-platform (Windows, Linux, MacOS X, etc.) command line utility that can convert various formats of computer audio files in to other formats. It can also apply various effects to these sound files, and, as an added bonus, SoX can play and record audio files on most platforms.
I recommend that you have a look at the features page. It seems to offer exactly what you need to do.
Multiple audio files can be combined (and then further processed with effects) using any one of the following combiner methods:
- concatenate
- mix
- merge: E.g. two mono files to one stereo file
- sequence: For playing multiple audio files/streams
Now using this you can simply use the command line file in conjunction with ProcessStartInfo
and Process.Start()
and you should be on your way. A very quick example:
ProcessStartInfo psi = new ProcessStartInfo(PathOfCmdLine);
psi.RedirectStandardOutput = false;
psi.WindowStyle = ProcessWindowStyle.Hidden;
psi.UseShellExecute = true;
psi.Arguments = "ArgsHere";
Process.Start(psi);
You can look a library called WinnydowsMediaLib available on http://www.winnydows.com/#Downloads website. It's a .net wrapper for ffmpeg library. FFMpeg is able to open, cut and save mp3 files
You can probably do this with the open-source .NET lib NAudio: http://naudio.codeplex.com
精彩评论