grimmdude / MidiWriterJS

♬ A JavaScript library which provides an API for programmatically generating and creating expressive multi-track MIDI files and JSON.
MIT License
557 stars 60 forks source link

Merge tracks in parallel #63

Closed michaelmior closed 12 months ago

michaelmior commented 5 years ago

I have tracks for several different notes on the same instrument that I'm constructing independently. I get the current sound when I export these tracks as an array. However, I want the output to have a single track. When I use mergeTracks, I the tracks end up appearing one after the other. Is there any easy way to do this?

grimmdude commented 5 years ago

Hi @michaelmior,

Thanks for your message. mergeTracks should merge in parallel, but it's admittedly a bit experimental at the moment. Could you post your code so I can test it out and possibly figure out what's going on?

-Garrett

michaelmior commented 5 years ago

Thanks! Here's the function which generates each track and the function which merges them.

jpw commented 5 years ago

Please excuse me for butting in :)

Hi @michaelmior I was intrigued so I had a quick look, and your app appears to export MIDI files just fine...

Have I missed something, or how can the problem be reproduced?

michaelmior commented 5 years ago

The app does indeed export MIDI. However, each instrument is on a separate track where I would prefer them all to be on a single track.

xp2-882030kgz010602 commented 1 year ago

I am having the same issue too.

grimmdude commented 12 months ago

Hi @michaelmior, I'm not able to replicate this currently. I've added a test for Track.mergeTrack() with a very basic example which is currently passing, but please let me know if you're still having trouble.

@xp2-882030kgz010602, if you could post some example code that illustrates the problem you're seeing I can take a closer look.

In the meantime, closing this one out for now.