Go Back   Cockos Incorporated Forums > REAPER Forums > ReaScript, JSFX, REAPER Plug-in Extensions, Developer Forum

Reply
 
Thread Tools Display Modes
Old 08-20-2022, 07:19 PM   #1
pcp
Human being with feelings
 
pcp's Avatar
 
Join Date: Oct 2021
Location: Singapore
Posts: 182
Default ReaClips (build and browse a personal sound/clip/loop library)


These scripts provide functionality for REAPER inspired by Ableton Live Clips and Studio One musicloops. Musical ideas and clips can be quickly saved from selected items, then browsed and organised in the Media Explorer, and loaded into an open project as exploded tracks or as subprojects.

(Edit) 'Open in Media Explorer' actions only working on Windows for the time being!

INSTALLATION

1. Install ReaPack and import my repo: https://github.com/s0u7h/pcp/raw/master/index.xml
2. Also requires ReaPack repos from cfillion, JS_ReaScriptAPI (both imported by default) and me2beats
3. Install SWS
4. Synchronize packages, Browse packages, Install ReaClips

USAGE

1. Select an item or items that you want to save, then run the action "Save ReaClip (selected items)"
2. This will prompt you to name the ReaClip (by default named and auto-saved with a time-stamp - thanks @paat!)
3. The script will create a folder called "ReaClips" under your default save path. You can change this name in the script user settings or use one of the other actions (e.g. "Save ReaClip to Beats folder").
4. There is an additional "save as" step due to limitations in REAPER's current API. When the dialog comes up, just hit 'Save' and 'Yes'. The option to include media should be enabled by default but maybe check this is the case on your system (option only needs setting once).
5. The script will then render the ReaClip with an audio preview, taking into account any sends or receives that affect the sound (so no need to select e.g. reverb sends or nested folder tracks, they will be automatically included), and then open the Media Explorer to show the most recent ReaClips.

NOTES

* The "Open Media Explorer to ReaClips path" can be triggered from the Main section or from the Media Explorer, and is useful to put on a toolbar button. This is a useful Edgemeal snippet, you can edit the user settings inside to target different folders/databases. Also if you don't want the "Save ReaClip" actions to open the media browser automatically, you can change this in the script's user settings.

* These are just project files (with audio preview) so you can browse through them and either use the native actions to Open project / Insert as subproject, or use the actions "Insert ReaClip at start" or "Insert ReaClip at edit cursor" to load and explode the file into your currently active project. Unlike other 'explode subproject' scripts this should carry over everything including automation items. With one exception...

* If your clip contains Melodyne or other ARA edits then the ReaClip shoud keep your edits intact. However if you use the 'Insert ReaClip' actions it'll immediately reanalyze and lose the edits. You'll also lose the project-wide data like tempo and time signature. In that case, use 'Insert as subproject' or 'Open project in new tab' instead.

* The 'Load ReaClip' actions create a "Temp" folder under your default save path which can be safely ignored or deleted. It doesn't contain media, just minimal project files that will be just a few KB each. Reason this is necessary is for the script to open and close a background project silently, without prompts.

REQUIREMENTS

* SWS
* JS_ReaScriptAPI
* ReaPack repos: cfillion for selecting send and receive tracks of selected tracks, and me2beats for his save/restore active project tabs.
* Reaper 6.58+ - may work weirdly or not at all on older versions, as it uses recent API.

What are ReaClips?

They're just project files, with automatically generated audio previews, that the 'Save ReaClip' action automatically saves in a specific folder under your default save path. Once saved, you don't require these scripts to access or edit them. They can be browsed in the media explorer and opened as projects, inserted as subprojects, or exploded onto tracks using one of the 'Load ReaClip' scripts.

Why not just use track templates?

Track templates still don't offer as much functionality as projects for this type of workflow. With ReaClips, you can do everything you can do with a project, such as preview with audio in the Media Explorer at different tempos and pitches, and have more useful ways to insert into an active project. And unlike track templates, ReaClips store the project-wide like tempo/time signature changes, and ARA data. If you use ARA plugins like Melodyne, you're probably familiar with the necessity to render stems/takes after making edits, in case the plugin reanalyses the source media. ReaClips for the most part work well with Melodyne, so this script can be used to 'archive' Melodyned clips.

BONUS HORRIFYING TOOLBAR ICONS

if you wish to add the Load/Save/Browse Reaclip actions to your Main or Media Explorer toolbar, you can use these horrifying icons, which should be installed by ReaPack.









Thanks to @paat for the auto-name-and-save script snippet and for suggesting this type of project-based workflow, Edgemeal for the media explorer script and BirdBird and Lemerchand for Discord advice, cfillion, SWS, me2beats and Julian Sader for code that makes up the bulk of this script's functionality.

Bug reports, improvements, forks, feedback welcome.

Last edited by pcp; 09-11-2022 at 09:42 AM.
pcp is offline   Reply With Quote
Old 08-22-2022, 11:57 PM   #2
pcp
Human being with feelings
 
pcp's Avatar
 
Join Date: Oct 2021
Location: Singapore
Posts: 182
Default

New version 1.0.8 on ReaPack - removed all the undo blocks from the 'Save...' scripts as they complicated the background project switching.
pcp is offline   Reply With Quote
Old 08-23-2022, 05:41 PM   #3
Win Conway
Human being with feelings
 
Join Date: Dec 2010
Posts: 3,826
Default

This looks slick, will be testing.
__________________
Stop posting huge images, smaller images or thumbnail, it's not rocket science!
Win Conway is offline   Reply With Quote
Old 09-08-2022, 03:07 AM   #4
paat
Human being with feelings
 
Join Date: Oct 2016
Posts: 225
Default

I’ll play with this over the weekend, it looks super cool. Thanks for working on it and sharing it.

The scripts save clips to folders - but I wonder, would it be possible to add clips to a media explorer database?
paat is offline   Reply With Quote
Old 09-08-2022, 08:53 AM   #5
pcp
Human being with feelings
 
pcp's Avatar
 
Join Date: Oct 2021
Location: Singapore
Posts: 182
Default

Cool thanks paat, be very interested to know how you get on and if you've any thoughts for changes or whatnot. One of the changes I made to your original action is to run another "Save as..." just to force the media to save with the project file. That's important to me, as it keeps the ReaClip encapsulated with any audio and separate from whatever media sources it originates from but it does mean there's an extra, annoying dialogue that needs clicking through. I actually did a feature request to add the necessary flags in the API ('save with media' is possible for track templates but not for projects) but I wonder if there's any way around it with the current API? I did try various combinations of the noprompt workaround you discovered but couldn't get it to work for that last save unfortunately...

I can add opening to the database as an option in the next version. You could just change this line in the "reaclip_core" script:

Code:
local reaclips_folder = savepath .. "/" .. reaclips_path
to

Code:
local reaclips_folder = savepath .. "/" .. "DB: " .. reaclips_path
and it should work assuming you've created a database from that folder (maybe add a "Scan database for new files" command after it too).

The slightly tweaked edgemeal script which I'm using to open the MX at the ReaClips path is in my repo too as "Script: pcp_Open Media Explorer to ReaClips path (edgemeal snippet).lua", you could also change

Code:
local folder = "ReaClips"
to

Code:
local folder = "DB: ReaClips"
(or whatever your folder is called). This action is super handy as you can put it on your toolbar / shortcuts in both Main and MX and it'll bring you to your database filtered by rpp and sorted by last modified.
pcp is offline   Reply With Quote
Old 09-09-2022, 09:40 PM   #6
paat
Human being with feelings
 
Join Date: Oct 2016
Posts: 225
Default

Alright this is super cool. Way to go

Some feedback / ideas:

1. The script checks if the current project is saved, but it doesn't seem to work, or matter. If I run it on an unsaved project and hit "cancel", ReaClip happily proceeds and creates the clip as expected. So it seems maybe that check could be removed?

2. "Open media explorer to ReaClips dir" doesn't work on MacOS 10.15. Might just be a Mac thing since I see it was tested on Windows. I can try to poke around a bit, just though I'd let you know.

3. One possibility to avoid the forced save-as might be to select all items in the source media tab of project bay, and run "Copy file to project media directory"? I don't see an action for that so don't know if it's available in scripting - but the old ultraschall repo has a line
Code:
C99F330DE98CD983=[projbay]Copy file to project media directory
so maybe it's possible to run that command somehow?

4. Exploding clips is great... I wonder if it would be possible to explode media items in place? Because then you could sequence a bunch of these clips on the timeline, and then select them all and explode them.

---

Unrelated: What's your workflow for developing these scripts, and including them on ReaPack? Do you just have a git repo on the machine you develop on, and the scripts run directly from there and there's no ReaPack involved? I've always been curious about the workflow when developing scripts that will ultimately end up on ReaPack. And maybe if I learn that I can clone and contribute.

To expand on that a bit: if I were to clone the repo, how would I add all the scripts to Reaper? Is it manually loading them one-at-a-time with Actions->New action->Load ReaScript?

Last edited by paat; 09-09-2022 at 10:36 PM.
paat is offline   Reply With Quote
Old 09-11-2022, 09:37 AM   #7
pcp
Human being with feelings
 
pcp's Avatar
 
Join Date: Oct 2021
Location: Singapore
Posts: 182
Default

Thanks paat!

Quote:
Originally Posted by paat View Post
1. The script checks if the current project is saved, but it doesn't seem to work, or matter. If I run it on an unsaved project and hit "cancel", ReaClip happily proceeds and creates the clip as expected. So it seems maybe that check could be removed?
Good point, I over-nagged the prompt to save mainly because I found that this script is quite a good stress-tester of non-thread-safe plugins, since there were a couple of VSTs like Reason Rack which consistently crashed Reaper when I tried to save a ReaClip that included them (something to do with the project tab switching I think). Setting those plugins to run as a dedicated process fixed the issue, and so I thought, as long as this is suggesting to save any 'dirty' projects first, it's not really a problem (maybe even a good thing) if it exposes sketchy plugins, since they can easily be fixed in their compatibility settings. But it is a bit annoying, I will make the save project nag optional in the next version and have it so that cancelling out of it cancels out from saving a ReaClip too.

Quote:
Originally Posted by paat View Post
2. "Open media explorer to ReaClips dir" doesn't work on MacOS 10.15. Might just be a Mac thing since I see it was tested on Windows. I can try to poke around a bit, just though I'd let you know.
Ah damn, yes, I'm on Windows and totally overlooked that the Edgemeal JS_Reascript commands are using a Microsoft API. I wonder if there's a way to do this on Mac and Linux? For now I guess the "Open to MX" part of the script is Windows-only which is a shame.

Quote:
Originally Posted by paat View Post
3. One possibility to avoid the forced save-as might be to select all items in the source media tab of project bay, and run "Copy file to project media directory"? I don't see an action for that so don't know if it's available in scripting - but the old ultraschall repo has a line
Code:
C99F330DE98CD983=[projbay]Copy file to project media  directory
so maybe it's possible to run that command somehow?
That's interesting I'll check that out, would be great if Ultraschall could do this as the native API can't do much with the project bay. I vaguely recall looking at this before and seeing a post by Mespotine saying that she'd given up on a 'Save with media ' action for now because there were too many edge cases, but I may have misinterpreted, and didn't see that action.

Quote:
Originally Posted by paat View Post
4. Exploding clips is great... I wonder if it would be possible to explode media items in place? Because then you could sequence a bunch of these clips on the timeline, and then select them all and explode them.
Hmm yeah should be doable by looping through the selected items and just inserting at the edit cursor for each item then deleting that item? It'd add new tracks under the existing ones rather than replacing items on the tracks in that case... or do you have a different workflow in mind?

Quote:
Originally Posted by paat View Post
Unrelated: What's your workflow for developing these scripts, and including them on ReaPack? Do you just have a git repo on the machine you develop on, and the scripts run directly from there and there's no ReaPack involved? I've always been curious about the workflow when developing scripts that will ultimately end up on ReaPack. And maybe if I learn that I can clone and contribute.

To expand on that a bit: if I were to clone the repo, how would I add all the scripts to Reaper? Is it manually loading them one-at-a-time with Actions->New action->Load ReaScript?
I'm no Github or ReaPack expert but I found cfillion's template repo to be relatively straightforward, it comes pre-configured with Github Actions to validate and diagnose issues. Between MonkeyBars' guide and the ReaPack docs I managed to get it working pretty quickly so I'm sure you'll have no problem!

I just edit directly from my Reaper scripts folder, using GitHub Desktop to push changes. (Could also push using the git extension in VS Code or any IDE, but I'm basic and prefer the simplicity of just opening GitHub desktop and pressing "Push" twice.)

I didn't import my ReaPack repo into my main Reaper install though, I have a separate portable install to test any ReaPack changes, which I'm using 'vanilla' except for the dependencies I'm using. This means I can edit any scripts in my main install using either the internal Reaper IDE or VS Code, just like if I was not planning to share them, and can sync everything up to GitHub with the desktop app at any time, and it won't trigger a change on ReaPack until I change the version number in the script header (or add an -amend flag, which I haven't tried yet). I'm sure there's more efficient/expert ways to do all this though, but it works for me and is low-maintenance enough not to melt my brain.

Not sure of the easiest way wrt cloning etc but would be great. Whatever works best - I could make you a collaborator on the repo, or you could fork your own version if you prefer?
pcp is offline   Reply With Quote
Old 11-22-2022, 12:53 PM   #8
Hipox
Human being with feelings
 
Join Date: Apr 2022
Posts: 204
Default

You ARE a hero!
I was trying to build something like this, but was struggling with it to work properly with all kinds of bells and whistles.
This works perfectly without unnecessary hustle that kills the creative flow.
So cool, thank you!

Is there a way to thank you wih a donate?
Hipox is offline   Reply With Quote
Old 12-28-2022, 11:20 PM   #9
hits_of_sunshine
Human being with feelings
 
Join Date: Mar 2017
Location: Tokyo
Posts: 73
Default

What a brilliant ReaScript is this! Thank you.
hits_of_sunshine is offline   Reply With Quote
Old 12-29-2022, 02:42 AM   #10
TonE
Human being with feelings
 
Join Date: Feb 2009
Location: Reaper HAS send control via midi !!!
Posts: 4,032
Default

Thanks for sharing, horryfying icon like in Cakewalk 3... cool.
TonE is offline   Reply With Quote
Old 11-19-2023, 03:20 AM   #11
hits_of_sunshine
Human being with feelings
 
Join Date: Mar 2017
Location: Tokyo
Posts: 73
Default

After updating Reaper to 7, Reaper frequently crashes when saving ReaClips. It feels like resources are suddenly running out.
hits_of_sunshine 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 02:13 AM.


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