disabling midi triggers whilst audio is playing

hl01's icon

Hi,

(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

brendan mccloskey's icon

Hi
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.

Brendan

hl01's icon

Hi Brendan,

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)

Pedro Santos's icon

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:

Max Patch
Copy patch and select New From Clipboard in Max.
hl01's icon

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.

wowgold5's icon

I am agree with your point of view very much,I think it's doors very well this is our game sites recommended to you.
-------------------------------------------------------------------
http://www.fitrsgold.com/RS2007.Gold