Closed UncoDong closed 4 years ago
I finally solved this problem just now, I fund java's package javax.sound
could do it well, like the code:
import javax.sound.sampled.*;
void Convert(String midipath,String wavpath) { AudioInputStream audioStream = AudioSystem.getAudioInputStream(new File(midipath)); AudioSystem.write(audioStream, AudioFileFormat.Type.WAVE, new File(wavpath)); }
I have already write it as a jar file, anyone whant to use can visit my github
Hello there. For a stream s, I use
s.write('midi', fp=r'C:\Users\Mypath')
to save midi file, but I can't play it any way. So I tried to useTimidity
,Wondershare UniConverter.
or other software to covert it to wav , but it didn't work.I know there is a free online convert website https://www.zamzar.com/, it works well. But cause I'd like to convert many midi files like this, so a localy convert tool is necessary. The tool writen by code is also ok for me. If who can help me, I will express my gratitude to him/her.Cause my mother language is not Engilsh, please forgive my poor English...