Old 06-09-2019, 01:48 PM   #1
Dafarkias
Human being with feelings
 
Dafarkias's Avatar
 
Join Date: Feb 2019
Location: Southern Vermont
Posts: 864
Default Dfk's Transient Guru (v1.1)

Disclaimer:
Test/use my scripts at your own risk. While it is atypical that a REAPER Lua script would damage or harm your hardware/software/data, I will not accept any liability if this were to occur. The download, installation, and operation of my scripting code and its structures are strictly an operative of free will, and signify an agreement to these terms. You are responsible for any damages that might occur, however unlikely. All my scripts are licensed as GPL v.3.

The script requires Reaper [5.978+], SWS/S&M [2.10.0+], and js_ReaScriptAPI [.987+].

Video (v1.02):



Goodies:

Accuracy:
Accuracy is the time-length of audio in samples used to formulate the average db and average frequency values. Left-click this button to set the "Accuracy" length to the length of your time selection. It is best to ensure this value is set large enough to maintain accurate transient detection, yet small enough to eliminate the possibility of reading transients that potentially may be nearby your stretch-markers (a.k.a., the ‘sweet spot’).
Threshold:
The threshold refers to the variable amount that each stretch-marker may differ from your chosen stretch-marker's average db or frequency (or else it will get removed!). For instance, a value of 10 threshold would mean that all stretch-markers within the workflow item must range within a multiplied variance of 10 in order to remain. Threshold defaults a 10000, which essentially just ensures that no stretch-markers are removed prior to a user deliberation.
Choose SM:
In order to select a stretch-marker, left-click the "Choose SM" button and hold: move your mouse over the desired stretch-marker inside your workflow item, and release.
[UP/DOWN] Keys:
These keys micro-adjust the threshold variable when the script window is focused. Focus the window simply by clicking inside the window, or on its title-bar.
Settings:
Settings contains three different options for calculation of/and stretch-marker removal.

1 (default): Calculation is based off both the average db and average frequency values.
2 (spectrum): Calculation is determined using only the average frequency data.
3 (volume): Calculation is determined using only the average db data.
Create Dyn. Midi:
Creates a MIDI track item and populates with midi notes correlating to stretch-marker data. These notes are velocity sensitive, and are PPQ accurate.
Extra Notes:
Right-click the "Threshold" value to adjust the db threshold used to calculate average frequency.

Right-click the "Accuracy" value to manually input a positive integer accuracy value.

Shoutout to X-Raym for the portion of his code I used to figure out the frequency detection portion of this script. https://forum.cockos.com/showthread.php?t=213286
Release Log:
[v1.01]
-Altered algorithm for transient detection.
-Fixed issue where mouse would active buttons on the GUI even if window wasn't focused.
-Removed the ability to input "0" as an accuracy value (pointless, and caused errors.)
-Added support for stereo tracks.
-Added "Update SM's" button to the GUI.
-Added support for pre-stretched stretch-markers.
[v1.02]
-Added "average frequency" detection.
-Added 3 settings for stretch-marker filtration.
-Added shadows to GUI.
-Added maximum-limit for accuracy setting of 1-second of samples (typically 44100+).
-Bolstered "Help" documentation.
-Removed minor bugs.
-Removed all calls to Main_OnCommand.
-Removed stretch-marker "Slope" viewer-detail.
-Improved script speed/efficiency
[v1.03]
-Removed "Fingerprint" nonsense, replaced with factual content.
-Configured “out-of-bound” stretch-marker message only to show when applicable.
-Added an undo point at startup of script for renewing any undesired removal of stretch-markers.
-Bolstered "Help" documentation.
[v1.1]
-NEW FEATURE: "Create Dyn. Midi"
-Optimized script. Now handles multiple items/tracks simultaneously.
-Enhanced overall script speed.
Attached Files
File Type: lua Dfk's Transient Guru.lua (32.1 KB, 238 views)

Last edited by Dafarkias; 03-26-2020 at 03:44 AM. Reason: N/A
Dafarkias is offline   Reply With Quote
Old 06-11-2019, 01:23 PM   #2
HoJo
Human being with feelings
 
Join Date: Dec 2007
Location: Germany
Posts: 253
Default

Hi.

This looks really good, but actually I wonder what situations this might be used at?
Can you point me in the right direction?
What is this useful for. And how to use it.

Thx.

BR,
HoJo
HoJo is offline   Reply With Quote
Old 06-11-2019, 04:13 PM   #3
Dafarkias
Human being with feelings
 
Dafarkias's Avatar
 
Join Date: Feb 2019
Location: Southern Vermont
Posts: 864
Default

Quote:
Originally Posted by HoJo View Post
Hi.

This looks really good, but actually I wonder what situations this might be used at?
Can you point me in the right direction?
What is this useful for. And how to use it.

Thx.

BR,
HoJo
Hi Hojo, thanks for the comment.

I made this script specifically for my own use, but I decided to share it in case someone/anyone might find it useful.

Essentially what I set out to make was a script that adds EQ/frequency detection to Reaper's "Dynamic Split."

Currently, Reaper's "Dynamic Split" detects based on an unbiased audio threshold (I'm pretty sure), meaning that it has no settings or ability to do the following:

Hey Reaper, only place stretch markers at transients with a similar EQ to a specifically chosen transient!

This script was designed with the intention to combat that inability, by, after running the script and following its moderately confusing instructions, removing all stretch markers from a selected item that don't meet the user's criteria a.k.a. threshold.

This feature can also be used to split audio takes too, for those of you who haven't aren't crazy about stretch markers and prefer good old fashioned "slip-editing," simply because Reaper has "split item(s) at stretch marker(s)" capabilities.

It's a very obscure script. Mainly good for editing drums, I would hazard to guess (if it's even good for that?), but it did seem to work okay when I tried it out in the unedited video I posted. Keep in mind I just banged this thing together in the last 3 days.

Thanks for your interest,

Dafark

[Add., 6/12/2019]

Just want to reiterate that I still plan on updating this script to the tune of adding compatibility with stereo items and "stretched" stretch markers. I also may include a dedicated "Calibrate/Update SM's" button in the GUI (as opposed to having to change the "accuracy" setting to update stretch marker edits).

I realize that this script is not for everyone, it won't be an overnight sensation, but that's okay because it wasn't intended to be! My favorite thing about Reaper is the sheer amount of obscure information you can find documented in this forum if you take a little time to research what you are looking for, its unprecedented of any audio software I've ever seen/used (My experience with DAW's is not all inclusive; I've dabbled in Garageband, Cakewalk 4, and for about 5+ years, Studio One).

...Back on track, expect the update within a few days, I reckon. Or don't.

Last edited by Dafarkias; 06-12-2019 at 03:17 AM. Reason: Update Info;
Dafarkias is offline   Reply With Quote
Old 06-13-2019, 01:24 PM   #4
HoJo
Human being with feelings
 
Join Date: Dec 2007
Location: Germany
Posts: 253
Default

Awesome. Really great. By accident, you started working on something I was hoping/asking for a while ago. See here:
https://forum.cockos.com/showthread....highlight=idea
HoJo is offline   Reply With Quote
Old 06-13-2019, 01:30 PM   #5
HoJo
Human being with feelings
 
Join Date: Dec 2007
Location: Germany
Posts: 253
Default

Awesome. Really great. By accident, you started working on something I was hoping/asking for a while ago. See here:
https://forum.cockos.com/showthread....highlight=idea
HoJo is offline   Reply With Quote
Old 06-13-2019, 02:06 PM   #6
HoJo
Human being with feelings
 
Join Date: Dec 2007
Location: Germany
Posts: 253
Default

Unfortunately, I get this type of error, when using it on Kick/Snare Tracks only...

Dfk Item; Stretch Marker; Transient Matcher.lua:169: attempt to call a nil value (field 'JS_Mouse_GetState')

Edit: I'm on MacBookPro, OSX, Sierra

Last edited by HoJo; 06-13-2019 at 02:12 PM.
HoJo is offline   Reply With Quote
Old 06-13-2019, 02:15 PM   #7
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
Default

Quote:
Originally Posted by HoJo View Post
Unfortunately, I get this type of error, when using it on Kick/Snare Tracks only...

Dfk Item; Stretch Marker; Transient Matcher.lua:169: attempt to call a nil value (field 'JS_Mouse_GetState')

Edit: I'm on MacBookPro, OSX, Sierra
Do you have js_ReaScriptAPI extension installed?
Looks like this script requires it, assuming from the error message.

https://forum.cockos.com/showthread.php?t=212174

edit:
Yes, missed it in the opening post:
Quote:
FYI: It does require REAPER: 5.978, SWS/S&M 2.10.0, and js_ReaScriptAPI .987

Last edited by nofish; 06-13-2019 at 02:36 PM.
nofish is offline   Reply With Quote
Old 06-14-2019, 02:27 AM   #8
Dafarkias
Human being with feelings
 
Dafarkias's Avatar
 
Join Date: Feb 2019
Location: Southern Vermont
Posts: 864
Default

Quote:
Originally Posted by nofish View Post
Do you have js_ReaScriptAPI extension installed?
Looks like this script requires it, assuming from the error message.
Quote:
Originally Posted by HoJo View Post
Unfortunately, I get this type of error, when using it on Kick/Snare Tracks only...

Dfk Item; Stretch Marker; Transient Matcher.lua:169: attempt to call a nil value (field 'JS_Mouse_GetState')

Edit: I'm on MacBookPro, OSX, Sierra
nofish hit the nail on the head. I've boldened the font stating the script requirements, and I'm very interested if the script will work with your OS after having installed the extensions, I will highly appreciate any information that you give me regarding bugs or errors!

Hmmm. This is the unfortunate time that I have to admit I'm a reckless "programmer" and that the [up/down] key function of this script (probably) does not work for any OS other than Windows. It was a corner that I cut, and never went back to research and reprogram a fix for due to forgetfulness. I'll try and work on that.** There may be other OS compatibility issues that exists, but none that I'm aware of, and I'd be more than happy to try and fix them if there are!

On a more general note, I'd really like to bump up the professionalism and accuracy of this script (once again, just for my own use but I'll share if it works well) by adding discrete FFT algorithms for average frequency detection. I'm researching into it, but I'm not a mathematical genius, and I'd prefer a lua library (some exist, typically not updated or poor documentation for a newb like me).

I might ask around in the forum, I'm pretty sure MPL and Eugene have both used FFT in their scripts (probably almost all the SWS studs have), but I know that *unfortunately* Eugene has been on a Reascript "hiatus," of sorts.

[Add., 6/14/19]

I might have hit a little luck with a post* of the X-Raym regarding a bug he encountered, as it seems to provide valuable information regarding scripting the frequency detection of samples.

*https://forum.cockos.com/showthread.php?t=213286

[ADD. 6-15-19]
Had good success implementing several new features to the script, and after some trial-and-error it seems to be working okay, too! Going to bed now, but I'm not going to post the newer version right now because I want to update the documentation to accurately reflect the changes first. Hopefully will be done tomorrow.

G'nite!

**Now, my understanding is that the key codes I used should be compatible across OS platforms.

Last edited by Dafarkias; 06-16-2019 at 07:00 AM.
Dafarkias is offline   Reply With Quote
Old 06-15-2019, 08:58 AM   #9
HoJo
Human being with feelings
 
Join Date: Dec 2007
Location: Germany
Posts: 253
Default

thanks, got it working now.

Anyway, I somewhat still understand the workflow.
Say I have number of grouped drumtracks which I would like to timestretch by creating and using stretchmarkers.
What needs to be done when?
First create stretch markers via Dynamic way?
Then use the script on...what?
Sorry, if asking dumb questions, but I really don't see the entry here.
Any hint appreciated.
HoJo is offline   Reply With Quote
Old 06-15-2019, 12:19 PM   #10
Dafarkias
Human being with feelings
 
Dafarkias's Avatar
 
Join Date: Feb 2019
Location: Southern Vermont
Posts: 864
Default

Quote:
Originally Posted by HoJo View Post
thanks, got it working now.

Anyway, I somewhat still understand the workflow.
Say I have number of grouped drumtracks which I would like to timestretch by creating and using stretchmarkers.
What needs to be done when?
First create stretch markers via Dynamic way?
Then use the script on...what?
Sorry, if asking dumb questions, but I really don't see the entry here.
Any hint appreciated.
They aren't dumb questions!

It's mostly my fault that you are somewhat confused by this, I've been spending most my time on trying to make the script work and bug-proof, and hadn't had much time to really work on "ease-of-use."

I'm doing a little bug-testing right now, but I'm about to shoot another little video (I'm going to try and make this easier to follow/understand), and if everything goes well, then post v. 1.02 shortly, which has average frequency detection.

[ADD. 6-15-19]

I do want to clarify; this script does hinge on stretch markers already being placed. Sort of like I eluded to earlier, use can still use this script if you prefer slip-editing to stretch markers simply by following a procedure of the like:
**Place stretch markers using "Dynamic Split" (Dynamic Split is a great tool!)
**Watch my newest video and use it as a walk-through; Read the documentation too if it will help!
**After/if you've achieved good results, just split the item at stretch markers and remove stretch markers!
Also to answer your specific question about your grouped drum tracks (my drum tracks usually stay grouped too): This script was actually designed to assist (myself) in drum editing. That being said, the nature of this script's complication level would skyrocket (regarding my skill level) if I attempted to incorporate multi-track, multi-item, functionality. And the rewards (assuming success) would be minimal, only shaving off perhaps minutes of editing, despite having spent what I assume would be countless hours programming.

Because of this, it's currently designed only to work on one single item at a time. But it's not very difficult to find free Reaper scripts that "copy" either stretch markers from item/take to item/take, or even cut points.

But realistically, for me, this is not an issue. On an average take of drums from my guys there's probably about 5-15 edits (different items) for an entire song. If I'm in the process of placing my stretch markers (or splits) on my kick and snare tracks, the amount of time it would take me to run this script on 5-15 items is negligible. And in theory, this script should actually be saving me a lot of time, given that it works correctly and efficiently. Then, once finished, I simply just use one of either MPL's, spk's, or my own scripts to transfer the stretch markers equally to all other tracks/items, as to edit each track identically and not introduce any phasing into the mix.

Last edited by Dafarkias; 06-15-2019 at 02:04 PM.
Dafarkias is offline   Reply With Quote
Old 06-15-2019, 01:00 PM   #11
Dafarkias
Human being with feelings
 
Dafarkias's Avatar
 
Join Date: Feb 2019
Location: Southern Vermont
Posts: 864
Default [Update! v. 1.02]

Version 1.02 here, and I've recorded a new video, I hope this one is much better!



[v. 1.02]
-Added "average frequency" detection.
-Added 3 settings for stretch marker filtration.
-Added shadows to GUI.
-Added maximum-limit for accuracy setting of 1-second of samples (typically 44100+).
-Bolstered "Help" documentation.
-Removed minor bugs
-Removed all calls to Main_OnCommand.
-Removed stretch marker "Slope" viewer-detail.
-Improved script speed/efficiency
New Documentation!
Accuracy:

Accuracy is the time-length of audio in samples, of which to detect the volume "Fingerprint" and the average frequency.
Left-click this button to set the "Accuracy" length to the length of your time selection.

Threshold:

The threshold refers to the variable amount that each stretch marker may differ from the selected stretch marker's "Fingerprint" and/or average
frequency. For instance, a value of 10 threshold would mean that all stretch markers within the workflow item must range within a multiplaction
variance of 10 in order to remain. Threshold defaults a 10000, which basically ensures no stretch marker removal until a user would deliberately
adjust the threshold setting.

Choose SM:

In order to select a stretch marker click the "Choose SM" button and hold: move your mouse over the desired stretch marker inside your workflow
item, and release.

[UP/DOWN] Keys:

These keys micro-adjust the threshold variable when the "Transient Matcher" window is focused.

Instructions/Suggested Use:

After having placed your stretch markers using Reaper's "Dynamic Split" function, run this script. Select one of the "good" transients in your
Reaper project time selection that you want to use, and left-click "Accuracy." Next, select this same stretch marker using the method given in
"Choose SM:." Lastly, set the threshold to "0" and slowly increase threshold value; preferrably by using the up/down keys, until desired results
are achieved.

Settings:

Settings contains three different options for calculation of stretch marker removal.

0: Default. Calculation is based off both the "Fingerprint," and average frequency.
1: Spectrum-only. Calculation is determined using only the average frequency data.
2: "Fingerprint." Calculation is determined using only the "Fingerprint" data of the workflow item's stretch marker.

Notes:

Right-click the "Threshold" value adjust the db threshold used to calculate average frequency.

Right-click the "Accuracy" value to manually input a positive integer accuracy value.

Shoutout to X-Raym for the code of his I used to figure out the frequency detection portion of this script. https://forum.cockos.com/showthread....63#post2146763


The script still requires js_ReaScriptAPI .987, but I don't think it requires SWS anymore... Still, why would you not have SWS installed? Install it!

Eddittt... It do indeed require SWS,

Last edited by Dafarkias; 06-15-2019 at 03:50 PM.
Dafarkias is offline   Reply With Quote
Old 06-15-2019, 03:27 PM   #12
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

Quote:
Originally Posted by Dafarkias View Post
The script still requires js_ReaScriptAPI .987, but I don't think it requires SWS anymore... Still, why would you not have SWS installed? Install it!
reaper.BR_GetMouseCursorContext() is from SWS.
__________________
I'm no longer using Reaper or working on scripts for it. Sorry. :(
Default 5.0 Nitpicky Edition / GUI library for Lua scripts / Theory Helper / Radial Menu / Donate
Lokasenna is offline   Reply With Quote
Old 06-15-2019, 03:49 PM   #13
Dafarkias
Human being with feelings
 
Dafarkias's Avatar
 
Join Date: Feb 2019
Location: Southern Vermont
Posts: 864
Default

Quote:
Originally Posted by Lokasenna View Post
reaper.BR_GetMouseCursorContext() is from SWS.
Oops, haha! Updated!

I'm sure you're laughing at my feeble GUI attempts, Lokasenna.

Everyone knows your extensive expertise in the area
Dafarkias is offline   Reply With Quote
Old 06-15-2019, 04:36 PM   #14
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

If it works for you, it works.

Looking at the code, though, you might start to have trouble if the script (or a future project) gets any bigger. If you're interested in switching to my library I'm more than happy to give you a hand.
__________________
I'm no longer using Reaper or working on scripts for it. Sorry. :(
Default 5.0 Nitpicky Edition / GUI library for Lua scripts / Theory Helper / Radial Menu / Donate
Lokasenna is offline   Reply With Quote
Old 06-16-2019, 01:46 AM   #15
Dafarkias
Human being with feelings
 
Dafarkias's Avatar
 
Join Date: Feb 2019
Location: Southern Vermont
Posts: 864
Default

Quote:
Originally Posted by Lokasenna View Post
If it works for you, it works.

Looking at the code, though, you might start to have trouble if the script (or a future project) gets any bigger. If you're interested in switching to my library I'm more than happy to give you a hand.
That's very generous of you to say, being that you have in-depth tutorial on this site along with much other information regarding GUI programming.

My understanding is that in order to really optimize GUI programming, it needs to be structured using objects and classes, which I think are created in Lua using metatables. I briefly attempted to familiarize myself with metatables which promptly resulted in a headache. I'm sure your tutorial would probably explain it better to an average-dummy like myself, so maybe if I ever have the time or necessity I'll try again.

[Edit 6/16/19]

I also want to add a shoutout for Lokasenna, who, like X-Raym was awesome in the "production" of this script (that hopefully has no bugs and someone/anyone finds useful besides myself). I even PM'd him a couple times with time-wasting questions, which he replied to promptly and politely. Thanks Lok!

Last edited by Dafarkias; 06-16-2019 at 06:54 AM.
Dafarkias is offline   Reply With Quote
Old 06-16-2019, 07:22 AM   #16
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

Quote:
Originally Posted by Dafarkias View Post
My understanding is that in order to really optimize GUI programming, it needs to be structured using objects and classes, which I think are created in Lua using metatables. I briefly attempted to familiarize myself with metatables which promptly resulted in a headache. I'm sure your tutorial would probably explain it better to an average-dummy like myself, so maybe if I ever have the time or necessity I'll try again.
You really don't need to deal with that stuff yourself: https://forum.cockos.com/showthread.php?t=177772
__________________
I'm no longer using Reaper or working on scripts for it. Sorry. :(
Default 5.0 Nitpicky Edition / GUI library for Lua scripts / Theory Helper / Radial Menu / Donate
Lokasenna is offline   Reply With Quote
Old 06-17-2019, 07:18 AM   #17
Dafarkias
Human being with feelings
 
Dafarkias's Avatar
 
Join Date: Feb 2019
Location: Southern Vermont
Posts: 864
Default

Quote:
Originally Posted by Lokasenna View Post
You really don't need to deal with that stuff yourself: https://forum.cockos.com/showthread.php?t=177772
It's the principle. I'm a DIY at heart. :P
Dafarkias is offline   Reply With Quote
Old 06-17-2019, 11:43 AM   #18
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

Fair enough.

The short version:
- Most things in Lua are tables at some level
- Metatables let you fiddle with how a table behaves, even for things like "what happens if I try to multiply two of these together"
- Combined with the __index key, you can tell table A to look at table B if someone tries to access a key/function that it doesn't have. In other words, inheritance.

I don't want to clutter up your script thread too much - feel free to PM me.
__________________
I'm no longer using Reaper or working on scripts for it. Sorry. :(
Default 5.0 Nitpicky Edition / GUI library for Lua scripts / Theory Helper / Radial Menu / Donate

Last edited by Lokasenna; 06-17-2019 at 11:52 AM.
Lokasenna is offline   Reply With Quote
Old 06-17-2019, 02:45 PM   #19
Dafarkias
Human being with feelings
 
Dafarkias's Avatar
 
Join Date: Feb 2019
Location: Southern Vermont
Posts: 864
Default

Quote:
Originally Posted by Lokasenna View Post
Fair enough.

The short version:
- Most things in Lua are tables at some level
- Metatables let you fiddle with how a table behaves, even for things like "what happens if I try to multiply two of these together"
- Combined with the __index key, you can tell table A to look at table B if someone tries to access a key/function that it doesn't have. In other words, inheritance.

I don't want to clutter up your script thread too much - feel free to PM me.
You are too kind, my friend. I will more than likely take you up on that offer, some point in time.
Dafarkias is offline   Reply With Quote
Old 09-15-2019, 12:06 PM   #20
Dafarkias
Human being with feelings
 
Dafarkias's Avatar
 
Join Date: Feb 2019
Location: Southern Vermont
Posts: 864
Default v1.1

Details included in OG post.

Highlights include multi-item processing, and stretch-marker to dynamic midi conversion.

As always, please let me know if you find any bugs or alligators.

Hope you enjoy.
__________________

Support my feature request!

Last edited by Dafarkias; 09-15-2019 at 12:22 PM.
Dafarkias 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 03:54 AM.


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