cursor_id > note number

Home Forums Scripts cursor_id > note number

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #3038 Reply
    TheVille
    Guest

    I have scripted a scene with only one trigger, but many cursors running through it on their respective paths. I want the trigger to transmit a MIDI note number (I have to use midi instead of OSC because Reaktor won’t accept osc when run as a plugin) based on cursor running through it. For some reason, the note number is mapped between 0-1 and not 0-127. This is where i’m stuck:

    run("add trigger 1020");
    run("setpos current 0 0 0");
    run("setmessage current 1, midi://midi_out/notef 1 "+ (cursor_id/127));

    You can see i’ve tried to map note number to 0-1 range by dividing it by 127. This doesn’t work though. Strangely I get output with note number 63: midi://from_iannix/notef 1 63 (Eb4) 12 1 (1 s.).

    I’ve also tried plain and simple run("setmessage current 1, midi://midi_out/notef 1 cursor_id"); but it gives me always note number 127 since my cursor id’s go from 1-24.

    I don’t get it. How do I perform calculations with cursor_id?

    #3039 Reply
    IanniX
    Keymaster

    Hi!

    Great job for now ; just a little mistake in the setmessage. You can use “+” operator to concatenate, but it will only work when the script is computed (at loading). To perform it in real time, you may use the {} (braces with javascript inside) :
    run("setmessage current 1, midi://midi_out/notef 1 {cursor_id/127}");

    Be aware that you’re using /notef in floating format (‘f’ => needs values between 0. and 1.). You can also use the /note that uses integers (between 0 and 127). So it could look like:
    run("setmessage current 1, midi://midi_out/note 1 cursor_id");

    Hope it is clear!

    #3046 Reply
    TheVille
    Guest

    Thanks for the prompt reply! That was it. Now it works just like I wanted, thank you!

Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: Reply #3046 in cursor_id > note number
Your information:





© IanniX Association

What is IanniX? | Download | Showcase | Forums | Research | About