# Sending note off from script to the outside world



## nordicguy (Jan 18, 2007)

Hi,
I want to use kontakt's script to send midi datas to a module connected to my midi interface.
It works, except for midi note off.
The notes won't stop.
Even with a pretty simple script i never succeded to generate any note off.
I would really apreciate any tips about this.
Thanks a lot,
Jean


----------



## Big Bob (Jan 19, 2007)

nordicguy @ Thu Jan 18 said:


> Hi,
> I want to use kontakt's script to send midi datas to a module connected to my midi interface.
> It works, except for midi note off.
> The notes won't stop.
> ...



The last time I tried to use the MIDI out from K2, which was several versions back, I couldn't get it to work at all. So, if you are now getting MIDI out stuff, NI must have at least partially addressed the problem with this. When I get some time I'll try running some tests and if your mystery still persists, maybe I'll be able to shed some light on it.

In the meantime, I can tell you that there are a number of problems with the note_off function but these mostly center on whether or not an RCB is triggered. But, just out of curiosity, how are you generating these note_offs?

Bob


----------



## nordicguy (Jan 19, 2007)

Hi Bob,
Thanks for the feedback.
Here's what i wrote expecting to generate a simple note off.

on release
note_off(60)
end on

Nothing happened

May be i'm missing something pretty basic i should know.

À+,

Jean


----------



## Thonex (Jan 19, 2007)

Did you make sure you selected "Send midi to outside world" in the instruments options?

Cheers,

T


----------



## Big Bob (Jan 19, 2007)

nordicguy @ Fri Jan 19 said:


> Hi Bob,
> Thanks for the feedback.
> Here's what i wrote expecting to generate a simple note off.
> 
> ...



note_off doesn't take a note argument (I assume that by 60 you expect to turn of middle C?). note_off requires that you use the note id. Furthermore, what are you doing to trigger the RCB (release callback)?

Bob


----------



## nordicguy (Jan 19, 2007)

> note_off doesn't take a note argument (I assume that by 60 you expect to turn of middle C?). note_off requires that you use the note id. Furthermore, what are you doing to trigger the RCB (release callback)?
> 
> Bob



Hi T,
Yes i checked the option "send midi in outside world".

Hi Bob,
To trigger theRCB i just release a key.
In one RCB i replaced the note off message by a note on and it worked perfectly.
When releasing a key, the note played.

The probleme is that i never succeded in sending any note off message in the outside world.
So the script i'm using to trigger kontakt's sounds work very well.
When i try to send this script to an external module, the module play it right except that the notes never stop.
So i used my other computer to monitor what the script generate exactly.
I tried the script i posted here and, no note off message.

Here's the script i thought would work to play my external module including note off messages.

on note 
play_note($EVENT_NOTE,$EVENT_VELOCITY,0,-1)
end on
on release
note_off($EVENT_NOTE)
end on

The module play the notes but notes never stop.

I'm sorry to take all that room for a note off issue.

Thanks

À+

Jean


----------



## mbncp (Jan 20, 2007)

note_off requires an event ID, not a pitch.
Anyway, doesn't work any better.
The only way I found so far is to send this on release, the problem is that it sends 2 note off, but shouldn't be too much a problem with most synth.

on release 
play_note($EVENT_NOTE,-1,0,-1)
end on


----------



## Nickie Fønshauge (Jan 20, 2007)

Tryt this one instead:

*on init*
``*declare* $note_id
*end on*
*on note* 
``$note_id := play_note($EVENT_NOTE,$EVENT_VELOCITY,0,-1) 
*end on* 
*on release* 
``note_off($note_id) 
*end on*


If it works (and it should, if K2 can send note off's from the RCB), it will only work for monophonic playing. If you need polyphony, you will have to implement $note_id as a stack or queue.


----------

