Closed a-cinchetti closed 5 years ago
Hi, this is quite straight-forward. File src/meico/app/Main.java
(the commandline application) is basically meant as a demo for the usage of meico as a library. So let's say you have a Java File
object called file
that holds your MIDI file. From this you instantiate a meico.Midi
object, export an Audio
object and write it to the filesystem.
File file = new File("path to your midi file");
Midi midi = new Midi(file);
Audio audio = midi.exportAudio();
audio.writeMp3();
or as a oneliner: (new MIDI(file)).exportAudio().writeMp3();
Some common Java Exception handling will be necessary as Midi(file)
throws an InvalidMidiDataException
or IOException
if the file does not exist or is no proper MIDI file.
Method exportAudio()
can also be provided with a soundbank (as URL
or File
object) to use other sounds than the standard Java soundbank. Supported formats are .dls
and .sf2
.
Method writeMp3()
writes the MP3 file into the same directory as the MIDI file. If you want to specify another destination, call this method with either a File
instance or a String
to your desired path.
Hi, i need to use meico like a library to convert files from midi to mp3. How can i do this? Exists a function that i call directly? thanks