Go Back   Cockos Incorporated Forums > REAPER Forums > REAPER Pre-Release Discussion

Reply
 
Thread Tools Display Modes
Old 04-04-2016, 09:33 AM   #1
pcartwright
Human being with feelings
 
Join Date: Jan 2009
Posts: 1,030
Default Script and JSFX to Interpret Notation Text

Hey all.

This is my first attempt at a script and the first time I've shared a JSFX, so please feel free to provide constructive feedback on both.

I'm puttin ghtis in the pre-release thread for two reasons:
1. Notation is still pre-release at the time of this post
2. This script and JSFX should be considered pre-release. I intend to make a lot of changes over the next few weeks/months as time allows

The idea is to convert Reaper's notation text (which includes articulations, ornaments, and noteheads) to some usable MIDI rule. You can get the script and the JSFX at the stash link below. I've included the README blow the link.

Feedback is welcome.

https://stash.reaper.fm/v/27173/Notation%20to%20MIDI.zip

Code:
Notation to MIDI Version 0.1

This script and its corresponding JSFX effect are designed to interpret REAPER notation text events and trigger user defined MIDI signals.

The design isn't a simple as I would like, but it is fairly robust in terms of what can be done with it.

***************
INSTALLATION
***************
Notation to MIDI.jsfx should be copoied to your JSFX folder.
Notation to MIDI CC.lua should be copied to your scripot folder.
The notation_midi folder should be moved to the Data folder in your REAPER directory.
	Note: Do not change the name of this folder.

***************
SETUP
***************
Users should add the Notation to MIDI JSFX to each track where text to MIDI functionality is wanted.  
	NOTE: Do not change the JSFX name.  The script will not function if the name is manually adjusted.

The user should then pick the MIDI CC map and MIDI playback map of their choice from the drop downs.

***************
HOW IT WORKS
***************

The Notation to MIDI CC lua script will read the MIDI CC map file chosen from the Notation to MIDI JSFX.

The script will first clear out any existing CC used in the MIDI CC map.

The script will then read in each text event, check against the MIDI CC map file, and add the relevent CC command from the map file.

Upon playback, the Notation to MIDI JSFX will read in the MIDI CC values in REAPER and trigger playback MIDI as defined in the MIDI playback map.

***************
MIDI CC Map File
***************

The MIDI CC map file has the following columns:

ID - This is a unique numeric ID per line (range from 1 - 999).  It will be referenced by the playbck map.
	Note: Do not use an ID value of 0.

Type	- This details the type of text.
		text = 0
		articulation = 1
		ornament = 2
		dynamic = 3
		glyph = 4

ccNum	- This is where you define which CC lane is impacted by the rule.
	  It is best to pick a CC lane that does not impact your sound library.
	  Also note that these values will be cleared and written over each time you call the script

ccVal	- This is the value added to the ccNum

Time	- This doesn't do anything at the moment.  Eventually, I want to add ability to add the CC after the note on event.

Active	- Value of 1 is active, value of 0 is inactive.

Text	- The text value that will trigger the rule

EXAMPLES
ID	Type	ccNum	ccVal	Time	Active	Text
-	-	-	-	-	-	-
123	0	3	127	0	0	Foo
234	1	3	63	0	1	tenuto
345	0	3	0	0	1	Bar
456	0	15	100	0	1	Bar
567	1	003	0	1	1	none

ID 123 won't do anything because it is not active.
ID 234 will be called whenever a tenute articulation is written. It will create a CC event value of 63 in CC lane 3.
ID 345	will be called whenever the text "Bar" is in the notation editor.  It will create a CC event value of 0 in CC lane 3.
ID 456 will be called whenever the text "Bar" is in the notation editor.  It will create a CC event value of 100 in CC lane 15.
ID 567 will be called whenever there is no articulation present.  You should have 

Please notice that a text event of "Bar" will write multiple CC events.  You can do the same thing with your rules.
	For example, a text value of "Normale" might reset multiple CC lanes to 0.
Also, ID 567 is a special case.
	Text values of "none" with articulations, ornaments, and glyphs will trigger a value if a note does not have an articulation, ornament, or glyph.
	Users should write one of these rules if they write CC events based on articulation, note shape, and/or ornament.
Finally, users should write to the same CC lane when multiple events should not overlap.
	For example, a string player would not play the same note arco (with bow) and pizzicato (plucked) at the same time.
	Therefore, it would be best to write an Arco rule using the same CC lane (ccNum) as the pizzicato rule.
On the other hand, users can use multiple lanes if techniques can overlap.

Technical requirements:
	File must be tab delimeted text file
	You should have no extra rows at the end of your file (i.e. no blank lines)
	Each column must be populated with a value
	You will notice in the template that the second row contains dashes '-'.  You need to leave that row as-is.

***************
Playback Map File
***************

The MIDI CC map file has the following columns:
Type	- This defines the type of playback
		0 = channel change
		1 = keyswitch
		2 = CC map
		3 = note map

Arg1 - Arg6 - These are values that are used depending on the type of playback
	For channel change, user would need to add:
		Arg1 = Channel number (1 - 16)
		Arg2 = 0
		Arg3 = 0
		Arg4 = 0
		Arg5 = 0
		Arg6 = 0

	For keyswitch, user would need to add:
		Arg1 = MIDI note number (i.e. 60 for middle C)
		Arg2 = Note on velocity
		Arg3 = Note off velocity
		Arg4 = For now, set this to 0.  Eventually, I want to add a latch mode, but it's not ready yet.
		Arg5 = 0
		Arg6 = 0

	For CC map, user would need to add:
		Arg1 = CC lane number
		Arg2 = CC event value
		Arg3 = 0
		Arg4 = 0
		Arg5 = 0
		Arg6 = 0

	For note map, user would need to add:
		Arg1 = MIDI note number (i.e. 60 for middle C)
		Arg2 = 0
		Arg3 = 0
		Arg4 = 0
		Arg5 = 0
		Arg6 = 0
		The use of note map is primarily designed for percussion.  
		For example, a user might have a snare drum library where MIDI note 60 is a hit with snares on and MIDI note 59 with snares off.
		A user could use the note map to convert text of "Snares on" to MIDI note 60 and "Snares off" to MIDI note 59.
		Also note, this only changes the note on/off information of incoming MIDI.  It only maps notes in the piano roll or score view.

Cond1 - Cond6 - These should align with the CC Map IDs.  
		In short, the playback map will look to see if the CC values for the given ID were triggered.  If yes, then the playback rule is triggered.
		Use values of 0 for any empty conditions.

Act	- Doesn't do anything right now.  User should put in value of 1.  This will eventually indicate if the playback rule should be active or not.

Technical requirements:
	File must be tab delimeted text file
	You should have no extra rows at the end of your file (i.e. no blank lines)
	Each column must be populated with a value
	You will notice in the template that the second row contains dashes '-'.  You need to leave that row as-is.

EXAMPLES (uses CC Map above)

Type	Arg1	Arg2	Arg3	Arg4	Arg5	Arg6	Cond1	Cond2	Cond3	Cond4	Cond5	Cond6	Act
-	-	-	-	-	-	-	-	-	-	-	-	-	-
0	2	0	0	0	0	0	234	0	0	0	0	0	1
0	1	0	0	0	0	0	567	0	0	0	0	0	1
1	12	127	10	0	0	0	567	0	0	0	0	0	1
3	60	0	0	0	0	0	345	567	0	0	0	0	1	

The first line will send all MIDI data to channel 2 when a tenuto is triggered (see CC Map example).
The second line will send all MIDI data to channel 1 when there is no articulation present.
The third line will send a keyswitch to MIDI note 12 with a velocity of 127 and immediately send a note off with velocity of 100 when no articulation is present.
The last line will map any note on/off messages to MIDI note 60 when a text value of "Bar" is given AND when there is no articulation.

***************
To Do List
***************

Implement active state for playback map.
Support MIDI Bus changes.
Support mouse button naviagation in JSFX.


***************
Q&A
***************

Why do you write to CC events and then map CC events to keywstiches, channel changes, etc.?
Why not simply write channel changes, keyswitches, etc., using the script?   

	REAPER chases MIDI CC by default.  Therefore, the user can start anywhere in the project and the relevent command will be triggered.

Why do you have 6 argument variables when the most used is 4?
	
	I'm leaving 6 arguments to help future-proof the design.  There may come a time where extra variables are needed.
I will create a separate thread once my script and JSFX are a little more mature AND when notation is added to an official REAPER release.
pcartwright is offline   Reply With Quote
Old 04-04-2016, 09:34 AM   #2
reddiesel41264
Human being with feelings
 
reddiesel41264's Avatar
 
Join Date: Jan 2012
Location: North East UK
Posts: 493
Default

While this is a great idea I'm not sure you should put too much effort into it just yet as I think this is something that is going to be included in the notation editor - not the first release but a later release.
__________________
http://librewave.com - Freedom respecting instruments and effects
http://xtant-audio.com/ - Purveyor of fine sample libraries (and Kontakt scripting tutorials)
reddiesel41264 is offline   Reply With Quote
Old 04-04-2016, 09:35 AM   #3
pcartwright
Human being with feelings
 
Join Date: Jan 2009
Posts: 1,030
Default

I should note that the script runs for whatever MIDI item is opened in the MIDI editor. I personally call the script from a button in the editor window.
pcartwright is offline   Reply With Quote
Old 04-04-2016, 09:37 AM   #4
pcartwright
Human being with feelings
 
Join Date: Jan 2009
Posts: 1,030
Default

Quote:
Originally Posted by reddiesel41264 View Post
While this is a great idea I'm not sure you should put too much effort into it just yet as I think this is something that is going to be included in the notation editor - not the first release but a later release.
I know, but I think of this as a learning experience and a way to customize to my workflow.

There is no guarantee that Reaper's default solution will fit my workflow (plus I don't want to have to wait), so here it goes. There's more than one way to skin a cat, right?
pcartwright is offline   Reply With Quote
Old 09-26-2016, 04:34 PM   #5
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,874
Default

Oh so there was already an attempt on that ! ^^

Ok I also tried something (reddiesel41264 exposed me the problem => the need to convert REAPER notation articulations and dynamics to more practical MIDI data), and I thought about a full JSFX solution for flexibility.

Here was my attempt with dynamics:



Unfortunately, I cannot work too much on this cause I struggle a lot with JSFX. :/

I already geta lot of helps for this
JSFX: Filter and Decode Text Events - Cockos Confederated Forums

And every bit of progress seems to take forever ^^

So, if you use the Notation Editor more than me (and so could take more advantage of this), and if this person is more experienced with JSFX, I invite you to participate to the script dev.

I will put in on ReaTeam repo soon.
Let me know if you are interested by this.
X-Raym is offline   Reply With Quote
Old 09-17-2017, 02:09 AM   #6
mduque
Human being with feelings
 
Join Date: Sep 2015
Posts: 63
Default Sure

It,s been more than one year since this post. I do not want to wait either. I am going to try Phillip solution. It seems robust and fits completely to my 90% requirements.

Thank you very much for share. will try to post my comments.
mduque is offline   Reply With Quote
Old 09-17-2017, 06:17 PM   #7
pcartwright
Human being with feelings
 
Join Date: Jan 2009
Posts: 1,030
Default

I'll warn you that I haven't made any adjustments to this script in quite a while. It's very possible that some of the Reaper notation data under the hood has changed since I shared this script and JSFX.

Let me know if you run into any issues, but I won't know how much I'll be able to fix at the moment.
pcartwright is offline   Reply With Quote
Old 09-18-2017, 02:26 AM   #8
mduque
Human being with feelings
 
Join Date: Sep 2015
Posts: 63
Default

Quote:
Originally Posted by pcartwright View Post
I'll warn you that I haven't made any adjustments to this script in quite a while. It's very possible that some of the Reaper notation data under the hood has changed since I shared this script and JSFX.

Let me know if you run into any issues, but I won't know how much I'll be able to fix at the moment.
Exactly. In version 5.4 it does not work anymore

I am trying to use this with Wivi Band but it seems not to make any effect.

123 3 2 98 0 1 fff

124 3 2 110 0 1 ffff

125 0 2 24 0 1 ppp

99 0 2 16 0 1 pppp

345 0 2 6 0 1 suv

and

2 2 4 0 0 0 0 99 0 0 0 0 0 1

I just need the CC2 breath controller value changed but it seems not to trigger. Any comments? I first put the Notation to Midi in the FX chain and after Wivi Band
mduque is offline   Reply With Quote
Old 09-18-2017, 02:45 AM   #9
reddiesel41264
Human being with feelings
 
reddiesel41264's Avatar
 
Join Date: Jan 2012
Location: North East UK
Posts: 493
Default

Quote:
Originally Posted by mduque View Post
Exactly. In version 5.4 it does not work anymore

I am trying to use this with Wivi Band but it seems not to make any effect.

123 3 2 98 0 1 fff

124 3 2 110 0 1 ffff

125 0 2 24 0 1 ppp

99 0 2 16 0 1 pppp

345 0 2 6 0 1 suv

and

2 2 4 0 0 0 0 99 0 0 0 0 0 1

I just need the CC2 breath controller value changed but it seems not to trigger. Any comments? I first put the Notation to Midi in the FX chain and after Wivi Band
I replied to your post in the other thread. I've made a load of scripts for playback that should do what you need.
__________________
http://librewave.com - Freedom respecting instruments and effects
http://xtant-audio.com/ - Purveyor of fine sample libraries (and Kontakt scripting tutorials)
reddiesel41264 is offline   Reply With Quote
Old 09-18-2017, 08:46 AM   #10
mduque
Human being with feelings
 
Join Date: Sep 2015
Posts: 63
Default David Script Working

Hi David. Thanks a lot!!!!!

I have downloaded your scripts and it seems to be exactly what I need. I am studding notation and I really need to produce the basics of the music while writing in the score editor. I do believe that this is only the basics as the details must be implemented with midi in the main midi editor. Think that for one instrument you can be dealing with up to 5 different CCs (legato velocity, expression, vibrato, harmonics, air, flutter ...

For the articulations / expression maps I already bought "Inspector with articulation management" script in https://forum.cockos.com/showthread.php?t=183669 . I think it follows a similar approach with Continuous Controllers and you can see in the piano roll which articulation you have loaded based in a .reabank file. I think the same could be done for your solution so you can also read which articulations are loaded in the time line with the help of a .reabank file.

For Expressions - Dynamics using your solution I have created a pallete of buttons creating custom actions each one combining Dynamics CC1 Scripts + Notation (add pp, or mf, or ffff). So in one click I add the dynamic marking and the CC1 value.

Very lovely the Overlap Notes Script. So I can make my legatos properly.
Very interesting the Insert Ramp between selected CCs. That way I can make interesting hairpins or crescendo decrescendos ...

Do you have any donation option?

I think that for now I can avoid to migrate from Reaper to Cubase or Dorico. For now I have everything in Reaper. In the future I can create custom actions for example to combine custom text with the available slots values in the CC32 so I can call my own articulations for the libraries I use. For example 8Dio's.

Best regards,
Manu
mduque is offline   Reply With Quote
Old 09-19-2017, 06:51 PM   #11
pcartwright
Human being with feelings
 
Join Date: Jan 2009
Posts: 1,030
Default

I may revisit this if there are a few folks interested.

Are there features other than what I've documented that would make this script and JSFX more useful? (other than actually making it work)
pcartwright is offline   Reply With Quote
Old 03-15-2018, 07:07 AM   #12
Oberheim
Human being with feelings
 
Join Date: Mar 2015
Posts: 43
Default

I am interested.

It would be very useful if you create GUI for this script, like your Articulation to Note Lenght. Maybe for beginning it can be divided in to seperated scripts, like Articulation to keyswitch, ... to midi cc, ... to midi channel, dynamics to midi, etc.., Reaper FX is modular and each articulation to ... can be added on top of each other to build full articulation map.

And
I don't understand what your script read from notation. It must be text only in notation editor, or it read all notation data like dynamics, articulations etc..?

And I don't understand when I setting up playback map for MIDI CC. both on playback and midi map I set up Midi Lane and Midi Value. Now which will be used, from midi map or playback?
Oberheim is offline   Reply With Quote
Old 03-24-2018, 07:59 AM   #13
pcartwright
Human being with feelings
 
Join Date: Jan 2009
Posts: 1,030
Default

Quote:
Originally Posted by Oberheim View Post
I am interested.

It would be very useful if you create GUI for this script, like your Articulation to Note Lenght. Maybe for beginning it can be divided in to seperated scripts, like Articulation to keyswitch, ... to midi cc, ... to midi channel, dynamics to midi, etc.., Reaper FX is modular and each articulation to ... can be added on top of each other to build full articulation map.
Maybe. Let me think on this. I believe an articulation mapper is coming at some point, though I don't know when. I'm not sure I want to commit time to this if the articulation mapper will do the same thing (and almost certainly do it better).

Quote:
And
I don't understand what your script read from notation. It must be text only in notation editor, or it read all notation data like dynamics, articulations etc..?

And I don't understand when I setting up playback map for MIDI CC. both on playback and midi map I set up Midi Lane and Midi Value. Now which will be used, from midi map or playback?
Notation is saved as MIDI information. There is a thread about Notation API where some of the details are given I believe.
pcartwright is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 01:39 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.