I have 400,000 MIDIs that I need to automatically convert to MP3s. I know that MIDIs don't define waveforms. I also know that I can import MIDIs into a DAW and map synths to individual tracks so obviously it's possible to do this automatically. I've been looking for a way to do this. Each MIDI should have a randomly generated synth mapped to each track.
I've looked at SoundFonts but I don't know how to create them or automatically generate them or automatically apply them to MIDIs.
Does anyone know of tools or SDKs that exist for creating synths that can be mapped to MIDI tracks or ways to generate and apply SoundFonts programmaticly? If not, does anyone understand the low level steps involved in a tool that would allow me to do this? I've looked for tools to do this with no success. Maybe if I understood the parts involved I could write something to do this, but I wouldn't even know what to look up.
Any help would be appreciated, Thanks.
OK, there are few different questions here, each with their own difficulties.
Assuming you want to go MIDI -> SF2 -> MP3, the Timidity++ source code would be a good starting point. Timidity++ "can play MIDI files by converting them into PCM waveform data". A recent fork of Timidity++ can be found on Github.
To convert to MP3, you need an additional tool. LAME would be a good starting point here. Stitching together Timidity and LAME, you can go from MIDI to MP3 via an SF2. This script illustrates how this can be achieved without writing your own app.
for file in *.mid do
timidity $file -Ow -o - | lame - $file.mp3
done
The other element of your question, which concerns randomly generated synths, can't really be addressed easily through the above approach. If I understand the question correctly, you want to do the following:
SF2 is a primarily sample-based format, and would introduce unnecessary complexity if you essentially want to play random synths via MIDI and save the output to an audio file.
To address your problem, I would therefore suggest skipping the SF2 step, and looking at an audio processing framework like Synthesis ToolKit (STK). STK is capable of reading MIDI files, and sound synthesis. You can then use LAME for the audio buffer to MP3 conversion.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With