send/receive race condition - track dependencies
send/receive race condition - track dependencies
Disclaimer: I'm quite new to Max, so apologies if some of this is wrong/presumptuous...
In my style I have generally 2-4 bass instruments and a few acid lines, all of which need *usually* follow the same note.
Using a send/receive pair between tracks to effectively have independent 2 MIDI inputs to an instrument would allow you to just punch in a pattern on the track's own MIDI channel, and then use the other channel to transpose this. I tried it, and quickly discovered that it doesn't work properly, because there is a race condition between the two sources of MIDI data -- the data coming via the send/receive arrives late.
I looked for solutions and found that generally they involve putting a reasonably large delay on the direct MIDI data. Too small a delay and it's unreliable, but too large and you introduce noticeable latency.
Aside from a unilateral feature in Live to do this specific thing, I feel like we should be able to solve this directly with M4L if only track dependencies were a thing (not sure how possible this as an automatic feature with Max as the send/receive channel is a dynamic property of the patch), or at least manually specifiable. Effectively you would then be processing MIDI messages within Max in transactions, so two simultaneous notes on the two separate MIDI tracks would arrive together and be processable together.
Does this make sense? Any thoughts?
Thanks all
Alex
In my style I have generally 2-4 bass instruments and a few acid lines, all of which need *usually* follow the same note.
Using a send/receive pair between tracks to effectively have independent 2 MIDI inputs to an instrument would allow you to just punch in a pattern on the track's own MIDI channel, and then use the other channel to transpose this. I tried it, and quickly discovered that it doesn't work properly, because there is a race condition between the two sources of MIDI data -- the data coming via the send/receive arrives late.
I looked for solutions and found that generally they involve putting a reasonably large delay on the direct MIDI data. Too small a delay and it's unreliable, but too large and you introduce noticeable latency.
Aside from a unilateral feature in Live to do this specific thing, I feel like we should be able to solve this directly with M4L if only track dependencies were a thing (not sure how possible this as an automatic feature with Max as the send/receive channel is a dynamic property of the patch), or at least manually specifiable. Effectively you would then be processing MIDI messages within Max in transactions, so two simultaneous notes on the two separate MIDI tracks would arrive together and be processable together.
Does this make sense? Any thoughts?
Thanks all
Alex
-
- Posts: 6025
- Joined: Mon May 15, 2006 12:15 pm
Re: send/receive race condition - track dependencies
Why not use Live's internal routing ?
MacBook Pro 13" Retina i7 2.8 GHz OS 10.13, L10.0.1, M4L.
MacStudio M1Max 32Go OS 12.3.1
MacStudio M1Max 32Go OS 12.3.1
Re: send/receive race condition - track dependencies
I didn't think that was possible because it's not just a simple merge of the MIDI events. If I need a Max patch, I need 2 MIDI inputs somehow, and Live only offers one per track.
-
- Posts: 6025
- Joined: Mon May 15, 2006 12:15 pm
Re: send/receive race condition - track dependencies
Not if you route two tracks into one.
MacBook Pro 13" Retina i7 2.8 GHz OS 10.13, L10.0.1, M4L.
MacStudio M1Max 32Go OS 12.3.1
MacStudio M1Max 32Go OS 12.3.1
Re: send/receive race condition - track dependencies
Notice that M4L instruments can also be used as *multi-instruments* with 16 different MIDI inputs, if MIDI is routed from other tracks on different output channels.
Re: send/receive race condition - track dependencies
If I route two tracks into one, can Max process simultaneous MIDI events somehow? Or at least in a guaranteed order? The use case is having two MIDI tracks trigger notes at the exact same sample time for an arpeggiator.
Will have a play regardless. Thanks
Will have a play regardless. Thanks
-
- Posts: 6025
- Joined: Mon May 15, 2006 12:15 pm
Re: send/receive race condition - track dependencies
Nothing in the world is simultaneous.
Kidding aside, you should be fine.
Kidding aside, you should be fine.
MacBook Pro 13" Retina i7 2.8 GHz OS 10.13, L10.0.1, M4L.
MacStudio M1Max 32Go OS 12.3.1
MacStudio M1Max 32Go OS 12.3.1
Re: send/receive race condition - track dependencies
You can use [buddy] to ensure that "simultaneous" inputs are processed in a specified order.
Re: send/receive race condition - track dependencies
Thanks for the tips, both.
I tried setting one MIDI track as the input to another, but between the In / Auto / Off options I couldn't get the MIDI data to merge. Am I missing something there? If I set it to In, it uses the other track's MIDI to control the instrument. If I set it to Auto, it uses the data in the track's own sequencer track.
As for 'buddy', it seems like it's not quite suitable because the MIDI data isn't *always* synchronised. Basically what I realised is that I *must* process the "other" track's MIDI signal first, in order to set the transposition value for any MIDI note coming in on the main channel *even if it is scheduled for the exact same sample*.
So it was probably a red herring to talk in terms of transactions/batching, at least for this particular problem. I just always need to process a specific MIDI input *first* in case they are scheduled for the same sample.
Any ideas?
Thanks again!
I tried setting one MIDI track as the input to another, but between the In / Auto / Off options I couldn't get the MIDI data to merge. Am I missing something there? If I set it to In, it uses the other track's MIDI to control the instrument. If I set it to Auto, it uses the data in the track's own sequencer track.
As for 'buddy', it seems like it's not quite suitable because the MIDI data isn't *always* synchronised. Basically what I realised is that I *must* process the "other" track's MIDI signal first, in order to set the transposition value for any MIDI note coming in on the main channel *even if it is scheduled for the exact same sample*.
So it was probably a red herring to talk in terms of transactions/batching, at least for this particular problem. I just always need to process a specific MIDI input *first* in case they are scheduled for the same sample.
Any ideas?
Thanks again!
Re: send/receive race condition - track dependencies
Regarding the timing problem, I think you could just delay all main events by 1ms using [pipe] and if needed compensate by setting the track delay to -1ms.
Last edited by broc on Mon Aug 28, 2017 8:39 pm, edited 1 time in total.
-
- Posts: 6025
- Joined: Mon May 15, 2006 12:15 pm
Re: send/receive race condition - track dependencies
Set your "merge" track : monitor to IN, and input source as "no input" (that's the tricky part).alex-weej wrote:Thanks for the tips, both.
I tried setting one MIDI track as the input to another, but between the In / Auto / Off options I couldn't get the MIDI data to merge. Am I missing something there? If I set it to In, it uses the other track's MIDI to control the instrument. If I set it to Auto, it uses the data in the track's own sequencer track.
Then create as many MIDI tracks as you need, with this "merge track" selected as output.
MacBook Pro 13" Retina i7 2.8 GHz OS 10.13, L10.0.1, M4L.
MacStudio M1Max 32Go OS 12.3.1
MacStudio M1Max 32Go OS 12.3.1
Re: send/receive race condition - track dependencies
Correct. Thanks for the clarification. I've deleted the wrong part of my previous post.chapelier fou wrote:Set your "merge" track : monitor to IN, and input source as "no input" (that's the tricky part).alex-weej wrote:Thanks for the tips, both.
I tried setting one MIDI track as the input to another, but between the In / Auto / Off options I couldn't get the MIDI data to merge. Am I missing something there? If I set it to In, it uses the other track's MIDI to control the instrument. If I set it to Auto, it uses the data in the track's own sequencer track.
Then create as many MIDI tracks as you need, with this "merge track" selected as output.