heartbeat
heartbeat copied to clipboard
Request for an example how to play midi files and use general midi instruments
Hello,
I would like to play midi files (.mid) with heartbeat.js. This works so far, however every track is played with then sinewave instrument.
Is it possible to use general midi instruments? How can you add instruments so that the "original" instruments from the .mid file are used?
Hi,
As far as I know, Heartbeat doesn't contain synthetic/midi instruments so you'll need to setup your own library with sample based instruments. The sine is the default instrument when nothing has been assigned or loaded. You'll need to create some instruments with samples and mapping (see docs) load them into heartbeat then assign the instruments to the tracks.
Hope that helps
Sorry, I have missed this issue completely. Heartbeat comes with a small set of sample instruments: https://github.com/abudaan/heartbeat/tree/gh-pages/assets
Check this example to see how you can use them to play a midi file: http://abudaan.github.io/heartbeat/examples/#!miscellaneous/create_song_from_midifile
You can also use the standard instruments on your soundcard, see this example: http://abudaan.github.io/heartbeat/examples/#!midi_in_&_out/midi_out_file