Help with Java Tutorial.

Jan 10, 2012 at 5:08pm

Help with Java Tutorial.

I’m trying to write a Java tutorial for the Max community, specifically focusing on doing interesting thing to buffers using mxj.

I’m just learning Java myself so it’s a big learning experience for me. I think it would be great to have more Max Java tutorials so I’m trying to do something about it.

I’ve written an example patch which randomly chops up a buffer. It works fine with short files but crashes with very long audio files. I’m guessing that the length of the file is longer than can be represented using an int. Another guess is that using ‘long’ would help matters. Only thing is that I’m having trouble implementing it.

If someone could take a look I’d appreciate it. Max patch, class, and java attached.



Jan 10, 2012 at 5:37pm

Works fine at 10 mins / 160Mb. How big are the files you’re trying?

Jan 10, 2012 at 5:41pm

Thanks for taking the time to check it Nick.

The file was about 28min long somewhere around 300Mb. Any Ideas?



Jan 10, 2012 at 7:17pm

just tweeted, but it could be an OutOfMemoryException – try changing

max.jvm.option -Xmx256m

to something much larger, say

max.jvm.option -Xmx800m

in the file (its in java dir in the Max/Msp install)

I’ll have a play with your patch + java later this evening (just guessing here)

Jan 10, 2012 at 7:28pm

Oh well done big_pause! That’s fixed it. Glad it was not my fledgling code.




You must be logged in to reply to this topic.