Old 07-18-2023, 10:18 AM   #1
Petey-B
Human being with feelings
 
Petey-B's Avatar
 
Join Date: Jan 2023
Location: Kent Island, MD USA
Posts: 20
Default TouchOSC Widgets for Reaper

What you'll find here:
  • This is an ongoing collection of widgets that can be ncorporated into TouchOSC control surfaces.
  • Each widget is in a self-contained group that can be copied and pasted and customized to your liking.
  • A few are autonomous, but most require a support structure added to Reaper by way of scripts and OSC shortcuts.
  • They've been built and tested under Windows 64bit, but will most likely run on other platforms.
  • Keep in mind I'm pretty new to all this GitHub and forum posting stuff, ...
Conventions:
  • Custom OSC messages are usually named after the Lua files they trigger.
  • I use locally referenced Reaper API calls in my scripts, they run faster and are easier to type.
  • Scripts have been optimized and benchmarked, so they may not be the easiest to follow.
  • I've tried to keep the scripts as implementation neutral as possible, but since everyone's device ID's etc. are different the need to modify some of the scripts and control surfaces is unavoidable. I will do my best to keep the README files on GitHub comprehensive.
  • I'm open to suggestions, if they intrigue or challenge me I might implement them.
You can find all the widgets and support code on GitHub at Petey-B's /TouchOSC Widgets

As of this post I'm using Reaper 6.81 and TouchOSC 1.2.2.175.
__________________
Windows is your punishment for wanting a Macintosh...

Last edited by Petey-B; 07-18-2023 at 11:45 AM.
Petey-B is offline   Reply With Quote
Old 07-18-2023, 11:33 AM   #2
Petey-B
Human being with feelings
 
Petey-B's Avatar
 
Join Date: Jan 2023
Location: Kent Island, MD USA
Posts: 20
Default Quick Markers

Starting off with a simple one:

  • A basic widget that manipulates markers 1 to 8.
  • Tap a numbered button to go to that marker.
  • Tap Set and then a numbered button to set/move that marker.
  • Tap Del and then a numbered button to delete that marker.
  • Use the arrow buttons to go to the next/prev marker.
Aailable on GitHub at Petey-B's /TouchOSC Widgets - Quick Markers

As of this post I'm using Reaper 6.81 and TouchOSC 1.2.2.175.
Attached Images
File Type: png QM.png (24.4 KB, 575 views)
__________________
Windows is your punishment for wanting a Macintosh...
Petey-B is offline   Reply With Quote
Old 07-18-2023, 01:34 PM   #3
Petey-B
Human being with feelings
 
Petey-B's Avatar
 
Join Date: Jan 2023
Location: Kent Island, MD USA
Posts: 20
Default Current Project Monitor

This one takes a bit of set up:



A defer loop widget that monitors the current project file and cursor position and updates it when changed. Since Reaper has no way to send custom OSC messages the script uses MIDI to send information to TouchOSC. It requires two script files OSCcurrentProject.lua and OSCexit.lue both of which need to be loaded into the Action List and triggered by OSC messages of the same names.

OSCcurrentProject.lua will have to be modified as follows:
Code:
-- 16 + the MIDI device ID that TouchOSC is receiving messages from
local ID = 36

-- 0xB0 + channel# -1, the channel that the gProj group is listening to
local CH = 0xBF

-- checks every 10 calls (≈ 1/3 sec) delays the first call by 16 cycles
-- these can be tweaked to reduce processor impact
local Freq, DeferCt = 10, -6

-- these are commented out, but if you're running TouchOSC on a touchscreen
--    monitor, they may be necessary when tapping the power button changes
--    the active application
r.midi_init(ID-16,-1)
How It Works:.
  • Tapping the power button sends an OSC msg /OSCcurrentProject with the MIDI CC# to use as its argument.
  • A defer loop is started. The update code is run every 10 loops.
  • The code first checks to see it the OSCcurrentProject section exists as an external state, if it does it is deleted and the loop ends.
  • Otherwise it checks to see if anything has changed, if it has, the new data is sent to TouchOSC one char at a time via the MIDI CC.
  • The first char indicates which data is being sent (can be 1 to 31, but only 3 are defined).
  • TouchOSC reassembles the string using a table; when it receives char 127 it concats the table and sets the data.
  • When the power button is pressed again it sends /OSCexit with argument OSCcurrentProject which creates that ExtState
  • The next defer loop shuts everything down.
The CC value in the widget is 90, on channel 16. If you change it, it will have to be changed in the MIDI message that the gProj control listens for.

How to Set It Up:
  • Make any necessary changes to the OSCcurrentProject.lua script, and the widget.
  • Load the two scripts into Reaper's Action List.
  • Select OSCcurrentProject, click Add... and tap the power button.
  • Select OSCexit, click Add... and tap the power button again.
  • The two scripts should be set to trigger by their OSC namesakes.
Things That Can Go Wrong:
  • There is no exit strategy if TouchOSC is closed without turning the power off, so the defer loop will keep running.
  • If this happens just double click on the script and select Terminate Instance.
Aailable on GitHub at Petey-B's /TouchOSC Widgets - Current Project Monitor

As of this post I'm using Reaper 6.81 and TouchOSC 1.2.2.175.
__________________
Windows is your punishment for wanting a Macintosh...

Last edited by Petey-B; 07-31-2023 at 03:01 PM. Reason: typo
Petey-B is offline   Reply With Quote
Old 07-28-2023, 01:30 PM   #4
Petey-B
Human being with feelings
 
Petey-B's Avatar
 
Join Date: Jan 2023
Location: Kent Island, MD USA
Posts: 20
Default MIDI Editor Cursor Mover

Moves the cursor around in the MIDI Editor. I also have Jog and View Scroll/Zoom widgets that will eventually make it up here.



How It Works:
  • Sends the OSC message /MECmove which triggers the script MECmove.lua, passing a string argument to direct execution.
  • The top cemter radio control sets whether the prev/next arrows move the cursor by a Measure, Quarter note or Grid unit.
  • The diamond shaped controls snap the cursor to the prev/next unit set by the aforementioned radio.
  • The bottom center radio determines whether the flanking arrows move to the prev/next start or end of note.
How To Use It:
  • The setup is the same for all my single script widgets (SSW's).
  • Load the script MECmove.lua into the Reaper's Action List.
  • Select it and,click Add... then tap any non-radio button on the control.
  • The script should now be triggered by the /MECmove OSC message.
Caveats:
  • If there is no MIDI Editor window open you'll get an error message; while some of the functionality doesn't use an active MIDI Editor take, most require it.
Aailable on GitHub at Petey-B's /TouchOSC Widgets - MIDI editor Cursor
__________________
Windows is your punishment for wanting a Macintosh...
Petey-B is offline   Reply With Quote
Old 07-31-2023, 02:46 PM   #5
Petey-B
Human being with feelings
 
Petey-B's Avatar
 
Join Date: Jan 2023
Location: Kent Island, MD USA
Posts: 20
Default MIDI Editor View Scroll/Zoom

Scrolling and Zooming in the MIDI Editor - Updated !



How It Works:
  • Tap the button in the middle of the encoder to toggle between scroll and zoom modes.
  • The encoder controls the horizontal view, the fader controls the vertical.
  • The encoder uses an inertial algorithm so that the faster you move it the more it will scroll; it works but could use some tweaking.
  • The control OSC messages trigger scripts that send MIDI messages on channel 16 CC#'s 10 - 13.
  • The TouchOSC file includes buttons to facilitate assigning the MIDI shortcuts.
  • The pads below the encoder scroll view left/right; in zoom mode they zoom to time selection/content
How To Use It:
  • Load the two scripts MEV_scroll.lua and MEV_zoom.lua into Reaper's Action List.
  • Assign the OSC shortcuts to them.
  • Assign the MIDI triggers to the native scroll/zoom actions in the MIDI Editor section of the Action List.
  • See the README file on GitHub for detailed instructions.
Caveats:
  • My setup runs TouchOSC locally on a touchscreen monitor.
    The scripts can be modified if you'll only be running it from a phone, tablet or anything else not running on the same computer. Details are in the README file.
  • The zooming is a little aggressive, I'm working on smoothing it out a little.
  • The SN_FocusMIDIEditor() API function call requires the SWS extensions, which you should already have anyway if you're using custom scripts.
  • If these widgets don't seem to work exactly as advertised, it may be that your Editor prefs are set up differently.
    Here's a good post on how to
    Set up MIDI Editor for a Better Workflow

    This is how mine is configured, it's more intuitive than Reaper's default setup.
Available on GitHub at Petey-B's /TouchOSC Widgets - MIDI Editor Scroll Zoom
__________________
Windows is your punishment for wanting a Macintosh...

Last edited by Petey-B; 08-02-2023 at 08:04 AM. Reason: Updated
Petey-B is offline   Reply With Quote
Old 08-01-2023, 08:15 PM   #6
Petey-B
Human being with feelings
 
Petey-B's Avatar
 
Join Date: Jan 2023
Location: Kent Island, MD USA
Posts: 20
Default MIDI Editor Note Selector (by time span)

This is the first of several note selection widgets (NSWs).
While the buttons and radios may seem redundant, they allow one tap selection, deselection and inversion of various spans around the edit cursor's current position.



How It Works:
  • Tapping any of the green buttons will execute the selection of notes.
  • The blue radio controls modify how the selection is made:
    • The top radio pertains to the buttons above it
    • The bottom radio controls the buttons below it
  • The round toggle buttons on the right modify what gets included/excluded
    • + - determines whether this is a new selection or extends/modifies an existing selection
    • ⊏♪ - includes only notes that start within the selection span
    • ♪⊐ - includes only notes that end within the selection span
    • If neither start nor end is on, notes are selected if any part of them falls within the selection span
    • The start/end buttons have no effect when selecting notes @ the edit cursor
    • None of these modifiers apply when working on all notes in the current take
How To Use It:
  • Load the script ME_selSpan.lua into Reaper's Action List.
  • Assign the OSC shortcut /ME_selSpan by tapping any of the green buttons.
  • The script should now be triggered by its namesake.
  • See the README file on GitHub for detailed instructions pretty much the same thing.
Notes:
  • The toggles change their default values and are persistent only if the file is explicitly saved.
    The changes do not flag the file as dirty, so it can be closed without prompting.
    This actually has advantages; if you want it to start up a certain way, just save it.
    TouchOSC needs an onExit() callback.
  • The selection algorithm uses exact PPQ values to determine inclusion.
    As a result, boundary conditions may result in unintended selections.
    If this turns out to be overly annoying I'll add a few more "if" blocks.
  • I went to great lengths to implement the "extend existing selectiion" toggle.
    It required iterating over every note regardless of the span size; but even
    with all that code the entire script runs in under 12ms for a 250 note take.

Aailable on GitHub at Petey-B's /TouchOSC Widgets - MIDI Editor Span Selector

A Note About Visual Representation Paradigms:
I've seen some TouchOSC control surfaces out there that have gone to great lengths to achieve a sense of photo-realism with the knobs and faders. This requires a glut of static objects that take time to load and render. I strive for simple functionality and put most of my efforts into the underlying code. Eventually TouchOSC will support images, when that happens I'll fire up Photoshop and make slicker looking controls; for now I'll settle for visually inoffensive and functionally effective.
__________________
Windows is your punishment for wanting a Macintosh...
Petey-B 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 07:06 AM.


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