Old 07-20-2018, 10:10 AM   #1
matthewjumpsoffbuildings
Human being with feelings
 
Join Date: Mar 2013
Posts: 463
Default JS MIDI effect sending data to Reaper Web Interface

im interested in getting realtime tuner info to show on the reaper web interface.

to do so im thinking of doings something like so:

ReaTune (sends MIDI of detected note) -> custom JS MIDI effect (uses MIDI from ReaTune to create a readable string like "-->A---" and to somehow do SetExtState() or something similar to store this data -> Reaper Web Interface javascript (calls GetExtState every 100 milliseconds or so to display the string stored by the JS MIDI effect

where im getting stuck is im not sure how to get the JS MIDI effect to store the string it generates in a way that the Reaper Web Interface javascript can access and display.

is this possible?
__________________
[sun sprites] spotify facebook
matthewjumpsoffbuildings is offline   Reply With Quote
Old 07-20-2018, 10:26 AM   #2
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

Maybe helpful as well, the documentation for JSFX

https://www.reaper.fm/sdk/js/js.php
Meo-Ada Mespotine is online now   Reply With Quote
Old 07-20-2018, 10:33 AM   #3
matthewjumpsoffbuildings
Human being with feelings
 
Join Date: Mar 2013
Posts: 463
Default

yea i had a look thru that and couldnt find anything that seemed to achieve what i need...
__________________
[sun sprites] spotify facebook
matthewjumpsoffbuildings is offline   Reply With Quote
Old 07-20-2018, 12:24 PM   #4
snooks
Banned
 
Join Date: Sep 2015
Posts: 1,650
Default

You might be better off ignoring the JSFX angle and going for a script to get the ReaTune parameter and set an ExtState.
snooks is offline   Reply With Quote
Old 07-20-2018, 12:25 PM   #5
matthewjumpsoffbuildings
Human being with feelings
 
Join Date: Mar 2013
Posts: 463
Default

how does the script get called constantly when ReaTune is changing the current MIDI note in realtime?
__________________
[sun sprites] spotify facebook
matthewjumpsoffbuildings is offline   Reply With Quote
Old 07-20-2018, 12:47 PM   #6
snooks
Banned
 
Join Date: Sep 2015
Posts: 1,650
Default

Scripts can run in the background, getting called around 25 times a second, so will get the parameter that number of times and the web app will call X times a second so should be responsive enough for tuning.
snooks is offline   Reply With Quote
Old 07-20-2018, 12:50 PM   #7
matthewjumpsoffbuildings
Human being with feelings
 
Join Date: Mar 2013
Posts: 463
Default

what is the impact on realtime performance to have a script running that often?

also i am attempting to set this up right now and ReaTune doesnt have a parameter I can access via a script to get the current note, ReaTune simply sends MIDI data when the note changes.
__________________
[sun sprites] spotify facebook

Last edited by matthewjumpsoffbuildings; 07-20-2018 at 01:02 PM.
matthewjumpsoffbuildings is offline   Reply With Quote
Old 07-20-2018, 01:20 PM   #8
matthewjumpsoffbuildings
Human being with feelings
 
Join Date: Mar 2013
Posts: 463
Default

ok further investigation leads me to believe that ReaTune wont work for this after all, since even if i send MIDI from it to a JS fx that reads out the midi note into one of its params (which i then can access in my deferred ReaScript), the note data ReaTune sends is only the nearest whole note, it doesnt seem to send the cents that the tuning is off by...

There is a JSFX tuner that has a param that is exactly what i want - eg it reads out "[--*--|-----]" and the name of the note, problem is its really wonky and unreliable compared to ReaTune, especially on higher guitar strings :/
__________________
[sun sprites] spotify facebook
matthewjumpsoffbuildings is offline   Reply With Quote
Old 07-20-2018, 02:53 PM   #9
snooks
Banned
 
Join Date: Sep 2015
Posts: 1,650
Default

Yeah, I didn't check ReaTune for a tuning parameter so you'd need a reliable parameter for it to work. Checking a parameter via a script won't use any noticeable CPU plus you don't have to check every defer call, you can set up a timer so that it only checks once every X calls.
snooks is offline   Reply With Quote
Old 07-20-2018, 03:17 PM   #10
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

Then it's probably time for a feature-request
Meo-Ada Mespotine is online now   Reply With Quote
Old 07-20-2018, 05:42 PM   #11
snooks
Banned
 
Join Date: Sep 2015
Posts: 1,650
Default

The effect MJOB mentions doesn't use FFT so I think the answer might be to write a JSFX that uses the FFT functions that I assume are shared by ReaTune. I have no idea how to do that though, experiments have failed.
snooks is offline   Reply With Quote
Old 07-20-2018, 07:07 PM   #12
matthewjumpsoffbuildings
Human being with feelings
 
Join Date: Mar 2013
Posts: 463
Default

is the source of ReaTune available anywhere?
__________________
[sun sprites] spotify facebook
matthewjumpsoffbuildings is offline   Reply With Quote
Old 07-21-2018, 03:08 AM   #13
snooks
Banned
 
Join Date: Sep 2015
Posts: 1,650
Default

No and I'm only assuming that ReaTune uses it for the tuner. Maybe it doesn't, but I know that you can get pitch with FFT so it would be worth a bash to see if it's better than what you have just now. I just don't know how that would be done.
snooks is offline   Reply With Quote
Old 01-21-2023, 08:09 PM   #14
lexaproductions
Human being with feelings
 
Join Date: Jan 2013
Posts: 1,126
Default

Well JSFX can write to a gmem. Probably a defer script could write the gmem info to an extstate then webremote could read that extstate?

Or maybe the webremote can read gmem directly?
lexaproductions 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 04:35 AM.


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