Designed to simulate a horn or string section of SWAM Instruments. Each instrument is monophonic.
This script waits for a key input – if one key, it sends a unison to Midi channel 1, 2 and 3.
If a triad, it sorts the 3 notes in order from low to high. It sends low to Ch1 (Trombone?) middle to Ch2 (tenor sax) and high to Ch3 (Trumpet).
When you press the key it starts a timer to capture the multiple notes. The higher the timer, the easier it is to capture 3 notes in that time window but the increase in latency. The lower the timer, you need to be more precise to get the 3 notes as close to the same time as possible but lower latency.