Forums > Java

Help with Java Tutorial.

Jan 10 2012 | 5:08 pm

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 | 5:37 pm

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

Jan 10 2012 | 5:41 pm

Thanks for taking the time to check it Nick.

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



Jan 10 2012 | 7:17 pm

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 | 7:28 pm

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



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

Forums > Java