question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Playing midi files with more than 16 tracks on multiple ports

See original GitHub issue

Hi, I have a midi file with 32 tracks that i want to play using this library. Using this code:

const JZZ = require('jzz');
const fs = require('fs');
require('jzz-midi-smf')(JZZ);

const filename = 'END.MID';
const midiout = JZZ().openMidiOut(3);
const data = fs.readFileSync(filename, 'binary');
const smf = new JZZ.MIDI.SMF(data);
const player = smf.player();

player.connect(midiout);
player.play();

only the first 16 tracks are played, which is expected since one midi port only can handle 16 tracks. Is there any way i can open 2 out ports and play track 1-16 in port1 and track 17-32 in port2?

Thanks!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
teveycommented, Jan 21, 2022

Thanks for the help!

1reaction
jazz-softcommented, Jan 15, 2022

A simple solution would look like this:

// instead of player.connect(midiout)

player connect(function(msg) {
  (msg.track > 16 ? midiout2 : midiout1).send(msg);
});

It can be further refined to handle the ff21 metaevents from the file and automatically decide to which port to send the track data.

Read more comments on GitHub >

github_iconTop Results From Across the Web

More than 16 instruments at the same time
A Type 1 Standard MIDI File can contain multiple Tracks. Each track supports 16 Channels of MIDI data. So a Type 1 file...
Read more >
Play more than 16 MIDI Channels (Pag. 2) - CoolSoft
There's no way for VMS to receive more than 16 tracks from a single MIDI-In port. Actually VMS never receive 'track' information, only...
Read more >
? Best way to setup midi for more than 16… - Apple Community
I assume that your MIDI streams are coming from the outside and arrive on different input ports, max 16 MIDI channels on each...
Read more >
Can I use more than 16 MIDI channels? How do I ... - PG Music
The MIDI standard uses 16 channels. These means that on each MIDI port, you can play up to 16 instruments at a time....
Read more >
Record Multiple MIDI Instruments At the Same Time - Updated!
Logic Pro 10.7 now makes recording different MIDI controllers dead-simple. Thanks to the new MIDI Input Port and Channel Filtering options, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found