Extracting and converting audio.

Apr 21, 2011 at 3:18 PM

Hello, this is what i need to do:

I have a mp3 file usually 44Khz, 128 kbps, stereo or better, from this file i need to extract the first 30 seconds and save it to new mp3 file with lower quality, probly at 22050 Hz 56kbps stereo.

Can i use NAudio for this or anybody know how can i solve this in C#

Tu use a command line tool could be ok if no other choice, but it need to be win32 program to run in a Windows 2008 server.



Apr 25, 2011 at 10:36 AM

You can use the MP3FileReader to convert to PCM. Then simply take the first 30 seconds of audio and write it to a WAV file using the WaveFileWriter. Finally, you will need to use a tool like LAME to convert the resulting WAV file into MP3 as NAudio does not support MP3 encoding.


Apr 25, 2011 at 11:50 AM

Thank you have seen some partial code for this in the BLOGs refered in home page of project.