personal rant about vectors (lol)

Discuss Lemur and share techniques.
Post Reply
Softcore
Regular
Posts: 1613
Joined: 04 Nov 2012 08:34

personal rant about vectors (lol)

Post by Softcore »

Ok, why isnt stressed, double stressed, triple stressed in the manual, that in Lemur what is achieved by a singleton can also be achieved with vectors? I mean, like, ABSOLUTELY anything?

Why did it take me so long to understand the concept? WHY oh why, did it bloody take me so long to understand that a vector of like 32 values placed as trigger in a custom midi out is capable of triggering an equally sized vector as value at the relative positions of the values changed?

oh why.............

I THINK.....Im now beginning to understand coding with Lemur.....after oh how many months.......or to put it better, Im now understanding vectors.

end of rant.....feel free to post your own - perhaps we can all learn from each other's rants lol....
Joe Soap
Regular
Posts: 462
Joined: 07 Jul 2012 15:04

Re: personal rant about vectors (lol)

Post by Joe Soap »

Macciza makes a good point about this I think, when he says that "array" is the better term (than "vector").

So . . . if I'm not misunderstanding your post (entirely likely!) - would substituting "array" for "vector" in the manual have helped your understanding along a bit quicker?
Softcore
Regular
Posts: 1613
Joined: 04 Nov 2012 08:34

Re: personal rant about vectors (lol)

Post by Softcore »

It would if I was a programmer......which Im not lol!!!!

24 bloody note outs - 24 custom midi outs can all be replaced by ONE out and two 24-sized vectors for trigger and velocity.....well I be damned......

Gotta give props to Claviamat developer, Mat - his approach really unveiled the "secrets" of triggering with vectors. it was a big school for me...

For anyone interested here it is: http://liine.net/en/community/user-library/view/25/
For beginners: study reaaaaaally hard and grasp HOW the pitch and the trigger vectors work and you will feel enlightened - I know I did.

And Im heading for a 3% decrease of memory usage in one of my templates - lol.
Rolix
Newbie
Posts: 28
Joined: 18 Mar 2013 19:41
Location: Munich

Re: personal rant about vectors (lol)

Post by Rolix »

Hi,

I've started Lemur programming a few days ago - I'm working as a programmer (Delphi/SQL) btw, so getting familiar with the Lemur script language was more a matter of finding out what I *can't* do compared to a full fledged programming language and environment.

What helped me alot in understanding the inner workings of Lemur was/is using Monitor objects everywhere, like Monitor.value = Pads.x, which showed me how Lemur triggers multiple MIDI events at the same time.

I'd call vectors "dynamic commaseparated typeless lists" or simply "lists". I assume calling them arrays would be misleading, as arrays can have multiple dimensions, not so Lemur vectors to my knowledge.

To get back to using vectors for MIDI, I quite like the way Lemur implents this. Assuming you have three variables for MIDI data:

velocity
pitch
trigger

connected to the corresponding properties of your NoteOn Message - in order to trigger a c major chord you'd set them to

velocity = {1, 1, 1}
pitch = {60, 64, 67}
trigger = {1,1,1}

I'm pondering about building an arpeggiator based on that concept, since you're not forced to set the trigger values to 1 all at the same time, but instead you could set them one by one leaving a certain time span between the steps, like

trigger = {1,0,0}
wait(beatdivision)
trigger = {1,1,0}
wait(beatdivision)
trigger = {1,1,1}

Not sure how to code that yet, I think you'd need a function triggerd at OnFrame and some sort of beatdivision calculation.
Softcore
Regular
Posts: 1613
Joined: 04 Nov 2012 08:34

Re: personal rant about vectors (lol)

Post by Softcore »

So ummmmm, if we have set the midi mapping of an expression so that for example value={a,b,c} and then we have a trigger={r,s,t} when trigger is triggered, value is sent out.

Just tried and I cant pull off the same stunt with midiout in a script.....

So I mean, I can't go

decl e, k={a,b,c}, l={r,s,t};
midiout(0,{e, k, l});

.......unless I'm missing something......

It would be a nice way to encapsulate various custom midi outs of my template in a script with midiout function if it did that.....

But on the process of trying to make it work, I just learnt a lot about the formats posible to be used as midiout msg arrays......( midiout(target, msg[])

for example midiout(0,{208,x}) outputs channel pressure on midi channel 1 with x value - 209 would be Midi channel 2 and so on and so on....

for key pressure the Midi channels are 160-175, then comes the pitch then the value so its
midiout (0,{160, pitch, x});

;)
Last edited by Softcore on 22 Mar 2013 07:30, edited 1 time in total.
Macciza
Regular
Posts: 1315
Joined: 07 Dec 2011 04:57
Location: Sydney, Australia.

Re: personal rant about vectors (lol)

Post by Macciza »

Hi
I'm presuming you used something other than 'a,b,c' and 'r,s,t' otherwise midiout won't understand . . .

Also did you notice that those are decimal numbers your using and that you can also use hexadecimal?
ie 160 = 0xA0, 161=0xA1 etc up to 175 = 0xAF - these are the 16 midi channels
144 or 0x90 = NoteOn -Channel1 etc

MM
iMac 2.8G i7 12G 10.6.8/10.7.2, Legacy Dexter/Lemur, Liine Lemur/iPad2, KMI SoftStep, 12Step & QuNeo , B-Controls, Mackie C4 etc
MaxMSP, Live Suite, Native Instrument stuff, etc Modified Virtual Guitar System etc All Projects/Modules © CC-BY-NC-SA[*][/b]
Softcore
Regular
Posts: 1613
Joined: 04 Nov 2012 08:34

Re: personal rant about vectors (lol)

Post by Softcore »

Yes yes, it was just an example.....

On to specifics, simplified - I currently have
pitch = {0,1,2,3,4,5,6,7,8,9,10,11}
aftera : a vector with the same size and the values inside calculated from a one line script

I have set up a custom MIDI object, configured to Key pressure type and the following settings:

key: pitch
pressure: aftera (also acts as trigger - set to any)
midi channel: 1


of course it works as expected....I then tried to replace this custom MIDI with a script

on expression aftera
midiout(0, {160,pitch, aftera});

hoping to get the same results, but it didnt work....

Maybe it should and theres something else in my logic gone wrong? Or maybe I had something typed wrong - if you confirm it should work I'll have to check again to see if I made some silly mistake
Macciza
Regular
Posts: 1315
Joined: 07 Dec 2011 04:57
Location: Sydney, Australia.

Re: personal rant about vectors (lol)

Post by Macciza »

Hmm
It works a bit differently in a script compared to the mapping panel . . .

I would read it that your pitch and aftera are just being returned rather than interacting - so your message ends up with vectors . . .
I think you need to get them back down to single vals somehow - or multiple but interleaved values of pitch/aftera pairs ..
ie midiout(0,{144,60,90,64,90,67,90}) should be a Chord . . .

Hope that helps
MM
iMac 2.8G i7 12G 10.6.8/10.7.2, Legacy Dexter/Lemur, Liine Lemur/iPad2, KMI SoftStep, 12Step & QuNeo , B-Controls, Mackie C4 etc
MaxMSP, Live Suite, Native Instrument stuff, etc Modified Virtual Guitar System etc All Projects/Modules © CC-BY-NC-SA[*][/b]
Post Reply