disabling midi triggers whilst audio is playing
(newbie here) I’m writing a patch to midi trigger 4 individual audio files, I realise there are multiple ways to do this.
Here’s the catch – while a single audio file is playing I do not want playback to be interrupted, so if audio is paying pressing any of the midi triggers shouldn’t do anything until playback of the current file has finished.
I was thinking that a system involving a gate triggered by the audio signal could be a possible solution but as I’m new to this I thought I’d put it out there with the pros in case there’s a simple way to get round this.
Any ideas would be greatly appreciated!
many thanks in advance
it depends on how you are playing back audio – are you using [sfplay~] or [groove~] + [buffer~], or some other means? The [sfplay~] outputs a bang when it is finished playing and [groove~] outputs a 0. – 1. ramp signal while it’s playing. You could use this info to gate incoming MIDI. No time to build it for you though, soz, but be aware of feedback loops if you are sending numbers or signals back in time.
Many thanks that’s definitely helpful and I think I’m getting the hang of it. I think I’ve figured out a way of playing one audio stream and muting the others until it has finished.
The one thing I can’t get my head around is adapting a trigger so it can’t interrupt itself if that makes sense?
So currently a single midi trigger is assigned to a single audio file, the midi trigger is pressed once and the audio file plays, however if the trigger is pressed again it will always restart the audio – I don’t want this to happen during playback as when when played the audio file has to play all the way through without interruption.
I was thinking of employing a system that used a gate to disable incoming midi that was reenabled by the bang when [sfplay~] finishes playing, but I’m guessing a trigger that tries to deactivate itself at the same time as being activated would result in a stack overflow.
Perhaps I could implement a timer that disables the midi signal a couple of milliseconds after the audio has been activated?
(I should maybe note that the audio files I’m using are full length songs that need to play uninterrupted in their entirety when triggered)
Why don’t you just filter re-triggers with [change]?
If you have a level of abstraction between the MIDI reception and the playback system (sfplay~), you could just do something like this:
----------begin_max5_patcher---------- 832.3oc4X1saZCCEG+ZpzdGrxtYShh7WIP1tZu.6EXZpxDLTWk3DkXXzUs8r O+AglQIjvpIcqSBQjON19u+4y4X67vatZTv77s7p.vG.eALZzCZKir1LVFUa XTPFaaRJqx9hAY7pJ1Jdv3cUp3aU1Jf6MIWmIjobksA3ZqKykJIKiae4OUJX o6afXg0X976tlFt2Z9ZktST2WvcJLH.70FCgqZ6XfpMWvTI2Jjqtojmnbshf Bm.GCHPn8AdR3X.Z1D3i8kQXUhuaGEDdBzZ9Gu4JyS8iwOezf7CZh7LZvyrn ASu7nQx+ldJ7TxTsrHkc+O8Cel1NepDqjlVABlyjqZkV3dPqoVZQisEfmhV0 1qXap0wa+rQC6m05ENMx0+vv3Hc+AcVB9nVg92MzSQnXe6Fhe0DgR7LZPwut hPoWzHzZZ8eeDJx2tgjWKQnjXeiF3KeDJOU6rCBgfPDHDCBIGGUQmIpNwIwr gni69YqHMpajhBsHEA6Qb7e0Y8HvKaVO3+HY8Zi0I2pm57iiZz4gZ7oBu05W HU0OZC0jd3Yhsn14edobLWmMmW5GnLqcnrCHOWmu3VARAqTKPEu7FtjMO0Nt PuSqj7rLtYpbnu0RQpdrA5YCPlq3WmubYE3ca3o4IB08.368CgiBNN5fmBcN bE4xxEQOhyT4p41dYBbvR7sho3dIqGldY1o0wKB8EXSAiGjP5EOlvNCI8TpJ 6+znylVtWLHUHexGHxNZlJNfgU4qKSpmE0mf.febHWvqTBISIxkMdKym0.zP X2JVrfK+snmEhJStCK9NwxZuEl4iL0bHaQXS6TXYhEE45kncHhfoly+QvSc6 HG4NSXyR3H2t0w12zVpgN787zLCPcNOCG9EfHOs.3agYcY6lXjgmXjdQL5vK LZuHFd3EF1SD6ffbLoYPNZVyf7ckpCxgCQPNoWIyLW7cnW.P8RXvycA.Qat. D2j+wMwOBMH3G1K+ezvmJK1S322BC2OgM76JYtnT2BCO7QRXZuD1rAWX8J0C 9fcHFHcg5kt9y40tSHyJJ1vKq100NIouNwc4kO9ctzYvjtxtqIDTx2HpaB0Y hUpOBuRe980kt6NrcVTftF6.p+6W4Y3cp. -----------end_max5_patcher-----------
Hi thanks! that really helped Pedro. I’ve managed to come up with something that works now, thanks again to you all for the suggestions.
Forums > MaxMSP