2

Does someone know how to convert a MIDI file (average playback time of 30 seconds) which is represented in a byte array to an MP3 byte array?

So, ideally I need to have a C# function which accepts a MIDI byte array and returns a MP3 byte array.

The conversion should not take more than 2 - 3 seconds.

Are there any frameworks / tools / 3rd-party DLLs to perform this easily?

Please let me know.

Thanks, Vijay

5
  • 2
    You're aware you'll need a software synthesizer to do so? It can be the crappy one built into Windows though. Commented Oct 8, 2010 at 12:35
  • @ herzmeister der welten :Could you please provide resources, to understand the basics of programming audio conversion ? Commented Oct 8, 2010 at 12:49
  • As @Aliostad said, a MIDI file contains no audio. It contains instructions when to play which note with which volume (and other parameters). It's like automation for a music keyboard or another electronic instrument. The quality can differ enormously depending on which device is used. For more info see en.wikipedia.org/wiki/MIDI . Windows has such a "keyboard" "built in". It will generate the appropriate sounds when it reads a MIDI file and play it. Commented Oct 8, 2010 at 12:59
  • Thanks herzmeister der welten Commented Oct 8, 2010 at 13:56
  • is.gd/igp4m -- I've seen soooo many questions about converting MIDI to audio I had to write this. Please take the time to read it if you are considering writing some software system which needs to do that. Commented Dec 6, 2010 at 18:57

2 Answers 2

2

MIDI file is not audio, it is audio instructions. This has to be "rendered/played" to audio (using various MIDI players depending on the capability of your sound card) and then compressed to MP3.

I do not know a DLL that can do all of that. Lame MP3 DLL is a free open source DLL that can do the compression for you.

http://lame.sourceforge.net/

Sign up to request clarification or add additional context in comments.

Comments

1

Over at CodeProject there's a C# MIDI Toolkit which could help you. You'll probably have write the code to record the output stream yourself though.

1 Comment

Thanks herzmeister der welten

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.