Forums > MaxMSP

Bang when read completed for [detonate]?

Sep 11 2010 | 11:02 pm

Hi, is there a way to know when [detonate] is finished reading a MIDI file? I’m working on a MIDI sequencer, and I need to know when the read is complete so that I can then start stepping through the events in order to draw them.

Sep 12 2010 | 12:11 am

detonate reads out a delta time value of -1 when reporting the last note event. You can use this to test that the read is complete.

Sep 12 2010 | 12:38 am

Thanks, but I’m not sure that’s the same issue. Just to clarify, I meant when [detonate] is finished reading a MIDI file from disk via the "read" message. How I could use the -1 identifier to test that the read is complete? The only idea I have with that method is to use an [uzi] every second or so after "read" is sent to [detonate]. I made a sample patch below, but it seems a bit clunky because there’s no way (that I know of) to know how many bangs the [uzi] should send, and also if the user clicks "Cancel" when prompted for a MIDI file, it will continue checking for that -1 indefinitely.

-- Pasted Max Patch, click to expand. --

Sep 12 2010 | 5:22 am

The problem is essentially that if a user clicks a button in the GUI to read a MIDI file, browses for the file, and clicks "Open," the file will load into [detonate], but nothing will be output until something causes [detonate] start stepping through the data. In my case, as soon as the MIDI file is loaded, I want to rapidly step through its contents in order to draw the notes in the sequencer.

Sep 12 2010 | 12:16 pm

Try replacing metro in your patch with a [deferlow]– it _may_ work for all circumstances, and at least _should_ work for most situations, I think.

Sep 12 2010 | 12:43 pm

OK try this– should be reliable

-- Pasted Max Patch, click to expand. --

Sep 12 2010 | 5:28 pm

Thanks a lot Terry, that’s perfect. I actually replaced the [dropfile] with [opendialog] because this also defines the file path at the same time the read command is sent to [detonate], but yeah… pretty much the same thing. Thanks!

Viewing 7 posts - 1 through 7 (of 7 total)

Forums > MaxMSP