Reaper: Effortlessly Print Hardware to Multiple Tracks
Jun 22, 2024 17:30:58 GMT -6
svart, EmRR, and 7 more like this
Post by copperx on Jun 22, 2024 17:30:58 GMT -6
I'm here advertising my Reaper script again (I've made some improvements), just because it saves me a lot of time and it might save your time too.
I've created a handy JSFX script called "Print to Hardware" to simplify a common workflow: applying hardware inserts to multiple tracks within your project. Whether you're dialing in a compressor on multiple vocal takes or running your guitar tracks through your favorite analog EQ, this script makes it a breeze.
What It Does
The script lets you "print" the effect of your hardware insert onto multiple selected tracks at once. For instance, if you've found the perfect settings on your LA-3A for one guitar track, you can easily apply those settings to all your other guitar tracks. I often apply the same 1176 settings to the main and overdubbed vocals. You can also use it to use a mono hardware device as a multi-mono device! It's a great time-saver and ensures consistent processing across your mix.
I've created a handy JSFX script called "Print to Hardware" to simplify a common workflow: applying hardware inserts to multiple tracks within your project. Whether you're dialing in a compressor on multiple vocal takes or running your guitar tracks through your favorite analog EQ, this script makes it a breeze.
What It Does
The script lets you "print" the effect of your hardware insert onto multiple selected tracks at once. For instance, if you've found the perfect settings on your LA-3A for one guitar track, you can easily apply those settings to all your other guitar tracks. I often apply the same 1176 settings to the main and overdubbed vocals. You can also use it to use a mono hardware device as a multi-mono device! It's a great time-saver and ensures consistent processing across your mix.
How It Works
1. Setup:
- Open ReaInsert on the track you've dialed in your hardware.
- Ensure your I/O is set up correctly and latency compensation is applied.
- Save this ReaInsert preset with the exact name "PrintHW".
1. Setup:
- Open ReaInsert on the track you've dialed in your hardware.
- Ensure your I/O is set up correctly and latency compensation is applied.
- Save this ReaInsert preset with the exact name "PrintHW".
2. Run the Script:
- Remove the ReaInsert from all tracks.
- Select all the tracks you want to process, along with the desired time selection.
- Run the "Print to Hardware" script (I've mapped it to a custom toolbar button for convenience on my Reaper installation).
The script will automatically record the output of each selected track through your hardware, applying the settings from your "PrintHW" preset. Simple!
Notes:
- Remove the ReaInsert from all tracks.
- Select all the tracks you want to process, along with the desired time selection.
- Run the "Print to Hardware" script (I've mapped it to a custom toolbar button for convenience on my Reaper installation).
The script will automatically record the output of each selected track through your hardware, applying the settings from your "PrintHW" preset. Simple!
Notes:
- The script uses a function to check whether the play head has gone past the time selection that is provided by SWS, so you need to install www.sws-extension.org/
- Checklist: The script includes a built-in checklist to ensure your I/O and preset are correctly configured.
- Checklist: The script includes a built-in checklist to ensure your I/O and preset are correctly configured.
- The script creates a single undo point, so that you can easily undo the entire process.
- Error Handling: The script has error checks to make sure you've selected tracks and a time range.
- Original Settings Restored: The script will revert your track input, volume, and pan settings to their original state after printing.
- Original Settings Restored: The script will revert your track input, volume, and pan settings to their original state after printing.
- To make it easy to remember the settings you used in your HW, I recommend using the Snapshot 2 VST so you can upload pictures onto your track non-lethal-applications.com/products/snapshot
Code (JSFX):
-- Print to hardware script by copperx
-- Function to check for ReaInsert with "PrintHW" preset in any track and return details
local function checkForReaInsertWithPresetAndListDetails()
local trackCount = reaper.CountTracks(0)
local offendingTracks = {}
for i = 0, trackCount - 1 do
local track = reaper.GetTrack(0, i)
local fxCount = reaper.TrackFX_GetCount(track)
for j = 0, fxCount - 1 do
local retval, fxName = reaper.TrackFX_GetFXName(track, j, "")
if fxName:find("ReaInsert") then
local _, presetName = reaper.TrackFX_GetPreset(track, j, "")
if presetName == "PrintHW" then
-- Get track number (1-based) and name, store in table
local trackNumber = i + 1
local _, trackName = reaper.GetTrackName(track, "")
trackName = trackName ~= "" and trackName or "Unnamed"
table.insert(offendingTracks, {trackNumber = trackNumber, trackName = trackName})
end
end
end
end
return offendingTracks
end
-- Main Script
local offendingTracks = checkForReaInsertWithPresetAndListDetails()
if #offendingTracks > 0 then
local message = "Error: ReaInsert with 'PrintHW' preset is already loaded in the project on the following track(s):\n"
for _, trackDetails in ipairs(offendingTracks) do
message = message .. string.format("Track %d: %s\n", trackDetails.trackNumber, trackDetails.trackName)
end
reaper.ShowMessageBox(message, "Print to hardware", 0)
return -- Stop script execution
end
-- Continue with the rest of the script if no offending tracks are found
-- Error checking: Is there a time selection?
local s, e = reaper.GetSet_LoopTimeRange(false, false, 0, 0, false)
if s == e then
reaper.ShowMessageBox("Error: Please select a time range to print to hardware.", "Print to hardware", 0)
return
end
-- Error checking: Are any tracks selected?
local n = reaper.CountSelectedTracks(0) -- how many selected tracks?
if n == 0 then
reaper.ShowMessageBox("Error: Please select at least one track to print to hardware.", "Print to hardware", 0)
return
end
reaper.ShowMessageBox("PRINTING TRACKS TO HARDWARE\n\n-- CHECKLIST --\nMake sure you have:\n\n1) set the right I/O channels and latency compensation values on ReaInsert, and\n2) that you have saved said latency compensation onto preset name \"PrintHW\".", "Print to hardware: CHECKLIST", 0)
num_tracks = reaper.CountSelectedTracks(0) -- how many selected tracks?
local ans = reaper.ShowMessageBox("Print " .. num_tracks .. " track(s) to hardware? (Remove all ReaInserts!)", "Reascript", 1)
if ans == 1 then
reaper.Undo_BeginBlock() -- start undo chunk
for current_track = 0, num_tracks-1, 1 do
reaper.Main_OnCommand(1016, 1) -- stop transport
reaper.Main_OnCommand(40491, 1) -- disable arm record for all tracks
local track = reaper.GetSelectedTrack(0, current_track) -- get one track
-- Store original input
local originalInput = reaper.GetMediaTrackInfo_Value(track, "I_RECINPUT")
-- Store original volume and pan settings
local originalVolume = reaper.GetMediaTrackInfo_Value(track, "D_VOL")
local originalPan = reaper.GetMediaTrackInfo_Value(track, "D_PAN")
-- Set volume to nominal and pan to center
reaper.SetMediaTrackInfo_Value(track, "D_VOL", 1)
reaper.SetMediaTrackInfo_Value(track, "D_PAN", 0)
-- Set track to no input
reaper.SetMediaTrackInfo_Value(track, "I_RECINPUT", -1)
reaper.SetMediaTrackInfo_Value(track, "I_RECARM", 1) -- set track to record arm
reaper.SetMediaTrackInfo_Value(track, "I_RECMODE", 5) -- set track to record output
reaper.SetMediaTrackInfo_Value(track, "I_RECMON", 1) -- input monitoring on
reaper.SetMediaTrackInfo_Value(track, "I_RECMONITEMS", 1) -- monitor items
local fxpos = reaper.TrackFX_AddByName(track, "ReaInsert", false, 1) -- add ReaInsert
local succ = reaper.TrackFX_SetPreset(track, fxpos, "PrintHW") -- set ReaInsert's preset to PrintHW
if succ == false then
reaper.ShowMessageBox("Error: You must have a ReaInsert preset named \"PrintHW\". Operation aborted.", "", 0)
return
end
local stop_record_end = reaper.GetToggleCommandState(41834) -- are we going to stop at the end of the loop?
if stop_record_end == 0 then
reaper.Main_OnCommand(41834, 1) -- toggle stop recording at end of loop
disable_at_end = true -- remember this so that we disable it on exit
end
start_time, end_time = reaper.GetSet_LoopTimeRange2(0, false, false, 0, 0, false) -- get time selection
reaper.SetEditCurPos(start_time, false, false) -- go to beginning of loop
-- RECORD
reaper.Main_OnCommand(1013, 1) -- start recording
local wait_command_id = reaper.NamedCommandLookup("_SWS_LOOPWAIT")
reaper.Main_OnCommand(wait_command_id,0)
reaper.Main_OnCommand(1016, 1) -- stop transport
-- END RECORD
reaper.TrackFX_Delete(track, fxpos) -- remove ReaInsert
-- Restore original input, volume, and pan settings
reaper.SetMediaTrackInfo_Value(track, "I_RECINPUT", originalInput)
reaper.SetMediaTrackInfo_Value(track, "D_VOL", originalVolume)
reaper.SetMediaTrackInfo_Value(track, "D_PAN", originalPan)
reaper.Main_OnCommand(40491, 1) -- disable arm record for all tracks
if disable_at_end then
reaper.Main_OnCommand(41834, 1) -- toggle stop recording at end of selection
end
end
reaper.Undo_EndBlock("Print track(s) to hardware",0)
end