I need convert/synthesize MIDI data to audio stream PCM data. What would be an easy way to do so?
-
2http://is.gd/igp4m -- I've seen so 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. – Nik Reiman Dec 06 '10 at 18:57
-
@Nik: Surely I know all that (and I would think most people do as it is just logical). What do you think would be a better word instead of "convert" here? – Albert Dec 06 '10 at 21:23
-
1I'd use the word "synthesize". ;) Sorry, I didn't mean to sound condescending; it just seems that this question gets asked a lot by people who underestimate the difficulty of doing this task. – Nik Reiman Dec 07 '10 at 01:01
-
Possibly 'render'. Although the link above has gone dead. – XTL Dec 28 '11 at 09:28
-
1@NikReiman i'd like to read what you wrote about "audio to midi" but the link (is.gd/igp4m) is dead. could you post a permalink? – sam boosalis Nov 13 '12 at 03:21
-
1@samboosalis yeah, I migrated domains some while back. New link is here: http://www.mergeconflict.net/2010/12/just-for-record-you-dont-convert.html – Nik Reiman Nov 13 '12 at 08:22
4 Answers
Take your pick on what you want to do, there is a MIDI section on the page.

- 126,773
- 69
- 172
- 181
-
It seems that none of the MIDI libs which are listed there can do what I asked for. Or did I miss one? – Albert Dec 04 '10 at 18:12
-
1I am not aware of a specific answer to your question, however do glance over the libraries in the link, maybe they do serve your purpose. If you are aware of an external command/ software that can do this for you, then `subprocess` can help. – user225312 Dec 04 '10 at 18:28
-
@Albert: Almost all of the MIDI tools in "Playing & creating sound" can handle it. – Ignacio Vazquez-Abrams Dec 04 '10 at 20:26
-
-
You don't see how "... can either be used to play audio itself, or you can call a function that returns chunks of audio data..." supports that? Really? – Ignacio Vazquez-Abrams Dec 05 '10 at 00:37
-
2I think my problem was that I didn't realized that the thing I want is called "synthesizer". – Albert Dec 05 '10 at 16:06
I decided to code my own (based on timidity and subprocess). The code can be seen here: https://github.com/albertz/learn-midi/blob/master/decode.py
I downloaded a prebuild binary of Timidty for MacOSX here: http://www.merenbach.com/software/ports/timidity
And I installed the Freepats package from here: http://freepats.zenvoid.org/

- 65,406
- 61
- 242
- 386
You can try this:
Project description:
"Easily synthesize MIDI to audio or just play it. It provides a Python and command-line interface to the FluidSynth synthesizer to make it easy to use and suitable for scripting and batch processing. In contrast, most MIDI processing software is GUI-based."

- 31
- 4
Is using Jython an option ? I think the javax.sound.midi classes would handle this.

- 2,127
- 15
- 16