[jmsl] Max instrument dimension names

jmsl at music.columbia.edu jmsl at music.columbia.edu
Sat Sep 13 18:24:57 EDT 2008


Hi J

You are right, get() returns a copy of the double[]. Sorry for the 
confusion. I think there's good arguments on both sides of the issue of 
returning a reference or a copy...
Use public void set(double value, int e, int d) to change the data in 
the MusicShape itself.

Thanks
Nick



jmsl at music.columbia.edu wrote:
> Okay, I figured out what was up...
>
> I had assumed that MusicShape.get() would return a *reference* to the 
> double[], but it appears to return a deep copy. So, I was making 
> alterations (duration, in particular) to the copy as notes were being 
> entered, and then playing back the original. To quote the infinitely 
> wise Homer: "Doh!"
>
> I have to admit, it seems a little un-Java-like, to me, for 
> MusicShape.get() to return copies, not references. I can see it being 
> handy, in some cases, but it's a little counter-intuitive, imho. I 
> guess this is so Interpreters can mess around with the double[] 
> without altering the original held by the MusicShape, but it might be 
> more Java-like if the Interpreter made the copy, rather than the 
> MusicShape. Just a thought... I'm sure there are plenty of good 
> reasons for doing it the way it's done, but it might be good to make 
> this behaviour more obvious in the docs.
>
> (Or maybe I'm way off on my diagnosis of what solved my problem, and 
> MusicShape.get() does return a reference to the double[]...???)
>
> Anyway, problem solved!
>
> J.
>
>
> On 13-Sep-08, at 2:05 PM, jmsl at music.columbia.edu wrote:
>
>> hmmm... Weird problem. I decided it would be simplest to just align 
>> my MusicShape's dimensions with the MaxInstrument's dimensions, 
>> adding on a few extras for specific purposes. So, my dimensions seem 
>> to be in agreement. The only thing that's not working properly is 
>> that playback seems to be switching Hold for Duration - i.e., it's 
>> packing my notes right up against one another, ignoring any 
>> spaces/rests. That is, if I put single sixteenth notes on each of 4 
>> quarter-note downbeats, I get a run of sixteenths, rather than a run 
>> of 4 quarter-notes, with sixteenth-note "holds"...
>>
>> I know this is probably not possible to diagnose without seeing the 
>> code, but I thought I'd ask, just in case there's some obvious 
>> misunderstanding that would result in this behaviour.
>>
>> thanks,
>>
>> J.
>>
>>
>> On 13-Sep-08, at 9:48 AM, jmsl at music.columbia.edu wrote:
>>
>>> Hi J
>>>
>>> If you play your MaxInstrument with a MusicShape then MusicShape 
>>> will do the translation element by element, right before it calls 
>>> instrument.play()
>>> The instrument itself does not do any translating; by the time it 
>>> has its play() method called, all it gets is a timestamp and an 
>>> array of double[].
>>> So translating is the responsibility of whoever calls ins.play()
>>>
>>> Follow-up questions welcome!
>>> Nick
>>>
>>> jmsl at music.columbia.edu wrote:
>>>> Aaah, thanks so much Nick. I was starting to lose my mind!
>>>>
>>>> I'm assuming then that I can just add my custom dimensions from 5+, 
>>>> then let the built-in translator figure out the name->index 
>>>> mapping... Yes?
>>>>
>>>> J.
>>>>
>>>>
>>>> On 13-Sep-08, at 9:16 AM, jmsl at music.columbia.edu wrote:
>>>>
>>>>> Hello J
>>>>>
>>>>> Yes you can add custom dimensions to MaxInstruments, try this:
>>>>>
>>>>> myMaxInstrument.getDimensionNamespace().setDimensionName(5, 
>>>>> "wiggle");
>>>>> myMaxInstrument.getDimensionNamespace().setLimits(5, 0, 3);
>>>>> myMaxInstrument.getDimensionNamespace().setDefault(5, 0);
>>>>> Remember to leave dimension 4 as it is alrteady defined in 
>>>>> MaxDimensionNameSpace ("eventflag")... so you should only add 
>>>>> custom dimensions from 5 on up
>>>>>
>>>>> Thanks
>>>>> Nick Didkovsky
>>>>>
>>>>> jmsl at music.columbia.edu wrote:
>>>>>> Hi All,
>>>>>>
>>>>>> I can't figure out how I'm supposed to set my Max Instrument's 
>>>>>> dimension names?? I have a custom namespace for the basic 
>>>>>> MusicShape I'm using, and I obviously need Max to understand that 
>>>>>> namespace, and use its formatting. But I can't see any direct way 
>>>>>> to other than SetDimensionNameSpace(), which appears to only take 
>>>>>> an existing DimensionNameSpace... If I could take that from my 
>>>>>> MusicShape directly, I'd be fine, but MusicShape only has a 
>>>>>> dimensionNames() method, not a "getDimensionNameSpace()" method...
>>>>>>
>>>>>> Needless to say, I'm confused.
>>>>>>
>>>>>> J.
>>>>>>
>>>>>> _______________________________________________
>>>>>> jmsl mailing list
>>>>>> jmsl at music.columbia.edu
>>>>>> http://music.columbia.edu/mailman/listinfo/jmsl
>>>>> _______________________________________________
>>>>> jmsl mailing list
>>>>> jmsl at music.columbia.edu
>>>>> http://music.columbia.edu/mailman/listinfo/jmsl
>>>>
>>>> _______________________________________________
>>>> jmsl mailing list
>>>> jmsl at music.columbia.edu
>>>> http://music.columbia.edu/mailman/listinfo/jmsl
>>> _______________________________________________
>>> jmsl mailing list
>>> jmsl at music.columbia.edu
>>> http://music.columbia.edu/mailman/listinfo/jmsl
>>
>> _______________________________________________
>> jmsl mailing list
>> jmsl at music.columbia.edu
>> http://music.columbia.edu/mailman/listinfo/jmsl
>
> _______________________________________________
> jmsl mailing list
> jmsl at music.columbia.edu
> http://music.columbia.edu/mailman/listinfo/jmsl


More information about the jmsl mailing list