MIDI song position pointer, and code optimization

Jan 26, 2011 at 4:05am

MIDI song position pointer, and code optimization

I’d like to implement code to extract MIDI song position pointer information out of a MIDI input stream. I’ve written the code to do so (the messages are 3 bytes long, and start with decimal 242) – see below (the bytes are just printed to the Max window).

My question: does anyone have a better, more efficient way to capture these three bytes out of the incoming MIDI stream? For some reason, something tells me that I’m doing this in a more clunky fashion than I need to, and I’m having a mental block!

Thanks in advance…

– Pasted Max Patch, click to expand. –
#54603
Jan 26, 2011 at 7:29am

Hello Dan Nigrin,

i have not test it as i don’t have any MIDI device ; so just an idea :

– Pasted Max Patch, click to expand. –

is not there any object specific as [ctlin] to do the job in max ?

HTH

#196650
Jan 26, 2011 at 12:01pm

@dan not sure if that’s more efficient, that’s a few objects less.

– Pasted Max Patch, click to expand. –
#196651
Jan 26, 2011 at 12:57pm

I think vanille’s solution is perfect.
Maybe a bit less efficient, but that does it really matter when processing midi?

#196652
Jan 26, 2011 at 6:57pm

Thanks to you guys for the two solutions! Both much cleaner and nicer than mine…

#196653
Jan 26, 2011 at 10:35pm

Ultimately though there should be an object for this – it is a standard system midi message, so it should only need minor editing of existing code ,
cheers

#196654

You must be logged in to reply to this topic.