Old 05-19-2019, 04:56 AM   #1
Zamyen
Human being with feelings
 
Join Date: Dec 2008
Posts: 51
Default Load Track Template by name

I’ve been searching in the SWS track template commands, and was wondering if there was such a functionality as this:

Create a blank track, name it ‘Violins - Legato’

Then run a SWS command to load the track template named ‘Violins - Legato’ which I saved earlier


This way I could load a huge orchestral template with simply the names on each empty track, then assign a key command to load that track template only when it is needed.

Even better would be to also autosave all the tracks at once as Track Templates with names matching the tracks.

Can it be done with the existing extensions or a custom script?

TLDR - A command to load the track template by matching the text name currently on the track
Zamyen is offline   Reply With Quote
Old 05-19-2019, 05:25 AM   #2
cutnpaste
Human being with feelings
 
Join Date: Jul 2015
Posts: 265
Default

Quote:
Originally Posted by Zamyen View Post
I’ve been searching in the SWS track template commands, and was wondering if there was such a functionality as this:

Create a blank track, name it ‘Violins - Legato’

Then run a SWS command to load the track template named ‘Violins - Legato’ which I saved earlier


This way I could load a huge orchestral template with simply the names on each empty track, then assign a key command to load that track template only when it is needed.

Even better would be to also autosave all the tracks at once as Track Templates with names matching the tracks.

Can it be done with the existing extensions or a custom script?

TLDR - A command to load the track template by matching the text name currently on the track
See track templates in manual reaper can do what your asking without extensions.
cutnpaste is online now   Reply With Quote
Old 05-19-2019, 05:42 AM   #3
Zamyen
Human being with feelings
 
Join Date: Dec 2008
Posts: 51
Default

It’s possible to save the track template, yes.
It’s possible to load a track template from a file, yes.

But as far as I can see there is no key command/SWS action to load/reload the corresponding Track template from the Name of the empty track.

Last edited by Zamyen; 05-19-2019 at 05:55 AM.
Zamyen is offline   Reply With Quote
Old 05-19-2019, 09:17 AM   #4
Zamyen
Human being with feelings
 
Join Date: Dec 2008
Posts: 51
Default

For anyone familiar with Cubase there it is possible to load a track from a track preset, then delete the VST (freeing memory) then clicking the Track Preset reload button to reinitialise the track.

The reason for doing it is when you have 100’s of tracks and can deactivate VST and save both loading times and also the size of the save file (VST state would be handled by the track presets so freeing up space in the project file).

Is there another way to do this? (Simply offlining or disabling the effect in Reaper doesn’t quite achieve this - it fixes the load time issue but not the save file bloat).
Zamyen is offline   Reply With Quote
Old 05-19-2019, 09:55 AM   #5
heda
Human being with feelings
 
heda's Avatar
 
Join Date: Jun 2012
Location: Spain
Posts: 5,183
Default

+1
Offloading vst data from the rpp files linking them to external fx chain files would the best thing to happen in REAPER 6.
__________________
HeDaScripts for REAPER
heda is offline   Reply With Quote
Old 05-19-2019, 04:18 PM   #6
Zamyen
Human being with feelings
 
Join Date: Dec 2008
Posts: 51
Default

Thanks Heda, I noticed you have a very useful library of scripts you have created for Reaper.

Would you think it is possible for me to create such a script using Lua /API ?

The script would run this command:
Recurse through the selected tracks
Check the Track Template folder for a matching Track template with exact Name match (ie Track name + Reaper template file extension)
Load the Track Template for each track as defined

I am not sure if the API would support this, the only script I have written so far in Lua are processing Midi, but if it’s possible/feasible I will look into writing this. It seems like a reasonably reaperesque solution given it’s potential simplicity and leveraging the existing track templates if the load commands are exposed via Api.
Zamyen is offline   Reply With Quote
Old 05-19-2019, 06:01 PM   #7
hopi
Human being with feelings
 
hopi's Avatar
 
Join Date: Oct 2008
Location: Right Hear
Posts: 14,444
Default

it is not clear to me why you want to load a track template to an existing empty track...

the whole point of trk templates is you load them and get them as a new track....

if you want a key command to load a given saved trk template you can do that...

However you can also come kind of close to what you want to do... but it would be best to make a toolbar for it so you can give that names...

you'll have to edit the S&M.ini file to give you more 'slots' than the default it comes with... and then you will have to assign your trk templates to those slots, so each slot has a number...

then there will be a set of SWS/S&M actions in the heading of Resources in the actions list...
that are like.... Apply track template to select tracks slot1
etc, etc...
and also one that will prompt for the slot
you have to create the list of which trk templates are in which slot # in the S&M.ini file as well...

you want to look at that .ini file near the end of it... use Notepad++ as the text editor to work in it... IMO
hopefully this will get you started... check back if you need more
__________________
...should be fixed for the next build... http://tinyurl.com/cr7o7yl
https://soundcloud.com/hopikiva/angel-rain
hopi is online now   Reply With Quote
Old 05-19-2019, 06:13 PM   #8
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Posts: 2,346
Default

Hey Hopi!

Read here why we need "apply template to existing track":
https://forums.cockos.com/showpost.p...&postcount=124

And also this one:
https://forums.cockos.com/showpost.p...&postcount=125
__________________
My Reascripts forum thread | My Reascripts on GitHub | Stephan Römer - film composer
If you wish to donate for my scripts: please consider an organization like: animal shelter, doctors without borders, UNICEF, etc...
_Stevie_ is online now   Reply With Quote
Old 05-20-2019, 03:56 AM   #9
heda
Human being with feelings
 
heda's Avatar
 
Join Date: Jun 2012
Location: Spain
Posts: 5,183
Default

Yes it is totally possible Zamyen

making some progress
__________________
HeDaScripts for REAPER
heda is offline   Reply With Quote
Old 05-20-2019, 04:24 AM   #10
carbon
Human being with feelings
 
carbon's Avatar
 
Join Date: Feb 2008
Location: Eesti
Posts: 2,376
Default

Quote:
Originally Posted by hopi View Post
it is not clear to me why you want to load a track template to an existing empty track...

the whole point of trk templates is you load them and get them as a new track....
Probably "Load FX chain by name to an existing track" could do something similar - if existed.
__________________
KasparTORN
carbon is offline   Reply With Quote
Old 05-20-2019, 07:07 AM   #11
hopi
Human being with feelings
 
hopi's Avatar
 
Join Date: Oct 2008
Location: Right Hear
Posts: 14,444
Default

OK well if anyone can sort this out it will be HeDa....
__________________
...should be fixed for the next build... http://tinyurl.com/cr7o7yl
https://soundcloud.com/hopikiva/angel-rain
hopi is online now   Reply With Quote
Old 05-20-2019, 03:12 PM   #12
Zamyen
Human being with feelings
 
Join Date: Dec 2008
Posts: 51
Default

Thanks Heda, that looks brilliant.

Reading the other comments, if "Save All FX as chain" and "Load FX chain" are exposed in the API, this would be another solution instead of track templates (which introduce routing complications).

Are there such commands I wonder?

(I know they exist in the FX chain menu when clicking manually so there is always hope)
Zamyen is offline   Reply With Quote
Old 05-20-2019, 03:15 PM   #13
heda
Human being with feelings
 
heda's Avatar
 
Join Date: Jun 2012
Location: Spain
Posts: 5,183
Default

Quote:
Originally Posted by Zamyen View Post
Thanks Heda, that looks brilliant.

Reading the other comments, if "Save All FX as chain" and "Load FX chain" are exposed in the API, this would be another solution instead of track templates (which introduce routing complications).

Are there such commands I wonder?

(I know they exist in the FX chain menu when clicking manually so there is always hope)
It works with FX Chains. I've published a working update to Track Templates script here https://forum.cockos.com/showpost.ph...&postcount=136
I may have to rename the script since it can also work with FX Chains (it was only track templates first) Maybe.. HeDaBrowser? I don't know.

There is FX Chain load API, but I haven't found FX Chain save. Unless it would be just saving the chunk data to the file, which would be slower but possible.
__________________
HeDaScripts for REAPER
heda is offline   Reply With Quote
Old 05-20-2019, 03:29 PM   #14
Zamyen
Human being with feelings
 
Join Date: Dec 2008
Posts: 51
Default

Thanks again Heda,

I found this script by MPL, which might be close to what you mentioned about saving Chunks:

https://github.com/MichaelPilyavskiy...X%20chains.lua
Zamyen is offline   Reply With Quote
Old 05-20-2019, 04:39 PM   #15
heda
Human being with feelings
 
heda's Avatar
 
Join Date: Jun 2012
Location: Spain
Posts: 5,183
Default

Quote:
Originally Posted by Zamyen View Post
Thanks again Heda,

I found this script by MPL, which might be close to what you mentioned about saving Chunks:

https://github.com/MichaelPilyavskiy...X%20chains.lua
yes... It is always delicate to work with chunks. an API function would be the best and fastest. mpl is awesome
__________________
HeDaScripts for REAPER
heda is offline   Reply With Quote
Old 05-22-2019, 09:33 PM   #16
TabbyCat
Human being with feelings
 
TabbyCat's Avatar
 
Join Date: May 2019
Location: Los Angeles, CA
Posts: 9
Default

I'm using super-large templates, and this is what I do.

I create a track exactly as I want it - FX, samples, whatever. Then I have a custom action that does this:

Code:
Track: Mute tracks
Track: Set all FX offline for selected tracks
Track: Lock track controls
This removes all CPU load, and the "lock" action dims the track so it's obvious it's not active.

I can then search for any track in the Track Manager (eg "Vln I SHORTS") and with a button click I have another custom action that enables it.

Is there any reason this kind of thing isn't viable? I did the same thing in Cubase, except I used its native track enable/disable functionality.
TabbyCat is offline   Reply With Quote
Old 05-22-2019, 09:37 PM   #17
TabbyCat
Human being with feelings
 
TabbyCat's Avatar
 
Join Date: May 2019
Location: Los Angeles, CA
Posts: 9
Default

Also - Track Templates can actually save an entire section (say, all Vln I) with all their bussing + FX etc - so you could break your template into sections and use the Media Explorer to load a section (the Media Explorer has track template search ability).

I know these are solutions that are slightly different than what you posted, but I'm dealing with the same issue and these approaches are working for me - YMMV.
TabbyCat is offline   Reply With Quote
Old 05-22-2019, 11:44 PM   #18
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Posts: 2,346
Default

Quote:
Originally Posted by TabbyCat View Post
I
Is there any reason this kind of thing isn't viable? I did the same thing in Cubase, except I used its native track enable/disable functionality.
Yes, Reaper becomes really slow with more than 1000 tracks (the GUI gets sluggish).
Plus, the tracks aren't actually deactivated, they still consume some CPU.
__________________
My Reascripts forum thread | My Reascripts on GitHub | Stephan Römer - film composer
If you wish to donate for my scripts: please consider an organization like: animal shelter, doctors without borders, UNICEF, etc...

Last edited by _Stevie_; 05-23-2019 at 12:50 AM.
_Stevie_ is online now   Reply With Quote
Old 05-23-2019, 02:18 AM   #19
heda
Human being with feelings
 
heda's Avatar
 
Join Date: Jun 2012
Location: Spain
Posts: 5,183
Default

Quote:
Originally Posted by TabbyCat View Post
Is there any reason this kind of thing isn't viable? I did the same thing in Cubase, except I used its native track enable/disable functionality.

Even with plugins off loaded, the plugin data is still saved in the project which makes slow project saving times. That is why the idea is to off load the plugins to external fx chain.

Quote:
Originally Posted by _Stevie_ View Post
Yes, Reaper becomes really slow with more than 1000 tracks (the GUI gets sluggish).
Plus, the tracks aren't actually deactivated, they still consume some CPU.
With thousands of tracks it gets slow even without any plugins https://forum.cockos.com/showthread.php?t=220757
__________________
HeDaScripts for REAPER
heda is offline   Reply With Quote
Old 05-23-2019, 02:26 AM   #20
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Posts: 2,346
Default

Exactly HeDa. 1000 empty tracks will already show the issue
__________________
My Reascripts forum thread | My Reascripts on GitHub | Stephan Römer - film composer
If you wish to donate for my scripts: please consider an organization like: animal shelter, doctors without borders, UNICEF, etc...
_Stevie_ is online now   Reply With Quote
Old 05-23-2019, 02:31 AM   #21
heda
Human being with feelings
 
heda's Avatar
 
Join Date: Jun 2012
Location: Spain
Posts: 5,183
Default

but less than if the tracks have off-loaded plugins? I haven't tested. Still, project saving times will be worse with plugins off-loaded. That's for sure.
__________________
HeDaScripts for REAPER
heda is offline   Reply With Quote
Old 05-23-2019, 04:39 PM   #22
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Posts: 2,346
Default

The lag is unfortunately still noticeable with such a huge amount of tracks.
And yeah, I concur, the loading and saving times are getting worse, as well.
Not to speak about the space that a project will take.
__________________
My Reascripts forum thread | My Reascripts on GitHub | Stephan Römer - film composer
If you wish to donate for my scripts: please consider an organization like: animal shelter, doctors without borders, UNICEF, etc...
_Stevie_ is online now   Reply With Quote
Old 05-24-2019, 07:04 PM   #23
mpl
Human being with feelings
 
Join Date: Oct 2013
Location: Moscow, Russia
Posts: 2,423
Default

Some days ago I added version for loading FX chains by name with overriding online and bypass states (easier to modify) in loaded chunk, but I'm not at PC this week, so can't check.

Edit: oh and seems I forget to uncomment offline code in github so this is how it should looks like

Code:
-- @description Load selected tracks FX chains by name, offline mode
-- @version 1.0
-- @author MPL
-- @website http://forum.cockos.com/showthread.php?p=2137484
-- @changelog
--    + init

  function ReplaceFXChunk(track, content)
    
    local _, chunk = GetTrackStateChunk(track, '')
    -- extract input FX chain
      local rec_chain_chunk = ''
      local rec_chain_cnt = TrackFX_GetRecCount( track )
      if rec_chain_cnt ~= 0 then
        local lastfxGUID = literalize( TrackFX_GetFXGUID( track, 0x1000000 + rec_chain_cnt -1 ))
        rec_chain_chunk = chunk:match('<FXCHAIN_REC.*FXID '..lastfxGUID..'[\r\n]+WAK %d[\r\n]+>') 
      end
    
    local full_chunk = chunk:match('<FXCHAIN.*WAK %d[\r\n]+>')
    if not full_chunk then full_chunk = chunk:match('<FXCHAIN.*>') end
    if rec_chain_cnt ~= 0 then full_chunk = chunk:match('<FXCHAIN.*WAK %d[\r\n]+>[\r\n]+>') end
    
    local out_chunk = chunk:gsub(literalize(full_chunk),
[[    
<FXCHAIN
WNDRECT 100 100 400 400
SHOW 0
LASTSEL 0
DOCKED 0    

]]..
content..'\n'..
rec_chain_chunk..'\n'..'>'  )

    SetTrackStateChunk(track, out_chunk, false) 
    

  end
  ---------------------------------------------------------------------
  function MakeChainOffline(content)
    return content:gsub('BYPASS %d %d %d', 'BYPASS 0 1 0')
  end
  ---------------------------------------------------------------------
  function main()
    -- check are tracks selected
      local cnt_seltr = CountSelectedTracks(0)
      if cnt_seltr == 0 then MB('There aren`t selected tracks', 'Error', 0) return end   
      
    -- ask for input path
      local fsttr = GetSelectedTrack(0,0)
      local ret, fsttr_name = GetTrackName( fsttr )
      local retval, fn = reaper.GetUserFileNameForRead(fsttr_name..'.RfxChain', 'Select FX chain for selected track(s)', 'RfxChain' )
      if not retval then return end 
      local search_path = GetParentFolder(fn)
      
      for i = 1, cnt_seltr do
        local track = GetSelectedTrack(0,i-1)
        local ret, tr_name = GetTrackName( track )
        if tr_name ~= '' then
          local f = io.open(search_path..'/'..tr_name..'.RfxChain')
          if f then
            local content = f:read('a')
            f:close()
            content = MakeChainOffline(content)
            ReplaceFXChunk(track, content)
          end
        end
      end
      
  end
  ---------------------------------------------------------------------
  function CheckFunctions(str_func) local SEfunc_path = reaper.GetResourcePath()..'/Scripts/MPL Scripts/Functions/mpl_Various_functions.lua' local f = io.open(SEfunc_path, 'r')  if f then f:close() dofile(SEfunc_path) if not _G[str_func] then  reaper.MB('Update '..SEfunc_path:gsub('%\\', '/')..' to newer version', '', 0) else return true end  else reaper.MB(SEfunc_path:gsub('%\\', '/')..' missing', '', 0) end   end 
  --------------------------------------------------------------------  
  local ret = CheckFunctions('VF_CalibrateFont') 
  local ret2 = VF_CheckReaperVrs(5.95,true)    
  if ret and ret2 then main() end
__________________
SoundCloud | MPL Scripts discussion | ReaPack | Donate

Last edited by mpl; 05-24-2019 at 07:11 PM.
mpl is offline   Reply With Quote
Old 05-31-2019, 11:47 AM   #24
Neutronic
Human being with feelings
 
Neutronic's Avatar
 
Join Date: Sep 2013
Posts: 312
Default

@Zamyen and everyone interested in the topic:
I've added the track template applying ability to my "Quick add..." script in the new v1.2 update.
The applying can be done in two ways, one of which follows the OP request (see demo below).

Check out the update post and the script's thread for more information.

Neutronic 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 06:41 AM.


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