Auto Select Instrument While Playing Song In The Same Track

Here is Ledger’s tool which captures instruments (using an alternative method)
Autocapture From First Note

It could be modified to capture the notes with a certain time interval?