heartbeat icon indicating copy to clipboard operation
heartbeat copied to clipboard

Request for an example how to play midi files and use general midi instruments

Open dmarks2 opened this issue 9 years ago • 2 comments

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?

dmarks2 avatar Jul 14 '15 19:07 dmarks2

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

TimVen avatar Jul 15 '15 09:07 TimVen

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

abudaan avatar Jul 23 '15 16:07 abudaan