# Logic Scripter: Divisi



## Pixelpoet1985 (Aug 1, 2018)

Hi there,

I know this is a Kontakt thread, but I didn't know where to put it.

Has someone experience with the Logic Scripter?

I'm looking for a divisi script like the Multi Divisi Script (https://vi-control.net/community/threads/multi-divisi-script.59985/), because I have many VSL libraries. The auto-voicing feature in VI Pro isn't sufficient, it's no automatic divisi. Would also be great for other libraries outside of Kontakt.

Is it, in general, possible to script such a thing in Logic?


----------



## Dewdman42 (Aug 1, 2018)

Please describe what it needs to do and I'll tell you if its possible to do in LPX Scripter. Probably yes.


----------



## Pixelpoet1985 (Aug 1, 2018)

Okay, I try. I don't know how it works behind the curtains, there have to be some clever algorithms in terms of voice leading, e. g. like in LASS. But a "basic" script would be sufficient. Like the following:

For example: I have four tracks (on midi channel 1, 2, 3, 4) with a french horn each. If I play ...
– one note: all horns 1–4 play in unison
– two notes: horn 1+3 play one note, horn 2+4 play one note
– three notes: i don't know, maybe horn 1+3 play one note, 2 plays one, and 4 plays one
– four notes: all horns 1–4 play a separate note each

Don't know how the multi divisi script, which I mentioned above, works, but this is an awesome one.


----------



## NoamL (Aug 1, 2018)

Possible in theory.. in practice, not sure?

I guess you need to start with an array that stores the pitch of every NoteOn event, and removes them from the array upon NoteOff.

Then you need a subroutine that calculates the number of active notes, every time a new NoteOn is detected.

Then you need a subroutine that orders them by pitch so it knows what the "top" note is.

Then you need a user-programmable way to set the note hierarchy for a given instrument. Let's say that one note is A, two notes is A+B, three is ABC, and four is ABCD. You might want your first horn to play: A, A, A, A in these four cases, while the second horn plays A, B, A, B, the third horn plays A, A, B, C, and the fourth horn plays A, B, C, D.

Then you need a subroutine that tracks what ABCD note your instrument _actually_ is playing, and checks upon every NoteOn event to see if the note-hierarchy that it _should_ be playing has changed, and if so sends a NoteOn (which may not be the same pitch as the NoteOn that the user played!)

all of this becomes MUCH simpler IF you will always only play chords and never overlapping notes or suspensions. Then you can always just assign incoming NoteOns to channels based on how many notes are on. But in practice there will always be a slight time difference between notes when you play your MIDI keyboard so I would consider that method SUPER unreliable in practice.


----------



## Pixelpoet1985 (Aug 1, 2018)

Thanks for your feedback so far. I'm just wondering because the Kontakt version works, like e. g. in LASS or with the multi divisi script. Okay, I don't know how detailed these scripts are, I thought it wouldn't be much different.


----------



## Dewdman42 (Aug 1, 2018)

Yes it can be done. If I get some time tomorrow I’ll whip together a simple one to get you started


----------



## Pixelpoet1985 (Aug 2, 2018)

Really? That sounds great. I can't understand why there hasn't been developed such a thing yet.


----------



## Dewdman42 (Aug 2, 2018)

Thinking it through some more, is it possible? Yes. Is it trivial to do? No.

Part of the problem is that incoming chords are often going to be on slightly different points in start time. So the first note to be detected in a chord, doesn’t know it’s a chord until after it’s already playing. 

I don’t know kontakt script at all to be able to analyze what this multi divisi script does exactly to work through that, but in theory it could be done in LPX scripter also but may not be trivial.

In LPX scripter you could probably program some look ahead logic, with intentionally added latency, which would provide a way to see chords before the first note of each chord is played. Not simple, but possible.


----------



## Pixelpoet1985 (Aug 2, 2018)

Thanks for your efforts.

I can say how it is with LASS:
You have indeed latency (25 to 50 ms) for chord recognition, this is needed. Also you have to determine inside the instrument which divisi part (midi channel) plays which voice. Divisi Part A plays the first (upper) note, Divisi B the second note, Divisi C the third and so on.


----------



## Pixelpoet1985 (Aug 2, 2018)

Do you know any tutorials or other learning materials for LPX scripter which you can recommend?


----------



## Dewdman42 (Aug 2, 2018)

Its sparse. Start here: https://www.logicprohelp.com/forum/viewforum.php?f=45


----------



## Pixelpoet1985 (Aug 3, 2018)

Thanks for the link, I found a possible script there. Exactly the same functions that I want:
https://www.logicprohelp.com/forum/viewtopic.php?f=45&t=121026
https://www.logicprohelp.com/forum/viewtopic.php?f=45&t=115798

I haven't tested it yet. Let's hope it works!


----------



## Pixelpoet1985 (Aug 4, 2018)

@Dewdman42

When you have the time, maybe you could be so kind and have a look at the script I posted above? It works for divisi, but not for unisono. The script is obviously only for divisi. So another option would be to have it activated/deactivated by a CC.


----------

