I have got one midi file and i want to play that file on web page, currently i am using midi.js player for playing but it is not working on mobile browsers.
Please guide me how to play that file or else how can i play midi or convert it into mp3
Here is my code
$data = fopen ($midi, 'rb');
$size= filesize($midi);
$contents = fread ($data, $size);
fclose($data);
$encoded= base64_encode($contents);
$encode = "'data:audio/midi;base64,".$encoded."=='";
and finally passing base64 value to midi.js
FluidSynth + FFmpeg
An alternative to timidity:
Tested on Ubuntu 20.04, FluidSynth 2.1.1-2, and this MIDI file: https://en.wikipedia.org/wiki/File:MIDI_sample.mid
Related: https://softwarerecs.stackexchange.com/questions/10915/automatically-turn-midi-files-into-wav-or-mp3/76955#76955