 |
|
|
02-08-2018, 03:36 PM
|
#1
|
Human being with feelings
Join Date: Apr 2017
Location: St. Petersburg, FL
Posts: 880
|
JSFX tutorial for the total Newbie - guide
So I wrote a MIDI Note to CC plugin recently, and I thought I'd write a guide to how it's done.
I cover everything from basic MIDI concepts, to JSFX basics, to programming basics etc... I assume that the only thing you know is what Reaper is, how to create a text file and how to type.
There's no ads or anything on my site. So this is totally free unless you feel obliged to donate. (or become a patreon)
If you have any comments, questions or just want to berate me then I'm welcome to hear it. Thanks!
http://admiralbumblebee.com/music/20...m-scratch.html
p.s. I posted it here rather than the JSFX&ReaScript forum so that people _not_ generally interested in scripting already can see it.
EDIT - I don't even assume you know how to create a text file any more. The Tutorial is now 33% easier! (I'm sure that math works out)
Last edited by Robert Randolph; 02-08-2018 at 09:25 PM.
|
|
|
02-08-2018, 04:11 PM
|
#2
|
Human being with feelings
Join Date: Feb 2017
Posts: 4,513
|
cheers! i'll check it out.
|
|
|
02-08-2018, 06:51 PM
|
#3
|
Human being with feelings
Join Date: Apr 2010
Location: South West Michigan
Posts: 256
|
Dude, you are the shit! I'm definitely going to dive into this as I've been wondering for a while now on how to program a JS. Thanks!
__________________
ADK Laptop Intel i7 2860QM, 8 GB RAM, Avid MBOX Pro 3 (BLA Modified), Novation Remote SL37, DSI Mopho, DSI Tempest, Trilian, Aether 1.5.1, Valhalla, Nerve, Komplete 7
|
|
|
02-08-2018, 07:35 PM
|
#4
|
Administrator
Join Date: Jan 2005
Location: NYC
Posts: 15,084
|
Awesome, thank you! Reading now...
Some comments: - you can create a new JSFX from the FX browser (avoiding having to use an external text editor).
- this was undocumented (oops, fixed), but rather than using You can do:
Code:
slider1:ccValue=0<0,127,1>CC to send
(supported in REAPER 5.0+)
- You can also debug JSFX by using Ctrl/Cmd+K on a symbol to read its value (or if it points to memory, it will show you the value at that point in memory).
- JSFX can't actually be used to write video processors, but the language is the same for video processors (as well as EEL ReaScripts).
- I might ask you to ditch that askjf link if I get enough noise...

Last edited by Justin; 02-08-2018 at 08:09 PM.
|
|
|
02-08-2018, 09:22 PM
|
#5
|
Human being with feelings
Join Date: Apr 2017
Location: St. Petersburg, FL
Posts: 880
|
Quote:
Originally Posted by Justin
Awesome, thank you! Reading now...
Some comments: - you can create a new JSFX from the FX browser (avoiding having to use an external text editor).
- this was undocumented (oops, fixed), but rather than using You can do:
Code:
slider1:ccValue=0<0,127,1>CC to send
(supported in REAPER 5.0+)
- You can also debug JSFX by using Ctrl/Cmd+K on a symbol to read its value (or if it points to memory, it will show you the value at that point in memory).
- JSFX can't actually be used to write video processors, but the language is the same for video processors (as well as EEL ReaScripts).
- I might ask you to ditch that askjf link if I get enough noise...

|
Awesome. I updated everything you listed and switched the askjf link.
Thank you very much for reading and the corrections! I feel annointed by the Holy Reaper Seer now.
|
|
|
02-08-2018, 11:30 PM
|
#6
|
Human being with feelings
Join Date: Dec 2015
Posts: 1,685
|
Quote:
Originally Posted by Robert Randolph
So I wrote a MIDI Note to CC plugin recently, and I thought I'd write a guide to how it's done.
I cover everything from basic MIDI concepts, to JSFX basics, to programming basics etc... I assume that the only thing you know is what Reaper is, how to create a text file and how to type.
There's no ads or anything on my site. So this is totally free unless you feel obliged to donate. (or become a patreon)
If you have any comments, questions or just want to berate me then I'm welcome to hear it. Thanks!
http://admiralbumblebee.com/music/20...m-scratch.html
p.s. I posted it here rather than the JSFX&ReaScript forum so that people _not_ generally interested in scripting already can see it.
EDIT - I don't even assume you know how to create a text file any more. The Tutorial is now 33% easier! (I'm sure that math works out)
|
You rock, man ! Awesome blog btw.
|
|
|
02-09-2018, 12:25 AM
|
#7
|
Human being with feelings
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,489
|
Cool!
A very minor nitpick, but it might be worth mentioning anyway: You can also write hex numbers as e.g. 0x90 instead of $x90. This is more in line with other programming languages e.g. C/C++, JavaScript, etc. This does require REAPER v4.25+.
|
|
|
02-09-2018, 01:11 AM
|
#8
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,094
|
Very nice !
I hope it will help users to make their own modes :P
What's next step ?
Audio Processing ?
GFX ? :P
|
|
|
02-09-2018, 09:28 AM
|
#9
|
Human being with feelings
Join Date: Apr 2017
Location: St. Petersburg, FL
Posts: 880
|
Quote:
Originally Posted by Tale
Cool!
A very minor nitpick, but it might be worth mentioning anyway: You can also write hex numbers as e.g. 0x90 instead of $x90. This is more in line with other programming languages e.g. C/C++, JavaScript, etc. This does require REAPER v4.25+.
|
Thanks. I wasn't aware of that.
I picked up the $x notation (and most of the JSFX syntax) by reading through other scripts.
Unfortunately I don't think I can fully correct the $x usage, since there's so many screenshots that use the $x notation. I will update the post to mention it though.
|
|
|
02-11-2018, 04:03 AM
|
#10
|
Human being with feelings
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,489
|
Quote:
Originally Posted by Robert Randolph
Unfortunately I don't think I can fully correct the $x usage, since there's so many screenshots that use the $x notation.
|
Of course! I guess in the end it's more of a personal preference anyway.
Quote:
Originally Posted by Robert Randolph
I will update the post to mention it though.
|
Cool. Do note however that is should be 0x0F, not just x0F.
|
|
|
02-11-2018, 05:56 AM
|
#11
|
Human being with feelings
Join Date: May 2011
Posts: 2,614
|
As pretty much your target audience I think it was very generous of you to share your time and expertise. As to the content, the best compliment I can pay you would be to say you may be the Kenny of the JSFX world!
|
|
|
02-11-2018, 07:17 AM
|
#12
|
Banned
Join Date: Aug 2007
Location: Too close to Charlotte, NC
Posts: 3,554
|
Thank you, your work is very much appreciated Mr. Randolph.
|
|
|
02-11-2018, 03:24 PM
|
#13
|
Human being with feelings
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 12,872
|
Robert,
To me you are a genius to have crafted this in just eight hours !
I'd just like to provide some nitpicking:
I think it should be mentioned that variable names are case insensitive.
"output CC value 128". This is nechnically not correct and might be confusing.
"the rule is from right to left" IMHO this is not correct.
"MIDI is processed in blocks too. I think it is worth mentioning that Misdi uses the same (i.e. the audio-) blocks and does not have it's own blocking.
"3 word messages": All midi messages are 3 words. Only the very special SysEx messages use another count.
"The first data byte is B0". This should be noted as hexadecimal and OTOH the Midi channel can be arbitrary.
"abs(ccMsg - 127)". for me this is a rather funny way to do the "inversion". More obvious would be just "127 - ccMsg".
BTW.: Itthis might be horribly old school, but I'd like to be able to d/l such documents as PDF.
Thanks for listen (and of course the great work).
-Michael
|
|
|
02-11-2018, 09:15 PM
|
#14
|
Human being with feelings
Join Date: Apr 2017
Location: St. Petersburg, FL
Posts: 880
|
Quote:
Originally Posted by mschnell
Robert,
To me you are a genius to have crafted this in just eight hours !
I'd just like to provide some nitpicking:
I think it should be mentioned that variable names are case insensitive.
"output CC value 128". This is nechnically not correct and might be confusing.
"the rule is from right to left" IMHO this is not correct.
"MIDI is processed in blocks too. I think it is worth mentioning that Misdi uses the same (i.e. the audio-) blocks and does not have it's own blocking.
"3 word messages": All midi messages are 3 words. Only the very special SysEx messages use another count.
"The first data byte is B0". This should be noted as hexadecimal and OTOH the Midi channel can be arbitrary.
|
I intentionally used CC from 1-128 and 0-127 in different places. I originally had the whole article as 0-127 and two of my proofreaders found that confusing. I'll double check this again and see if I can add clarity.
Regarding right to left, I can see how this can be confusing (totally incorrect) regarding operator associativity and execution order. The example was given to help people navigate parenthesis... I will rewrite that section. In hindsight it's definitely not optimal.
No mention of audio in this
Regarding the 3 word messages, is this the line that you're referring to "In this tutorial we are going to deal with 3 ‘word’ messages"? I specifically used this wording since system messages (opposed to channel messages) can have more or less than 2 bytes. I will adjust the wording to be more clear.
I don't use hexadecimal notation anywhere except in code. I choose this because I thought the extra notation would be potentially confusing outside the context of code. If I realized that jsfx allows 0x notation instead of $x then I would have used 0x everywhere. I'm not sure about changing this now?
Quote:
Originally Posted by mschnell
"abs(ccMsg - 127)". for me this is a rather funny way to do the "inversion". More obvious would be just "127 - ccMsg".
|
I just want to point out that this one is intentional. I wanted to introduce the ideal of using a math function somewhere, and it was a contrived example.
Quote:
Originally Posted by mschnell
BTW.: Itthis might be horribly old school, but I'd like to be able to d/l such documents as PDF.
Thanks for listen (and of course the great work).
-Michael
|
Your browser should be able to save as PDF?
I'll investigate if there's an easy way to convert the content though.
Thank you for the feedback. I will adjust a number of these things.
edit: It'll all be fixed when tomorrow's post goes up. Thank you again!
Last edited by Robert Randolph; 02-11-2018 at 09:20 PM.
|
|
|
02-12-2018, 01:07 AM
|
#15
|
Human being with feelings
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 12,872
|
Quote:
Originally Posted by Robert Randolph
Your browser should be able to save as PDF?
I'll investigate if there's an easy way to convert the content though.
|
"Printing" in a Browser (e.g. to PDF) mostly results in horrible outcome, so I did not even try. I selected your text, pasted into LibreOffice writer, and saved it as PDF. This worked perfectly.
"No mention of audio in this" Maybe it is enough to say something like this: "Midi messages are managed in the same blocks".
Thanks for listeng !
BTW, as you might know I maintain the current version of the "LiveConfigs" user guide. I'd like to link to your tutorial there. Is the given url the final destination it will reside in ?
Thanks again,
-Michael
Last edited by mschnell; 02-12-2018 at 03:36 AM.
|
|
|
02-12-2018, 06:32 AM
|
#16
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,094
|
Quote:
I'll investigate if there's an easy way to convert the content though.
|
PDFCreator may do the trick.
|
|
|
02-12-2018, 09:28 AM
|
#17
|
Human being with feelings
Join Date: Apr 2017
Location: St. Petersburg, FL
Posts: 880
|
Quote:
Originally Posted by mschnell
BTW, as you might know I maintain the current version of the "LiveConfigs" user guide. I'd like to link to your tutorial there. Is the given url the final destination it will reside in ?
Thanks again,
-Michael
|
Yes, that's the URL it will be. It won't change.
|
|
|
02-12-2018, 01:21 PM
|
#18
|
Human being with feelings
Join Date: Jun 2012
Posts: 346
|
Quote:
Originally Posted by Robert Randolph
So I wrote a MIDI Note to CC plugin recently, and I thought I'd write a guide to how it's done.
|
Well done. I imagine creating that tutorial was a lot of work. If/when I decide I want to write a plugin, I'll be back to work through the tutorial in detail.
Note, the link in this text near the top of the tutorial:
"This tutorial really isn’t for you, but maybe you can skip to results to see what happened."
... needs to target the anchor #result (singular) rather than the anchor #results (plural) which doesn't exist.
Despite having clicked that link, the tutorial is for me (even though I'm an experienced programmer), I was curious to skip to the end then come back or the beginning.
|
|
|
02-12-2018, 06:59 PM
|
#19
|
Mortal
Join Date: Jan 2006
Location: Wickenburg, Arizona
Posts: 14,002
|
Thank you for this, this is awesome!
|
|
|
02-12-2018, 08:16 PM
|
#20
|
Human being with feelings
Join Date: Apr 2017
Location: St. Petersburg, FL
Posts: 880
|
Quote:
Originally Posted by pbattersby
Well done. I imagine creating that tutorial was a lot of work. If/when I decide I want to write a plugin, I'll be back to work through the tutorial in detail.
Note, the link in this text near the top of the tutorial:
"This tutorial really isn’t for you, but maybe you can skip to results to see what happened."
... needs to target the anchor #result (singular) rather than the anchor #results (plural) which doesn't exist.
Despite having clicked that link, the tutorial is for me (even though I'm an experienced programmer), I was curious to skip to the end then come back or the beginning.
|
Great catch on that anchor mistake.
I'm fixing it now!
|
|
|
02-12-2018, 10:02 PM
|
#21
|
Human being with feelings
Join Date: Jun 2010
Location: Texas
Posts: 353
|
Whoa! Thank you so much for this! Exactly what I needed, exactly when I needed it!
|
|
|
02-13-2018, 12:33 PM
|
#22
|
Human being with feelings
Join Date: Apr 2012
Location: Denver, CO
Posts: 249
|
Great Work!
Thanks for this. The level of detail will help many of us.
|
|
|
02-14-2018, 09:43 AM
|
#23
|
Human being with feelings
Join Date: Apr 2017
Location: St. Petersburg, FL
Posts: 880
|
Quote:
Originally Posted by mschnell
"Printing" in a Browser (e.g. to PDF) mostly results in horrible outcome, so I did not even try. I selected your text, pasted into LibreOffice writer, and saved it as PDF. This worked perfectly.
"No mention of audio in this" Maybe it is enough to say something like this: "Midi messages are managed in the same blocks".
Thanks for listeng !
Thanks again,
-Michael
|
I've spent an inordinate amount of time trying to get PDF rendering to work on my side.
Sadly it doesn't appear that it can happen currently due to various factors.
I'll have it in the back of my mind. Maybe I'll randomly come up with a solution while baking some potatoes or something. That happens a lot.
|
|
|
12-03-2020, 06:16 AM
|
#24
|
Human being with feelings
Join Date: Nov 2020
Location: depends
Posts: 23
|
<3
Robert Randolph
thanks you very much for this, man!
|
|
|
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 07:46 AM.
|