abudaan / heartbeat

a javascript MIDI/Audio sequencer for your browser
http://abudaan.github.io/heartbeat/
120 stars 20 forks source link

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

Open dmarks2 opened 9 years ago

dmarks2 commented 9 years ago

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?

TimVen commented 9 years ago

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

abudaan commented 9 years ago

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