1-- Generate the Clover Recorder session template.
2--
3-- Creates a fresh project with a single record-armed MIDI track listening to
4-- "All MIDI Inputs / All Channels" (so any keyboard works), then saves it to
5-- the template path. The recorder copies this per session. Open it in REAPER
6-- afterwards to add your instrument / tweak settings and re-save — it's yours.
7--
8-- Run via: REAPER -nonewinst generate_recorder_template.lua
9
10local template_path = "/Volumes/Documents/Recorder Template.rpp"
11
12-- Work in a fresh project tab so we never disturb whatever is already open.
13reaper.Main_OnCommand(40859, 0) -- New project tab
14
15reaper.InsertTrackAtIndex(0, false)
16local track = reaper.GetTrack(0, 0)
17reaper.GetSetMediaTrackInfo_String(track, "P_NAME", "Improv MIDI", true)
18reaper.SetMediaTrackInfo_Value(track, "I_RECARM", 1)
19-- MIDI record input: 4096 + (device<<5) + channel; device 62 = all MIDI inputs,
20-- channel 0 = omni (all channels). See REAPER API docs for I_RECINPUT.
21reaper.SetMediaTrackInfo_Value(track, "I_RECINPUT", 4096 + (62 << 5))
22reaper.SetMediaTrackInfo_Value(track, "I_RECMON", 1) -- input monitoring on
23
24reaper.Main_SaveProjectEx(0, template_path, 0)
25
26local readback = reaper.GetMediaTrackInfo_Value(track, "I_RECINPUT")
27local log = io.open("/tmp/reaper-template.log", "w")
28if log then
29 log:write(string.format("saved=%s I_RECINPUT=%d\n", template_path, readback))
30 log:close()
31end
32
33-- Close the template tab; leave REAPER as it was.
34reaper.Main_OnCommand(40860, 0) -- Close current project tab