Forums > MaxMSP

How to clear buffer when it can't load new file?

April 7, 2014 | 3:55 pm


I’m in a pickle again.

I am loading a sequence of audio files into a buffer, sometimes the files will not be there and it will give me an error message saying ‘Can’t open ____’.
This is ok, but I want it to then clear the buffer with silence if it cannot find a new file, rather than repeatedly playback the file that’s already in the buffer.

Any ideas?
Is there a way to tap into the error messages in the Max window and trigger events (such as clearing a buffer) if particular error messages show up?

– Pasted Max Patch, click to expand. –
  • This topic was modified 11 months by  conorb. Reason: clarity
April 7, 2014 | 4:50 pm

You could use the error object to do this. Other options are the absolutepath object (to check the file path to see if its valid) and the bang outlet of buffer~:

– Pasted Max Patch, click to expand. –
April 7, 2014 | 4:56 pm

Your absolutepath method is a wonderfully elegant way to achieve exactly what I needed.
Thank you so much!

April 7, 2014 | 5:04 pm
– Pasted Max Patch, click to expand. –
April 7, 2014 | 5:17 pm

Ah. Too slow. Ben’s kung fu is strong.

April 7, 2014 | 6:00 pm

setting a size again should also clear it.

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

Forums > MaxMSP