|
|
|
02-12-2016, 08:05 PM
|
#1
|
Human being with feelings
Join Date: Jan 2009
Posts: 1,030
|
Notation API
A thread to discuss API for Reaper's notation viewer/editor.
To start with, I'm curious how to read notation event via MIDI events.
|
|
|
02-12-2016, 08:14 PM
|
#2
|
Administrator
Join Date: Mar 2007
Location: NY
Posts: 15,750
|
From JSFX you should be able to read the notation data using midirecv_str. REAPER-specific notation data will have the first two bytes 0xFF, 0xF. (This is outside the official MIDI spec but still in-band for MIDI text meta-events.)
From other API clients, MIDI_GetTextSysexEvt should work.
Note that very little of the interoperability has been tested, and the notation spec will very likely change over the short term!
|
|
|
02-12-2016, 08:55 PM
|
#3
|
Human being with feelings
Join Date: Jan 2009
Posts: 1,030
|
Got it. So don't write scripts or JSFX relying on notation event syntax for the time being. I suppose the MIDI event syntax will eventually be added to the JSFX and scripting API documentation?
|
|
|
02-13-2016, 08:16 AM
|
#4
|
Human being with feelings
Join Date: Aug 2011
Location: Los Angeles, CA
Posts: 308
|
Seems like the notation editor shares the same multitrack editing paradigm with the piano roll editor. So that would mean I can't create a script that processes notes on all the tracks, because MIDIEditor_GetTake only returns one take.
So I'm going to have to submit my #1 API feature request on the notation side as well: a "get all editable items" function, please!
|
|
|
02-13-2016, 10:56 AM
|
#5
|
Human being with feelings
Join Date: Apr 2014
Posts: 943
|
Schwa: From JSFX you should be able to read the notation data using midirecv_str. REAPER-specific notation data will have the first two bytes 0xFF, 0xF. (This is outside the official MIDI spec but still in-band for MIDI text meta-events.)"
Just a question, Schwa but why do not you use simply
Proprietary Event/Sequencer-Specific Meta-event ?
FF 7F <len> <Your Cockos id> <data>
That´s the meta spec for such special events, like for Notation etc. pp
instead of
the maybe with future MIDI-HD spec conflicted "outside the official MIDI spec
or better at the moment not existing 0xFF 0xF <len> <data> and these other non existing 0xA-0xE ...
I personally have no problem with it but it is outside existing meta command ids
and can maybe conflict with future things as long as it not in spec or Cockos make Spec together with the rest or the rest of the world just follow Cockos
Particularly if it is also exported to SMF.
__________________
I hope you can understand me? Without german beer my written english is always very bad, with beer it becomes unbearable!.
Less is more! To much limited the own creativity.
|
|
|
02-13-2016, 11:06 AM
|
#6
|
Administrator
Join Date: Mar 2007
Location: NY
Posts: 15,750
|
Quote:
Originally Posted by ELP
why do not you use simply
Proprietary Event/Sequencer-Specific Meta-event ?
FF 7F <len> <Your Cockos id> <data>
|
The only reason is that FF 0F, though not a specified text event type, is still a text event, as opposed to FF 7F, which is assumed to be binary data. So FF 0F displays in the piano roll text event lane, is more likely to be preserved at least as readable information if imported into another program, etc. Admittedly it's not a strong reason.
|
|
|
02-13-2016, 11:20 AM
|
#7
|
Human being with feelings
Join Date: Apr 2014
Posts: 943
|
yes ok the <data> within 0xFF 0x7F is declared as 8bit binary instead of ASCII
Ok maybe one argument. for unknown 0xFF 0x0F (0xA-0xE)
__________________
I hope you can understand me? Without german beer my written english is always very bad, with beer it becomes unbearable!.
Less is more! To much limited the own creativity.
Last edited by ELP; 02-13-2016 at 12:06 PM.
|
|
|
02-13-2016, 02:38 PM
|
#8
|
Human being with feelings
Join Date: Jan 2012
Location: North East UK
Posts: 493
|
This API seems like a great idea. So we'll be able to create something that works like Sibelius sound sets or Cubase expression maps :-)
|
|
|
02-14-2016, 06:00 AM
|
#9
|
Banned
Join Date: Sep 2015
Posts: 1,650
|
I suppose this is the best place for this sort of request as it pertains to the notation editor. That the window behaviour is improved for ReaScript, specifically always on top of the MIDI editor. Ideally AoT and/or docked in a split position pane below the Track View.
While I'm complaining about windowing, a full screen option for the MIDI editor would be superb!
I know it's not directly related to scripting, but it's about user-friendliness for future scripts.
|
|
|
02-15-2016, 05:09 AM
|
#10
|
Banned
Join Date: Sep 2015
Posts: 1,650
|
I've updated my master MIDI script to cater for notation events.
For info for JS explorers without access to the console, the messages are in this format (at the moment obviously)...
Code:
#!_P
#!_Crescendo
#!_M
edit: ha ha, which is in the event list anyway, but I was excited I struck gold with the API.
Last edited by snooks; 02-15-2016 at 05:28 AM.
|
|
|
02-17-2016, 08:17 AM
|
#11
|
Human being with feelings
Join Date: Jan 2012
Location: North East UK
Posts: 493
|
When playing back are articulations triggered before the notes which they are tied to? I'm thinking of making a script that can trigger key switches based on articulations and obviously the key switch needs to be triggered just before the note(s) to which is applies.
|
|
|
02-17-2016, 08:29 AM
|
#12
|
Administrator
Join Date: Mar 2007
Location: NY
Posts: 15,750
|
Quote:
Originally Posted by reddiesel41264
When playing back are articulations triggered before the notes which they are tied to? I'm thinking of making a script that can trigger key switches based on articulations and obviously the key switch needs to be triggered just before the note(s) to which is applies.
|
Yes, notation events should always be sent prior to musical events at the same time position.
|
|
|
02-17-2016, 08:35 AM
|
#13
|
Human being with feelings
Join Date: Jan 2012
Location: North East UK
Posts: 493
|
Quote:
Originally Posted by schwa
Yes, notation events should always be sent prior to musical events at the same time position.
|
Cool, thanks for confirming!
|
|
|
02-17-2016, 11:40 AM
|
#14
|
Banned
Join Date: Sep 2015
Posts: 1,650
|
Should this follow Quantize Display settings? ie if a note is QDed forward on to a beat and an articulation is written on that beat, the artic should be sent at the earliest position of a note that has been QDed to that position.
|
|
|
02-17-2016, 01:00 PM
|
#15
|
Human being with feelings
Join Date: Jan 2012
Location: North East UK
Posts: 493
|
I've been thinking more about the playback and I know we're in the very early (although very sophisticated) days of notation in Reaper but before I start writing a script for playing back score markings I wanted to check if this was something you were planning to include anyway? - in which case I will just wait patiently for that
Otherwise - I'm wondering how people think this would be best approached. My first thoughts were a JSFX on each track that you can customise for each of your VIs. You'd select an articulation and the corresponding key switch and the effect will do the translation from one to the other. I think the limitation with this is the number of UI controls we can have in JSFX though.
A solution I think would be better is to use XML files - can we read XML in lua? Then each track could have a lua plugin that translated the score marking based on the data in the XML. This would allow us to set up lots of key switch and controller definitions. and I could build an external XML editor to speed up creating VI definition files - which would be fun
|
|
|
02-17-2016, 06:13 PM
|
#16
|
Banned
Join Date: Sep 2015
Posts: 1,650
|
Personally I think making use of named notes for artics makes sense.
Using named notes could give a per-track palette of artics to choose from in the notation editor using data that's already has a sensible place to live with no chance of spelling mistooks. Not showing named notes also solves the other issue of hiding keyswitches.
If the corresponding note (on) for the named note name inserted as an artic in the NE was played when encountered then the problem is solved with minimum fuss. Of course the sending MIDI bit could be done with a plugin, even if just the palette of artics available in the NE was taken from named notes. Ideally though, inserting from a palette of named notes would actually insert a real named note and those could be optionally chased in all MEs (on play and edit).
That way artics can be fully compatible with the PRV, since inserting a named note in the PRV would mean an artic pops up in the NE.
Mapping from notes to CCs/channels or whatever could then be done from a plugin for instruments (or players) that don't do keyswitches. And managing and setting named notes could be a job for a Lua script.
-------------------
Anyhoo, here's a tiny test script that might save somebody a few seconds...
Code:
desc:Notation
@block
while (midirecv_str(offset,#str)) (
str_getchar(#str,0)==$xFF && str_getchar(#str,1)==$x0F ? (
//we have a notation event
match("*_F",#str) ? (
midisend(offset, $xB0, 64+(127<<8)); //send sustain ch 1 127
);
match("*_P",#str) ? (
midisend(offset, $xB0, 64); //send sustain ch 1 0
);
);
midisend_str(offset,#str); //send everything on
);
... which also brings up the issue that some chasing might be nice for notations plugins use anyway.
|
|
|
02-18-2016, 05:09 AM
|
#17
|
Human being with feelings
Join Date: Jan 2012
Location: North East UK
Posts: 493
|
Quote:
Originally Posted by snooks
Personally I think making use of named notes for artics makes sense.
Using named notes could give a per-track palette of artics to choose from in the notation editor using data that's already has a sensible place to live with no chance of spelling mistooks. Not showing named notes also solves the other issue of hiding keyswitches.
If the corresponding note (on) for the named note name inserted as an artic in the NE was played when encountered then the problem is solved with minimum fuss. Of course the sending MIDI bit could be done with a plugin, even if just the palette of artics available in the NE was taken from named notes. Ideally though, inserting from a palette of named notes would actually insert a real named note and those could be optionally chased in all MEs (on play and edit).
That way artics can be fully compatible with the PRV, since inserting a named note in the PRV would mean an artic pops up in the NE.
Mapping from notes to CCs/channels or whatever could then be done from a plugin for instruments (or players) that don't do keyswitches. And managing and setting named notes could be a job for a Lua script.
-------------------
Anyhoo, here's a tiny test script that might save somebody a few seconds...
Code:
desc:Notation
@block
while (midirecv_str(offset,#str)) (
str_getchar(#str,0)==$xFF && str_getchar(#str,1)==$x0F ? (
//we have a notation event
match("*_F",#str) ? (
midisend(offset, $xB0, 64+(127<<8)); //send sustain ch 1 127
);
match("*_P",#str) ? (
midisend(offset, $xB0, 64); //send sustain ch 1 0
);
);
midisend_str(offset,#str); //send everything on
);
... which also brings up the issue that some chasing might be nice for notations plugins use anyway.
|
Yes chasing would be very helpful
|
|
|
02-18-2016, 01:46 PM
|
#18
|
Human being with feelings
Join Date: Apr 2012
Location: Christchurch, New Zealand
Posts: 482
|
An interesting discussion!
The way I do this currently is via a modular chain of JSFX plugins:
1. Read incoming notation text events and output CC32 (UACC) values based on their contents.
2. Convert CC32 to keyswitches or whatever-else-you-need via another plugin for non-UACC instruments.
I agree that a quick chase of all notation text events up to the play cursor would be fantastic, then it would work seamlessly at all times.
Ooh, and a per-channel filter for these text events would be nice too, even if it means inserting something like "1. " or "1.2.3.4. " or "1-5.8-12. " internally before the actual string.
|
|
|
02-18-2016, 01:56 PM
|
#19
|
Human being with feelings
Join Date: Jan 2009
Posts: 1,030
|
Would it make sense to have a script that translates text events into a CC value (since CC values already update to last entry) and have a corresponding JSFX that uses the CC to make keyswitch or channel changes?
|
|
|
02-18-2016, 02:19 PM
|
#20
|
Human being with feelings
Join Date: Apr 2012
Location: Christchurch, New Zealand
Posts: 482
|
Quote:
Originally Posted by pcartwright
Would it make sense to have a script that translates text events into a CC value (since CC values already update to last entry) and have a corresponding JSFX that uses the CC to make keyswitch or channel changes?
|
Ah yes, well that's exactly what I do. And also how UACC works under the hood, if anyone cares or has even heard of that.
The CCs still need to be generated externally from the notation text events though, because right now Reaper isn't automatically aware that its notation text events will become CCs later in life, and therefore won't know to chase them, if that makes sense.
|
|
|
04-04-2016, 09:55 AM
|
#21
|
Human being with feelings
Join Date: Jan 2009
Posts: 1,030
|
Quote:
Originally Posted by ijijn
Ah yes, well that's exactly what I do. And also how UACC works under the hood, if anyone cares or has even heard of that.
The CCs still need to be generated externally from the notation text events though, because right now Reaper isn't automatically aware that its notation text events will become CCs later in life, and therefore won't know to chase them, if that makes sense.
|
Check this out if you have a minute.
|
|
|
07-25-2016, 12:23 PM
|
#22
|
Human being with feelings
Join Date: Apr 2014
Posts: 943
|
Since a few weeks I rape the Notation Meta to comment SysEx Messages.
best - which is/should then only visible in list editors and the comment to the Messages
is within REAPER in a separate column , that´s important,
that was/is my bear goal ^^
Something I really miss... one simple comment column... but now I have it..
and it is working complete without any probs incl special REAPER comment meta export/import to SMF
very nice Schwa ^^
__________________
I hope you can understand me? Without german beer my written english is always very bad, with beer it becomes unbearable!.
Less is more! To much limited the own creativity.
Last edited by ELP; 07-25-2016 at 12:31 PM.
|
|
|
08-07-2016, 05:01 PM
|
#23
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
Is it possible for a script to access a note's hide/unhide state? (The hide/unhide state does not appear to be stored in the notation text events.)
|
|
|
08-08-2016, 12:52 PM
|
#24
|
Human being with feelings
Join Date: Apr 2014
Posts: 943
|
this should be renamed into Hide/Unhide Note No.
And yes this is a little bit in consequent ( one of some) because this hide/unhide state is saved into:
<MIDINOTENAMES
-1 48 fert 0 48
-1 60 <null> 0 -1
where the last statement within row the "Note No xx" from second statement or "Note No -1" means visible(NN) or not visible (-1)
and the state is not stored via REAPER Notation Meta
Note Pitch(No) 48 name fert is visible (48)
Note Pitch(No) 60 is hide -1
Maybe you can access this then via MIDINOTENAMES?- if it is possible for now----
__________________
I hope you can understand me? Without german beer my written english is always very bad, with beer it becomes unbearable!.
Less is more! To much limited the own creativity.
|
|
|
08-15-2016, 02:52 AM
|
#25
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
I am impressed that somebody knows such esoteric information!
A bit of Googling showed me that MIDINOTENAMES is a field within RPP files. Unfortunately, I don't think that the info in the RPP files will reliable and up to date, since a user can change the hide/unhide state of notes on the fly in the notation editor, without saving these states immediately to a file.
It seems to me that user scripts cannot yet access these hide/unhide states, so we are dependent on the devs to provide actions.
I would have liked to write a script to unhide specific note rows, since at present the only action for unhiding is the crude "Unhide all notes".
|
|
|
08-16-2016, 04:56 AM
|
#26
|
Human being with feelings
Join Date: Apr 2014
Posts: 943
|
yes of course it is one block info within an rpp, but that is not really what i mean with:
"Maybe you can access this then via MIDINOTENAMES?"
due the fact that these hide/unhide info is in these MIDINOTENAMES block and within the rpp
you can access it with
the api functions
.....
.....
*SetTrackMIDINoteNameEx
*GetTrackMIDINoteNameEx
....
....
which refers to MIDINOTENAMES
but of course this was just a little reflection of me and would make sense if the hide/unhide state is already saved within these MIDINOTENAMES Info---- if possible
__________________
I hope you can understand me? Without german beer my written english is always very bad, with beer it becomes unbearable!.
Less is more! To much limited the own creativity.
|
|
|
09-23-2016, 03:16 AM
|
#27
|
Human being with feelings
Join Date: Jan 2012
Location: North East UK
Posts: 493
|
A few notation API lua questions
Is it possible to add score markings like pedal markings, dynamics, etc. via lua? If so is it possible to add more than one articulation marking to a note at the same time, tenuto and staccato for example?
Using reaper.MIDI_GetTextSysexEvt I can access things like dynamics but is there a way to find out if a selected note has a slur or articulation mark? I can see these in the event list but they appear under the REAPER Notation column for the notes they are applied to.
|
|
|
09-23-2016, 04:08 AM
|
#28
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
Quote:
Originally Posted by reddiesel41264
Is it possible to add score markings like pedal markings, dynamics, etc. via lua? If so is it possible to add more than one articulation marking to a note at the same time, tenuto and staccato for example?
Using reaper.MIDI_GetTextSysexEvt I can access things like dynamics but is there a way to find out if a selected note has a slur or articulation mark? I can see these in the event list but they appear under the REAPER Notation column for the notes they are applied to.
|
It is indeed possible. My ReaPack scripts that start with "js_Notation" do this for beaming, staccato/staccatissimo and display length, so you can perhaps take a look at the code of those scripts. (Especially the "Set display length" ones.)
In another pre-release thread, Schwa mentioned something about the notation Text Event always being sorted and indexed just before the Note Start Event, so this titbit of information can probably also be included in the search algorithms.
|
|
|
09-23-2016, 04:36 AM
|
#29
|
Human being with feelings
Join Date: Jan 2012
Location: North East UK
Posts: 493
|
Quote:
Originally Posted by juliansader
It is indeed possible. My ReaPack scripts that start with "js_Notation" do this for beaming, staccato/staccatissimo and display length, so you can perhaps take a look at the code of those scripts. (Especially the "Set display length" ones.)
In another pre-release thread, Schwa mentioned something about the notation Text Event always being sorted and indexed just before the Note Start Event, so this titbit of information can probably also be included in the search algorithms.
|
Thank you, I shall check out your scripts
|
|
|
09-25-2016, 06:21 PM
|
#30
|
Human being with feelings
Join Date: Apr 2012
Location: Christchurch, New Zealand
Posts: 482
|
One caveat for this is when you have metadata involving multiple NOTE_ONs at exactly the same sample position. The METADATA events for all of these will go through the pipe just before the NOTE_ON events. I checked this again today to make sure and it's still the behaviour.
Here's an example:
METADATA 1
METADATA 2
then
NOTE_ON 1
NOTE_ON 2
(all at the same sample position, of course)
This can get somewhat confusing when some notes don't have metadata, such as:
METADATA 1
METADATA 4
NOTE_ON 1
NOTE_ON 2
NOTE_ON 3
NOTE_ON 4
so in such cases you need to match up the channel and pitch to make sure that each METADATA event is for the correct NOTE_ON.
Also, you still can't assign more than one articulation at a time via the notation editor, but of course you can (try to) stack your own via scripting. I'm not sure how useful or robust the results would be though. If you do try it, please let us know if it's particularly good, bad or ugly.
Good luck!
|
|
|
12-22-2016, 05:29 AM
|
#31
|
Human being with feelings
Join Date: Dec 2011
Posts: 406
|
Sry I'm a little bit impatient on this one and haven't studied much of the current API functions regarding notation but is there a way to get the quantisized notation values for e.g a lilypond parser script?
|
|
|
06-01-2017, 01:27 PM
|
#32
|
Human being with feelings
Join Date: Jan 2012
Location: North East UK
Posts: 493
|
Digging up an old thread but it seems like the appropriate place for my question - what should I put for bytestr in the reaper.MIDI_InsertTextSysexEvt function in order to insert a dynamic marking?
Thanks
Last edited by reddiesel41264; 06-01-2017 at 01:34 PM.
|
|
|
06-02-2017, 12:29 AM
|
#33
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
Quote:
Originally Posted by reddiesel41264
Digging up an old thread but it seems like the appropriate place for my question - what should I put for bytestr in the reaper.MIDI_InsertTextSysexEvt function in order to insert a dynamic marking?
Thanks
|
The API help is bit incomplete:
Quote:
Lua: boolean reaper.MIDI_InsertTextSysexEvt(MediaItem_Take take, boolean selected, boolean muted, number ppqpos, integer type, string bytestr)
Insert a new MIDI text or sysex event. Allowable types are -1:sysex (msg should not include bounding F0..F7), 1-7:MIDI text event types.
|
REAPER uses a non-standard "type" for its notation text events, namely 0x0F, which is not mentioned in the help.
To find the appropriate bytestr for a notation text event, insert the notation the usual way, and then View -> Raw MIDI data.
In the case of the dynamic marker fff, for example, the code would be:
Code:
reaper.MIDI_InsertTextSysexEvt(take, selected, muted, ppqpos, 0x0F, "TRAC dynamic fff")
|
|
|
06-02-2017, 03:11 AM
|
#34
|
Human being with feelings
Join Date: Jan 2012
Location: North East UK
Posts: 493
|
Quote:
Originally Posted by juliansader
The API help is bit incomplete:
REAPER uses a non-standard "type" for its notation text events, namely 0x0F, which is not mentioned in the help.
To find the appropriate bytestr for a notation text event, insert the notation the usual way, and then View -> Raw MIDI data.
In the case of the dynamic marker fff, for example, the code would be:
Code:
reaper.MIDI_InsertTextSysexEvt(take, selected, muted, ppqpos, 0x0F, "TRAC dynamic fff")
|
Aha! thank you, I didn't realise we had that option to view the raw data, very helpful
|
|
|
06-27-2017, 08:49 AM
|
#35
|
Human being with feelings
Join Date: Jan 2012
Location: North East UK
Posts: 493
|
Quote:
Originally Posted by juliansader
Is it possible for a script to access a note's hide/unhide state? (The hide/unhide state does not appear to be stored in the notation text events.)
|
Did you make any progress with this?
|
|
|
07-09-2017, 02:14 PM
|
#36
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
Quote:
Originally Posted by reddiesel41264
Did you make any progress with this?
|
Alas not (that I know of).
|
|
|
02-24-2018, 11:22 PM
|
#37
|
Human being with feelings
Join Date: Oct 2011
Location: Spain
Posts: 54
|
Notation events to UACC
Hi!
What do I need to now to be able to convert notation meta events to (UACC) midi cc 32 with my JSFX?
For example how to convert:
1: Text (27 bytes)
FF 0F NOTE 0 71 custom Spiccato
to CC32 value-42
or
1: Text (32 bytes)
FF 0F NOTE 0 71 articulation marcato
to CC32 value-09
?
I'm totally blank in scripting...
Any hints?
|
|
|
05-25-2018, 04:43 PM
|
#38
|
Human being with feelings
Join Date: Jan 2009
Posts: 1,030
|
Feature Request for Slide, Dynamics, and Other Multi Note Notation Items
@schwa
It would be very helpful if the notation information associated with the first note of a slide (or dynamic hairpin or any other technique that involves multiple notes over time) included the final note and time position impacted by the technique.
Why?
I would like to write a JSFX that auto increments dynamics and creates intelligent glissando/slides in real time. Unless I am missing something, I think I would need this information at the onset of the articulation to calculate certain things (like incremental CC changes or note on/off messages for a glissando) in the JSFX.
|
|
|
03-11-2019, 02:50 PM
|
#39
|
Human being with feelings
Join Date: Jul 2010
Location: Slovakia
Posts: 2,588
|
Hi, just checking if notation API got any closer to realisation. Thanks.
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 12:52 AM.
|