Old 07-22-2021, 02:30 PM   #1
Human being with feelings
Join Date: May 2021
Posts: 14
Default Real Time Chord Detector Script (alpha)

Real-time chord detector script derived from the chord input detection in MusoBob's ReaTrak script. I enhanced the detection logic so that the script now works for inversions, spread voicings and slash chords.

REQUIRES SWS EXTENSIONS INSTALLED. Get it here if you don't have it yet.
1. Download and install Lokasenna GUI Builder v2 from here or via ReaPack. Make sure to run Set Lokasenna_GUI v2 library path.lua from Actions after installing.
2. Download the LUA script and the required JSFX here.
3. Place the jsfx in (your Reaper resource folder)/Effects/midi. To ensure the new jsfx is detected within Reaper, run the 'scan for new/modified plugins' option in Reaper.

NOTE:If you previously had ReaTrak installed, you might already have the original version of this JSFX. If so, replace it with this modified version!

4. Place the LUA script file in (your resource folder)/Scripts/ folder. Add the script to Reaper from the Action List.
5. Run the script.

The script will ask you to add a new track which it will use for incoming MIDI signals. The created track will automatically have input enabled for all MIDI inputs. It will also have solo defeated so it'll keep active even if some other track is soloed.

NOTE: The input track will be created at the top of tracklist. It is recommended you keep this track as the first one in any project

6. Play chords with your MIDI keyboard or virtual MIDI keyboard. The script should display the chord name and the constituent notes in real-time. You can also route MIDI from an existing MIDI track to the detector track to see the chords played.

1. To work with inversions, the script recursively calculates all possible permutations of a given set of notes until it finds a matching chord pattern. So if given very complex chords (6 or 7+ unique notes) in inverted form, it might significantly slow down your system due to the number of calculations required.

Therefore, for now, maximum number of unique notes for a chord is limited to 7. Repeated notes across different octaves is fine, so total number of notes may still be more.

2. Currently, the script allows for only one chord input track to be created in a project. The primary purpose of it for now is to detect chords from live input and not existing tracks(although it is possible to route one track to it right now). Might add the option for multiple tracks in the future if it doesn't get messy.

3. The list of recognized chord patterns is not exhaustive or complete. If you find a chord type that is not being recognized/incorrectly recognized, let me know!
Additional notes
This is my first attempt at Reaper scripting, and my capabilities in this regard are limited. I eagerly invite veteran scripters here to try out the script and suggest/help with improvements. The main challenge right now is to optimize it to work efficiently for any number of notes.

The code might be quite visually messy at the moment, so apologies in advance for that :P
Please let me know if/how this works for you all! Cheers!

Last edited by prochak96; 07-22-2021 at 02:45 PM.
prochak96 is offline   Reply With Quote

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 03:08 AM.

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