best way to get coll contents into mxj?

Dec 2, 2007 at 9:25pm

best way to get coll contents into mxj?

I have a large coll (in the tens of thousands of entries), that stores a single digit (0 or 1) in each entry. I need to pass this data into Java-land, to process it there.

Is it most efficient to just send the length of the coll to my mxj first, to set the size of a Java array, and then dump the coll contents to the mxj, sequentially writing to the Java array just created?

Or is there some other faster/more elegant automagical way to get my coll contents into a Java array or other structure?

Thanks,
Dan

#34861
Dec 3, 2007 at 8:48am

On 2 Dec 2007, at 21:25, Dan Nigrin wrote:

> Or is there some other faster/more elegant automagical way to get
> my coll contents into a Java array or other structure?

I would probably just code the Java-to-Max linkup via messages to
load the coll (probably in a background thread to avoid locking up
the GUI), but if you’re concerned with performance you could search
for and read and parse the coll file from disk in Java (assuming it
is actually a file, and assuming no interference between Java’s
access to the file and Max’s access).

– N.

nick rothwell — composition, systems, performance — http://
http://www.cassiel.com

#118194
Dec 3, 2007 at 4:07pm

At 8:48 AM +0000 12/3/07, Nick Rothwell wrote:
>On 2 Dec 2007, at 21:25, Dan Nigrin wrote:
>
>>Or is there some other faster/more elegant automagical way to get
>>my coll contents into a Java array or other structure?
>
>I would probably just code the Java-to-Max linkup via messages to
>load the coll (probably in a background thread to avoid locking up
>the GUI), but if you’re concerned with performance you could search
>for and read and parse the coll file from disk in Java (assuming it
>is actually a file, and assuming no interference between Java’s
>access to the file and Max’s access).

Thanks Nick – it’s actually *not* a file (just stored in memory),
though I could obviously make it one… I think I’ll just begin with
doing it as I described, and if it locks up the GUI too much, I’ll
explore the thread stuff…

Dan

Dan Nigrin
Defective Records
202 Hack / PC-1600 User / VSTi Host / OMS Convert / Jack OS X / Major
Malfunction
http://www.defectiverecords.com

http://www.jackosx.com

#118195
Dec 6, 2007 at 8:21am

Personally, I’d just do the whole thing in mxj, and get rid of coll entirely. Surely you must have some method for loading this data into coll in the first place, which could be duplicated relatively easily in mxj. Yes? (“No, I don’t. And stop calling me Shirley.”)

J.

#118196
Dec 6, 2007 at 10:27am

On 6 Dec 2007, at 08:21, jbmaxwell wrote:

> Personally, I’d just do the whole thing in mxj, and get rid of coll
> entirely. Surely you must have some method for loading this data
> into coll in the first place, which could be duplicated relatively
> easily in mxj. Yes?

Predictably, I’m going to suggest that you could do it with some SQL
and the embedded HSQL-DB:

http://www.loadbang.net/space/Software/net.loadbang-SQL

You can build SQL statements in MaxMSP and feed them into the demo
MXJ object, but the tokenising gets a bit gnarly, so it’s cleaner to
work in the Java world with prepared statements.

– N.

Nick Rothwell / Cassiel.com Limited
http://www.cassiel.com
http://www.myspace.com/cassieldotcom
http://www.last.fm/music/cassiel
http://www.loadbang.net

#118197
Dec 6, 2007 at 1:04pm

At 8:21 AM +0000 12/6/07, jbmaxwell wrote:
>Personally, I’d just do the whole thing in mxj, and get rid of coll
>entirely. Surely you must have some method for loading this data
>into coll in the first place, which could be duplicated relatively
>easily in mxj. Yes? (“No, I don’t. And stop calling me Shirley.”)

Maybe!

I’ll give the idea some thought to see if I can do it – the coll gets
populated by a custom external, and I’m doing a bunch of stuff in
Max-land to check to see when that external is “done populating” the
coll – long story.

Anyway thanks, I’ll give it a shot if my other approach fails…

Dan

Dan Nigrin
Defective Records
202 Hack / PC-1600 User / VSTi Host / OMS Convert / Jack OS X / Major
Malfunction
http://www.defectiverecords.com

http://www.jackosx.com

#118198
Dec 6, 2007 at 1:06pm

At 10:27 AM +0000 12/6/07, Nick Rothwell wrote:
>On 6 Dec 2007, at 08:21, jbmaxwell wrote:
>
>>Personally, I’d just do the whole thing in mxj, and get rid of coll
>>entirely. Surely you must have some method for loading this data
>>into coll in the first place, which could be duplicated relatively
>>easily in mxj. Yes?
>
>Predictably, I’m going to suggest that you could do it with some SQL
>and the embedded HSQL-DB:
>
> http://www.loadbang.net/space/Software/net.loadbang-SQL
>
>You can build SQL statements in MaxMSP and feed them into the demo
>MXJ object, but the tokenising gets a bit gnarly, so it’s cleaner to
>work in the Java world with prepared statements.
>
> – N.

I knew you’d chime in Nick! I did consider doing this with a
database, and still may – but didn’t want to invest the time into
figuring it all out if I could get my original approach to work. If
I can’t, I’ll give it a look!

Thanks,
Dan

Dan Nigrin
Defective Records
202 Hack / PC-1600 User / VSTi Host / OMS Convert / Jack OS X / Major
Malfunction
http://www.defectiverecords.com

http://www.jackosx.com

#118199

You must be logged in to reply to this topic.