# MIDI Drag&Drop not working in Studio One



## Mike Greene (Nov 25, 2018)

Our Fingerpick Drag&Drop MIDI files have been working fine, until we got a customer a few days ago saying it wasn't working for him in Studio One. I figured MIDI files are MIDI files, so this must be user error, since the MIDI files definitely work here and for lots of other customers over the last two years.

But our tech support guy set up a test, and indeed, Fingerpick's MIDI files do not load into Studio One. Weird! So I figured this must be a Studio One issue, except other Kontakt instrument's MIDI files _do_ work in Studio One! How could something as simple as a MIDI file not work only for us and only in Studio One?

Anyone have an idea why this might be happening? The _"now make the MIDI file"_ part of my KSP code is here:

```
mf_remove_event($ALL_EVENTS)
mf_get_first(0)
$counter := 0
while ($counter < ($Row_Length_2_Bar))
   if (%Midi_File_Note[$counter] > 0)
      mf_insert_event(0, %Midi_File_Ticks[$counter], $MIDI_COMMAND_NOTE_ON, %Midi_File_Note[$counter], %Midi_File_Vel[$counter])
      mf_set_event_par(mf_get_id(),$EVENT_PAR_NOTE_LENGTH,%Midi_File_Length[$counter])
      mf_get_next(0)
   end if
   inc($counter)
end while
```


----------



## EvilDragon (Nov 26, 2018)

There doesn't seem to be anything wrong with the MIDI event generation part there, as far as I can tell.

Perhaps you should try using mf_reset() instead of mf_remove_event($ALL_EVENTS), though. Not sure if it'd help, but that's the preferred way of resetting the MIDI object.

You don't need to use mf_get commands when creating a MIDI file, though. You already set the position of an event in the second argument of mf_insert_event().


Try creating a MIDI object from an empty MIDI file, from scratch, see if that works in S1.


----------



## geronimo (Nov 26, 2018)

This link may be useful, perhaps ?

https://support.presonus.com/hc/en-...ionality-not-working-in-Studio-One-on-Windows


----------



## EvilDragon (Nov 26, 2018)

Ooh, good find - that might be it!


----------



## Mike Greene (Nov 26, 2018)

geronimo said:


> This link may be useful, perhaps ?
> 
> https://support.presonus.com/hc/en-...ionality-not-working-in-Studio-One-on-Windows


Whoa! Thank you for that! This is very interesting. My guy having the problems says the Drag & Drop MIDI files do work with NI Studio Drummer, so other Kontakt libraries are apparently okay, but I suspect this will still solve the problem anyway.

One additional piece of info - after seeing my thread here, a Studio One user sent me a PM showing the Fingerpick MIDI files working fine on his system. So it must be something specific with the guy who's having the problem. The admin trick could be it. I hope.


----------



## Mike Greene (Nov 26, 2018)

EvilDragon said:


> Perhaps you should try using mf_reset() instead of mf_remove_event($ALL_EVENTS), though. Not sure if it'd help, but that's the preferred way of resetting the MIDI object.
> 
> You don't need to use mf_get commands when creating a MIDI file, though. You already set the position of an event in the second argument of mf_insert_event().


Thanks Mario! I'm always a bit behind on "preferred methods." 

I didn't realize that mf_get_next is unnecessary and all that's needed is the ticks (in the second argument.) Does this mean I could enter the events out of order? In other words, could I do this:

```
mf_insert_event(0, 0, $MIDI_COMMAND_NOTE_ON, 60, 127)
mf_set_event_par(mf_get_id(),$EVENT_PAR_NOTE_LENGTH,240)

mf_insert_event(0, 960, $MIDI_COMMAND_NOTE_ON, 67, 127)
mf_set_event_par(mf_get_id(),$EVENT_PAR_NOTE_LENGTH,240)

mf_insert_event(0, 480, $MIDI_COMMAND_NOTE_ON, 64, 127)
mf_set_event_par(mf_get_id(),$EVENT_PAR_NOTE_LENGTH,240)
```

So then the notes would get played in this order: 60, 64, 67. That doesn't confuse KSP that that's not the order I _created_ the MIDI events?


----------



## EvilDragon (Nov 26, 2018)

Yes you can enter events completely out of order.

MIDI object in Kontakt is basically just a bunch of inactive events. When you do mf_insert_event, you give them purpose - track, position, event type, byte 1, byte 2.


----------



## Lukas (Nov 27, 2018)

Is he running a current KONTAKT 5 version? I had a similar problem with MIDI drag'n'drop with previous versions of K5 and Studio One. Dragging sometimes just didn't work, resulted in empty MIDI events or S1 did not respond to dragging. But this was fixed with an K5 update, I think this was around KONTAKT 5.5 or 5.6.


----------



## P.N. (Nov 27, 2018)

Unrelated, but, when exporting midi files in a DAW, is it normal that the exported files don't retain the correct scripted names? Or is it something that depends on the DAW?

My exported midi files have the correct filename in standalone, but not in the DAW.


----------

