Forums > MaxMSP

Extracting data from filename (help me optimize this small chunk of code)


jbl
July 7, 2012 | 4:39 pm

Rather than using some fancy msp ways to detect the bpm of some of my loops, I chose to include the exact bpm in the filename and now I am extracting it when I load the file to my buffer. However, I am wondering if there’s a way to do it with less objects.

I know the bpm is written in the 5th, 6th and 7th character from the right, so after converting my filename into a list, I revert it and select these 3 characters. If the filename has no bpm, these characters won’t be number so in the end I get 0, I will make sure receiving a 0 there will turn off the bpm sync.

So yeah, I think this patch works fine but I am wondering if I could make it shorter / more efficient.

Thanks.

– Pasted Max Patch, click to expand. –


jbl
July 7, 2012 | 5:53 pm

Wow!

This is incredible. I see that you find the underscore and the .wav and just output what’s inbetween.

I gotta learn how to do that haha! thanks.. I’ll get started with regexp!


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