ReaDelay note values

1        = 8.0
1/2      = 4.0
1/4      = 2.0
1/8      = 1.0
1/16     = 0.5
1/32     = 0.25
1/4T     = 1.333
1/8T     = 0.666 
1/16T    = 0.333
1/32T    = 0.1665
1/2 dot  = 6.0
1/4 dot  = 3.0
1/8 dot  = 1.5
1/16 dot = 0.75
1/32 dot = 0.325

==================================================================

Param modulation mote values

1/4     = 1
1/4D  = 1.5
1/4T  = 0.666
1/8     = 0.5
1/8D  = 075
1/8T   = 0.333
1/16   = 0.25
1/16D = 0.375
1/16T = 0.1665
1/32   = 0.125
1/32D = 0.1875
1/32T = 0.08325
1/64    = 0.0625
1/64D = 0.09375
1/64T = 0.041625

==================================================================

tempo & pitch formula

the formula to determine how many cents you adjust to change loop tempos is:
Td = Desired tempo
Ts = Current Sample tempo
n = Detuning (in cents: 1200 cents = 1 octave, tempered scale)
n = ( 1200 / log[2] ) x log[Td / Ts]

Try entering it into a Scientific Calculator (like the one provided in Windows) like this:

Desired tempo / Current tempo = log * 1200 / 2 log = Detuning in Cents

==================================================================

1 ms (millisecond) = 0.001 seconds = 1/60000 minutes

4/4 time signature

note length to milliseconds

1/2 = 60000 ms / BPM * 2
1/4 (crotchet) note delay time in ms = 60000 ms / BPM 
1/8 (quaver) = 60000 ms / BPM / 2
1/16 (semi-quaver) = 60000 ms / BPM / 4
1/32 = 60000 ms / BPM / 8

dotted note - multiply the result times 1.5
triplet note - multiply the result times 0.666

or

1/2 = 240 000 / BPM / 2
1/4 = 240 000 / BPM / 4

and so on

by dividing 240 000 by the tempo value we obtain the duration of one bar at 4/4 
time signature

-----------------------------------

hertz to milliseconds

1 second/value in hertz * 1000 (milliseconds in 1 s)


milliseconds to hertz 

1/(value in ms : 1000) 


----------------------------------------------------------------------

ms to samples

ms x sample rate = samples


samples to ms

samples / sample rate = ms


_______________________________________

formula for calculating the exact delay time in milliseconds

(60 * 1 / tempo) * (4 / time division) or the simplified equation: 240 / tempo / time 
division where time division is a coefficient with the following values:

Normal

1 bar 	= 1
half bar = 2
1/4 	= 4
1/8 	= 8
1/16 	= 16
1/32 	= 32
1/64 	= 64
	
Triplets

1/2t 	= 3
1/4t 	= 6
1/8t 	= 12
1/16t 	= 24
1/32t 	= 48
1/64t 	= 96
	
Dotted

1/2d 	= 1.333
1/4d 	= 2.666
1/8d 	= 5.333
1/16d 	= 10.666
1/32d 	= 21.333
1/64d 	= 42.666

So if you're looking for the exact delay time for a quarter note on a tempo of 124 bpm, 
the formula is:
240 / 124 / 4 = 483 ms, which is equivalent to Head 3 (mode 3 or 7) with repeat rate 
at minimum.

Or if you want to play Pink Floyd's "Run Like Hell", you have a tempo of 115 bpm 
and one eighth note dotted, so you have:
240 / 115 / 5.333 = 391 ms, which is equivalent to Head 3 (mode 3 or 7) with repeat 
rate two notches below the middle... more or less.

===================================================================

WAV/AIFF file size formula

sample rate (e.g. 44100) x bit rate (e.g. 16) x channel count x duraction in sec = size in bits

size in bytes = size in bits / 8

size in kilobytes = size in bits / 8 / 1024

size in megabytes = size in bits / 8 / 1024 / 1024


===================================================================

Dotted grid/note is multiplication by 3/2

e.g. 1/8 dotted = 3/16

Triplet grid/note is multiplication by 2/3

e.g. 1/8 triplet = 1/12

https://www.youtube.com/watch?v=V5XqgHdWsH8


===================================================================


A triplet note denominator is a sum of straight note denominator + half of the straight note denominator: 

1/3 = 1/2 + 1; 1/6 = 1/4 + 2; 1/12 = 1/8 + 4; 1/24 = 1/16 + 8; 1/48 = 1/32 + 16; 1/96 = 1/64 + 32


A triplet note notation shows what whole notes are contained in it

1/3 = 1/2 + 1/1 = 1 half note + 2 half notes = 3 half notes
1/6 = 1/4 + 1/2 = 1 quarter note + 2 quarter notes = 3 quarter notes
1/12 = 1/8 + 1/4 = 1 eight note + 2 eight notes = 3 eight notes

etc

===================================================================


Как выяснить темп трека размера 4/4 без BPM анализаторов


1. Загрузить файл трека в аудиоредактор, который показывает временнУю 
информацию об аудиофайле

2. Отыскать в треке четвертные доли

3. Установить маркеры, поместив их точно в начале каждой доли (обычно на 
них стоят кик и снэр, поэтому определение транзиента не должно составить 
труда)

4. Измерить расстояние между двумя смежными четвертными долями 
в миллисекундах (обычно для этого нужно просто выделить зону между двумя
маркерами, которыми эти доли отмечены, и время отобразится на панели 
состояния аудиоредактора)

5. Рассчитать по формуле 60000 / Т мс, где 60000 - это кол-во миллисекунд 
в одной минуте, а Т мс - это время между двумя смежными четвертными 
долями в миллисекундах
либо 60 / Т с, где 60 - это кол-во секунд, а Т с - время ежду двумя 
смежными четвертными долями в секундах

=======================================================

Windows WDM wavetable synth recording setup in v5.99

In Preferences -> Audio -> Device 

Audio system: ASIO

Enable inputs: 
5. Mixer In L Delta-AP
6. Mixer In R Delta-AP


TCP of the destination track to which a regular send from the source tracks is created

Record: input (audio or MIDI)

Input: Stereo -> Mixer In L Delta-AP / Mixer In R Delta-AP

OR 

Input: Mono -> ✓ Mixer In L Delta-AP
                 Mixer In R Delta-AP

When settings are correct the destination track meter displays moving yellow bars

Mute the output to avoid feedback loop

=======================================================

To record MIDI output of a track create a MIDI send to the recording track, right click it's Record buttom and set Record: output -> Record: output (MIDI), Input:none (if doesn't work, then Input: MIDI -> All MIDI inputs -> All Channels). Both menus are available on the TCP as well.

=======================================================

To record web audio stream


Select WASAPI driver in Preferences -> Audio -> Device

Recording settings: Record: Input (audio or MIDI), Input: Stereo [or Mono depending on the needs]

Record monitoring must be OFF to prevent feedback loop

Arm record track, the meter must indicate signal.


=======================================================

When using multiout setup, despite the mono output number of the plugin being 1 the actual send mono channel ordinal number corresponds to its number in the overall list of channels nboth mono and stereo, where stereo channels precede the mono.
Hence if there're 16 stereo outputs and then some mono, mono output 1 equals to mono channel 17 (the first after 16) in the send mono channels list and so forth.

For multiout setup to work the number of channels on the track with the multiout plugin inserted must be changed to reflect the number of required outputs

=======================================================

For send effect to respond to stereo image settings on the track it's inserted on, the send must be set to mono even if the input signal is already mino.


=======================================================

To both recieve a multiout plugin output and send MIDI to it using the same track, track Feedback loop must be enabled in the Project settings.


=======================================================

To control send level of children tracks to an effect outside of a folder firsr rlink oute them to a link track inside the folder, disable its master/parent send output, group it with the folder track as a volume slave while folder track volume is a master, and route it to the outside effect channel.

=======================================================

ReaFIR as a match EQ

* Put ReaFir on Substract mode.
* Check Automatically build noise profile...
* Play the reference track or section as many times as it takes for the audio to stop coming through (create spectrum profile).
* When profile created. Un-Check Automatically build noise profile...
* With the spectrum profile created. Switch ReaFir to Compressor mode (or EQ in which case use Ctrl+mouse drag the curve up to increase volume, but the sound differs).
* Apply the ReaFir the to the target track(s)
optimal FFT size is 1024, anything above will introduce latency 

========================================================

Vocal Rider


1.) Insert 'volume_pan' as the first insert on your vocal track
2.) Click the volume slider in 'volume_pan'
3.) Click the 'Param' button
4.) Select 'Parameter modulation'
5.) Select 'Audio control signal'
6.) Set the 'Track audio channel' to 1+2
7.) Lower the 'Strength' slider to 0%
8.) Set the 'Direction' to negative

Now hit play and adjust the strength, attack, and release sliders until you get a little bit of gain reduction. You don't want a lot, but just enough to catch the peaks. You might also want to adjust the 'Min volume' slider.

https://forum.cockos.com/showpost.php?p=517645&postcount=10

and then to add to it
create automation js...volume...
then arm automation lane set to write and hit play... this will create automation for the js plug

now right click automation lane, select all points, copy,

create new automation volume pre fx
make sure playback marker is at start of song
select new automation lane
ctrl p or edit paste
this drops the automation into the new lane
delete js plugin and automation
and you are left with a pre fx editable volume ride

https://forum.cockos.com/showpost.php?p=534624&postcount=30


1. insert js: utility:volume_pan on the track you wish to automatically automate (sic)
2. click the tracks ENV button: set automation to WRITE
a. check the VOLUME DB box
b. click MOD (yes, the txt)
c. check AUDIO CONTROL SIGNAL
d. select the track channels you wish to use
e. check negative/positive to lower/raise respectively
f. volume sliders are like thresholds
g. drag curve (the red dot) to change ratio.
h. press PLAY & watch automation being written (if it doesnt, lower the volume slider)

using more than 2 track channels you can have other tracks controlling the parameter modulation as well

https://forum.cockos.com/showpost.php?p=606160&postcount=24

Possible param. modulation settings:

Baseline value - full right
Attack 20 ms
Release 400 ms
Min vol -50 dB
Max vol 0.00 dB
Strength 60%
Direction Negative
Audio control signal shaping - red dot is close to the bottom right


https://www.youtube.com/watch?v=fDPsGAWgeo8
https://www.youtube.com/watch?v=tjnrGU83PB4
https://www.youtube.com/watch?v=t6k8fqmm2NM

================================================================

MIDI busses

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

All the MIDI on a track will be sent to the plug-in. There are options for the plug-in to receive MIDI, and, if so, on which bus (MIDI Bus #1 is the default). 

Within the plug-in, different processing can be applied to MIDI on different MIDI channels (e.g. Kontakt, SampleTank etc can route the different channels to different instruments, but Reaper knows nothing of that).

There are also options for the output of MIDI from that plug-in:
-- it can be disabled, in which case the MIDI input to the plug-in is passed to the next plug-in
-- it can replace the MIDI input completely (that's the default) in which case the MIDI input to the plug-in is discarded and the MIDI output by the plug-in passed to the next plug-in
-- they can be merged, so the next plug-in gets both sets of MIDI.
-- you can put the MIDI on any MIDI bus

JS FX are different:
-- the input MIDI is always discarded,
-- the only MIDI passed to the next plug-in is any MIDI output by the JS FX itself

Does that shed any light on things?

Thinking about it, you could use a JS FX to put MIDI onto different busses and have several VSTis on the track each listening out for a different bus.

MIDI Busses in Reaper can be thought of as 16 separate steams of MIDI, each of which can have MIDI on 16 channels.
* the default MIDI Bus is #1,
* track Sends can send MIDI from a selected MIDI Bus (or MIDI Channel or both),
* track Sends can put MIDI on a selected MIDI Bus (or MIDI Channel or both),
* plug-ins can receive MIDI from any selected MIDI Bus,
* plug-ins can output MIDI to any selected MIDI Bus,

One of uses for MIDI busses is for VST3 plugins that support multiple MIDI ports (like Vienna Instruments Pro), you can link MIDI busses to MIDI ports and essentially send over more than 16 MIDI channels to one plugin.


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

User guide might provide information on Midi Buses in section 17.19. 

Each track features a Midi chain allowing plugins to receive Midi events from and send Midi events to. By default any plugin digests all events from the previous one in the chain, so that only those it sends are propagated, but Reaper also can be configured to propagate the events present at that plugin's input and merge them with it's output (see "n in m out" -> "I/O" menu).

The primary input to that chain is handled in a very similar way to audio information (track input selection from "hardware" devices, arming the track, routing between tracks, ...).

Very similar to audio streams, the output of the chain (i.e. of the last plugin in the FX "plugin chain") can be routed to the input of other tracks and/or to Midi output "hardware" devices.

Additionally there are 16 Midi buses that are accessible by plugins globally (independent of their location in an FX chain) as a source and a destination of Midi events (configurable via the "n in m out" -> "I/O" menu).

The dedicated plugin "ReaControlMidi" can read and send Midi messages (in the normal way configurable from/to the appropriate FX-chain or a Midi Bus). Besides other things, it can link Midi CC messages to automatable parameters of other plugins in that track in a bidirectional way (providing possibilities for complex realtime automation between plugins and midi based hardware controllers). Moreover, it can show ("log") the Midi traffic.


Besides the tracks' FX Midi chains and the 16 Midi Buses, there is yet another global Midi Bus called the "Reaper control path", which is dedicated to feeding Midi events to any functionality that is not provided by a plugin loaded in an FX chain such as:
- Events can be fired by Midi events occurring in the "Reaper control path".
- The Midi "learn" functionality of the "param" menu (provided for any plugin) accesses the "Reaper control path".
- Reaper extensions (e.g. "SWS Live Configs", see the user Guide of same on how it makes use of the "Reaper control path") and ReaScripts (???) can access the "Reaper control path" (but not the tracks' Midi chains nor the Midi Buses).
- ... ? ? ?

The only (?) functionality, which is not provided by a plugin, that accesses tracks' FX Midi chains or one of the 16 Midi Buses, is what is provided by
..... "Param" -> "FX parameter List" -> "Param modulation / Midi Link" -> "..." -> "Link from MIDI or FX parameter" -> "MIDI" ....
Here, the functionality can be configured to Read Midi CC events from the track's FX chain or one of the 16 global Midi buses.

The "hardware" input to the "Reaper control path" is configured in the "Midi devices" section of the configuration menu by checking "Enable input for control messages".

The only other input to the "Reaper control path" (I know of) is provided by the dedicated "MidiToReaControlPath" VST plugin.

(AFAIK) There is no hardware output from the "Reaper control path".

Of course the Midi I/O devices can be called "buses", as well as the outputs can be used to feed multiple track inputs, while the outputs get the messages routed to them and merged from multiple tracks. 

There is yet another midi bus I forgot: The output of the "Virtual Keyboard" can be routed to multiple tracks. I seem to remember that I once have been told, that there are other functionalities that feed this bus, but I can't remember what they are. 


https://forum.cockos.com/showpost.php?p=2091135&postcount=4

MIDI ports is not the same thing as MIDI busses. Reaper supports up to 64 hardware MIDI ports (source: https://askjf.com/index.php?q=3779s), yes. 16 MIDI busses are used internally for routing purposes. Completely different things.

If you read page 350-351 of the Reaper manual, it starts out with routing MIDI then goes in routing using buses.

=====================================================================


the volume of RS5K can be controlled by CC7 in the Midi Editor. An "Offset" of -50% & Scale at 100%, will give you +0.0dB when CC7 = 127.

The graph is tied to "Min vol" which is actually a "Velocity Intensity" dynamic control. If you set the "Min vol" ot a -66.2dB, you will get the maximum volume change with velocities 1 to 127. Any changes from -66.2dB to -inf are ineffective and have no affect.

https://forum.cockos.com/showpost.php?p=1741277&postcount=5

=====================================================================

Time base

The default project timebase is
Timebase for items/envelopes/markers: Beats (position, length, rate)
Timebase for tempo/time signature envelope: Beats

Timebase for audio items changes according to project timebase settings, unless it is changed in the individual audio item settings.

Timebase for MIDI items is always beats (position, length, rate), unless it is changed in the individual MIDI item settings.


MIDI

When MIDI item timebase is set to project/track default, MIDI item will always keep it's position and length in beats.

If the tempo is changed slower, MIDI item will play back slower and vice versa. 


AUDIO

When project timebase is set to Time, audio item will keep it's position and length in seconds. 
Changes in tempo won't change the playback rate.

When project timebase is set to Beats (position, length, rate), audio item will keep it's position and length in beats. 
If the tempo is changed slower, audio item will play back slower and vice versa.

When project timebase is set to Beats (position only), audio item will keep it's starting position in beats and length in seconds.
Changes in tempo won't change the playback rate.


---

There is also a new Timebase help action in Reaper which will detail these:
Project settings: timebase help...


https://forums.cockos.com/showpost.php?p=1073054&postcount=2

---


-- MIDI items time base

Timebase does not work for MIDI items.

Right click the MIDI item in question and select source properties.

Turn on "Ignore project tempo" and type in the current BPM for the item.

When you finish with tempo edits, make sure to glue the item to "embed" tempo changes into it. 

https://forums.cockos.com/showthread.php?t=118253

---

-- Time Base summary


1. Beats (position, length, rate) --> items fully adapt to tempo changes, including getting slowed down or sped up with rate change
which in turn makes sure items relative length is maintained

2. Beats (position) --> only start (position) of items adapts to tempo change, the rate doesn't change and hence no length change

3. Time --> tempo changes are ignored, position of items is absolute on the timeline no matter the tempo


If tempo changes are effected with tempo markers / tempo envelope, their time base must match those of items/envelopes/markers (project)
 
in Project settings -> Time base for tempo/time sign envelope under the main tab


https://www.youtube.com/watch?v=Zz3EccJygFg
https://www.youtube.com/watch?v=YouvqoCgJBI

=========================================================================

-- Find item tempo


Method 1

1. Create a time selection over the item which encompasses exactly 1 measure (bar)
To make fine adjustments to time selection start/end points click time selection edge, hold down Ctr+Shift and move them with the mouse
2. Right click the Ruler and run 'Create measure from time selection (detect tempo, try to create a single measure)'

If item's time base is 'Beats (position length and rate)' its length will change after the tempo detection.
If item's time base is 'Time' or 'Beats (position only)' its length won't change.
As a result of the action tempo markers will be created, so undo it and input the calculated tempo manually.

Alternatively set item time base to 'Time' or 'Beats (position only)' and instead of 'Create measure from time selection'
run 'Set project tempo from time selection (detect tempo)' from the same menu.
Then restore the item time base if needed.


Method 2

1. Set item's time base to Time' or 'Beats (position only)' so its length isn't affected by tempo changes
2. Figure out the beginning of the measure in the item
3. Alighn the beginning of the measure in the item with the beginning of a measure on the grid
4. Place the edit cursor at the start of the item's measure
5. Insert a tempo marker by right clicking the Ruler and running action 'Insert tempo/time signature marker...'
without making any changes in the tempo marker properties (probably except the time signature if it's other than 4/4)
6. Place the edit cursor at the end of a measure on the grid
7. Insert another tempo marker the same way as in the step 5
8. Hold down Ctrl and move the 2nd tempo marker to the end of the measure within the item.
9. The project global tempo and the tempo of the 1st marker will be updated with the new value
10. Restore the item time base



One method to find tempo

stretch the audio to the grid and then just adjust the bpm until it says 'rate: 1.000' at the top of file

https://old.reddit.com/r/Reaper/comments/jiwdve/finding_the_song_tempo/gaao6ep/

===========================================================================


reaper-kb.ini

Key 1 104 0 0 

Key = it's a Key Shortcut
1 = Modifier Key
104 = Key Number (usually in ASCII code)
0 = Action ID 

Modifier Key = 1 means no modifier. Different values stand for different Modifier Combinations like Alt, Ctrl + Alt, Ctrl + Shft, etc.

=========================================================================

-- Custom action flags in reaper-kb.ini


Bitfield

Consolidate undo points: &1
Show in Actions menu: &2
Show as active if all component actions are: Active ~= &16;	Active or Indeterminate &32


ACT 0 - Show as active if all component actions are: Active
Act 1 - Consolidate undo points; Show as active if all component actions are: Active
ACT 2 - Show in Actions menu; Show as active if all component actions are: Active
ACT 3 - Consolidate undo points; Show in Actions menu; Show as active if all component actions are: Active

ACT 16 - all disabled
ACT 17 - Consolidate undo points
ACT 18 - Show in Actions menu
ACT 19 - Consolidate undo points; Show in Actions menu

ACT 32 - Show as active if all component actions are: Active or Indeterminate
ACT 33 - Consolidate undo points; Show as active if all component actions are: Active or Indeterminate
ACT 34 - Show in Actions menu; Show as active if all component actions are: Active or Indeterminate
ACT 35 - Consolidate undo points; Show in Actions menu; Show as active if all component actions are: Active or Indeterminate


=========================================================================

ReaScript task control (a background/running script) dialogue answer reset

The one which reads:

//////////////////////////////////////////////////////////////////////////////////
ReaScript task control

[script] is running in the background.

Would you like to terminate all instances of this script, or launch a new instance?

Remember my answer for this script.
///////////////////////////////////////////////////////////////////////////////////


in reaper-kb.ini the value 4 next to a script command ID changes to 516 (after selecting "launch a new instance" as the answer) when the answer to the dialogue is saved. Restoration to 4 resets it.

from the reaper-kb.ini file reference (https://mespotin.uber.space/Ultraschall/Reaper-Filetype-Descriptions.html#Reaper-kb.ini
/Docs/REAPER Filetype-descriptions.html#Reaper-extstate.ini)

Quote:
4 - Dialog window appears (Terminate, New Instance, Abort), if another instance of a given script is started, that's already running
260 - always Terminate All(!) Instances, if you try to run another instance of a script, that's already running. When no instance is running, it simply starts the script.
516 - always start a New Instance of the script, that's already running

=============================================================================


-- Stopping a defer script with another script 


https://forums.cockos.com/showthread.php?p=2089026


===========================================================================


Reaper understands the bank/program part of Cakewalk instrument definition files, so if you can find these for your devices you're set. All Reaper dialogs that can load a *.reabank can also load *.ins.


=============================================================================

TIP on how to select patches scattered across different banks via ReaControlMIDI with presets or a custom .reabank file

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

see 'Manage scattered hardware patches with ReaControlMIDI and .reabank file by DarkStar.pdf'


Other thereads about triggering presets

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

https://forum.cockos.com/showthread.php?p=1173997

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


============================================================================

To prevent hanging notes in MegaBaby after loop finishes, in Preferences > Audio > MIDI devices tick “all notes off” and “stop/stopped seek”

https://old.reddit.com/r/Reaper/comments/g414wy/quick_question_about_megababy/

==============================================================================


If you save Full Track Mix Snapshot with SWS utility, when you right-click on the snapshot, Show snapshot details, you will get a listing of all the settings. Right click, Select All... Copy, this way you get entire mix detailed, including FX used, sends and receives.

https://old.reddit.com/r/Reaper/comments/aloyvo/is_it_possible_to_export_a_list_of_all_track_names/efl6znt/

================================================================================

In video editing using secveral video files after syncing them the best thing to do is check "ignore audio" in the items source properties. It significantly improves playback performance. these multi-layer videos can be extremely taxing on the system

https://www.youtube.com/watch?v=2sQKpDBHFk8

================================================================================


Sending media item output to a track on channels other than 1/2

https://forum.cockos.com/showthread.php?t=190911
https://forum.cockos.com/showpost.php?p=1836861&postcount=50


==============================================================================

Running a function from another script

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

https://forum.cockos.com/showthread.php?t=174073 !!!!!!!
https://www.gammon.com.au/scripts/doc.php?lua=debug.getinfo


in the same folder as the parent script

to run

local info = debug.getinfo(1,'S');
script_path = info.source:match[[^@?(.*[\/])[^\/]-$]]
dofile(script_path .. "otherfile.lua")

OR

function reaperDoFile(file) 
local info = debug.getinfo(1,'S'); 
script_path = info.source:match[[^@?(.*[\/])[^\/]-$]]; 
dofile(script_path .. file); end


reaperDoFile("myfile.lua")
reaperDoFile("my super library.lua")
reaperDoFile("Cockos official GUI.lua")



to make accessible for making calls to


local info = debug.getinfo(1,'S');
local full_script_path = info.source
local script_path = full_script_path:sub(2,-5) -- remove "@" and "file extension" from file name
if reaper.GetOS() == "Win64" or reaper.GetOS() == "Win32" then
  package.path = package.path .. ";" .. script_path:match("(.*".."\\"..")") .. "..\\Functions\\?.lua"
else
  package.path = package.path .. ";" .. script_path:match("(.*".."/"..")") .. "../Functions/?.lua"
end
require("X-Raym_Functions - console debug messages")

=============================================================================

-- Actions behavior

Item edit: Move position of item to edit cursor (affected by grouping, if one item is selected and Grouping is ON it drags all grouped items with it)

SWS/FNG: Move selected items to edit cursor (unaffected by grouping)

------------------------------------------------------------------------------

These work relative to the item edge closest to cursor if several of them are selected, so all are moved as one unit and at cursor ends up only the item whose edge is the closest to cursor

Xenakios/SWS: Move selected items to edit cursor - moves all selected items to edit cursor independently of one another

SWS: Select only parent(s) of selected folder track(s) - selects Master track as parent if a folder parent or any 1st level track happens to be selected

Track: Unselect all tracks - doesn't unselect Master track, to unselect Master track use SWS: Unselect master track

Item properties: Pitch item up/down one semitone - affecs all items grouped with selected one if Grouping is ON

SWS: Pitch all takes up/down one semitone -- is independent of items grouping

In general native actions tend to be group sensitive while the SWS actions do not

------------------------------------------------------------------------------

View: Increase/Decrease selected track heights -- change height by 8 px

View: Increase/Decrease selected track heights a little bit -- change height by 2 px

View: Scroll view right/left - scroll by 481 px regardless of the zoom level

View: Scroll view down/up - scroll exactly track by track regardless of the zoom level, not very precise when tracks have different heights

-----------------------------------------------------------------------------

The following ones don't create undo points and undoing them may produce inconsistent results.
Wrapping them inside a custom action seems to be a workround, it was tested with the last two.

SWS/BR: Insert CC event at edit cursor in lane under mouse cursor
SWS/BR: Delete selected events in last clicked lane
SWS/BR: Delete all events in last clicked lane
SWS/BR: Copy selected CC events in active item to last clicked lane
SWS/BR: Hide all CC lanes except last clicked lane
SWS/BR: Hide last clicked CC lane

------------------------------------------------------------------------------

View: Scroll view right/left -- scroll by exactly 488 px regardless of the zoom level (that is 122 x 4, see next)

View: Scroll horizontally [reversed] (MIDI CC relative/mousewheel) -- scroll by exactly 122 px regardless of the zoom level

------------------------------------------------------------------------------

Item: Select item under mouse cursor -- selects item under mouse (or keeps selected), deselects others; deselects all if mouse is outside of items within Arrange

Item: Set focus to item under mouse cursor -- selects item under mouse, keeps others selected; doesn't deselect all if mouse is outside of items within Arrange

------------------------------------------------------------------------------

View: Move edit cursor to mouse cursor (no snapping) -- works along the entire screen Y axis outside of the TCP regardless of whether the program window is under the mouse

------------------------------------------------------------------------------

-- 'View: Attach/unattach docker to/from main window' (40313) 

When the toggle state is ON it cannot be set to OFF if there're no visible dockers, its toggle state is linked to the state of the last docker to be attached/unattached with the option 'Attach docker to main window' (including a toolbar docker) and only such docker can be toggled using it, undocking a window by dragging doesn't set the action toggle state to OFF;

when there're no visible dockers and its toggle state is OFF, toggling it invokes the last toggled docker and changes the docker's attach state

The action toggle state is ON when there's no docker whose attach state was last toggled with it (which happens when windows were undocked by dragging) and when the toolbar docker is hidden, if the toolbar docker is visible in this scenario, the action toggle state is OFF


-- 'View: Show docker' (40279) doesn't work with the toolbar docker, but does with individual toolbars floating docker

------------------------------------------------------------------------------

-- Track: Insert new track at end of mixer (41147)

Inserts a new track after the last visible track in the Mixer

Only makes sense when the option 'Auto-arrange tracks in Mixer' in the Mixer settings is disabled, 

i.e. tracks in the Mixer can be arranged independently of their order in the Arrange window.

In this case in Arrange the new track will be inserted after whichever track that's currently the last in the Mixer

and which isn't necessarily the same as the last in Arrange.

------------------------------------------------------------------------------

-- Vertical scroll and zoom over the track list in Arrange

Mousewheel is hard linked to vertical scroll

Ctrl+Mousewheel is hard linked to vertical zoom

Actions such as 

View: Scroll vertically reversed (MIDI CC relative/mousewheel)
View: Zoom vertically reversed (MIDI CC relative/mousewheel)
View: Zoom vertically reversed, snap to theme-defined sizes (MIDI CC relative/mousewheel)
View: Zoom vertically, snap to theme-defined sizes (MIDI CC relative/mousewheel)

only work outside of the track list or over the track list with modifiers (scroll) and modifiers other than Ctrl (zoom)


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

----------------------------------------------------

-- SWS: Toolbar solo/mute/arm toggle


These actions are meant to go on the toolbar, once you have a button, they:
1) Show you on the toolbar if you have any tracks soloed/muted/armed.
2) If you have tracks soloed/muted/armed, and you click the toolbar button, it unsoloes/unmutes/unarms everything.
3) If you click the button again, it "toggles" back to the previous track solo/mute/arm state.

https://forum.cockos.com/showthread.php?p=753850#post753850
OR
https://forum.cockos.com/showpost.php?p=753850&postcount=1052

----------------------------------------------------

MIDI Editor

Set note position to edit cursor
AND
Edit: Move left edge of note to edit cursor

seems identical

---------------------------------------------------

-- 'Cursor: Advance X' and 'Cursor: Advance X using current note length division type' for the MIDI Editor

Actions of the 2nd type make the cursor advance by the note division type set in the 2nd 'Notes:' menu, 

that is dotted, triplet or straight, whereas actions of the 1st type always make it advance by straight division.

--------------------------------------------------

-- 'Item navigation: Move cursor left/right to edge of item' only moves cursor to edges of selected items

if no item is selected it behaves exactly like 'Item navigation: Move cursor left/right to nearest item edge'

'Item navigation: Move cursor left/right to nearest item edge' itself doesn't require item selection to work

--------------------------------------------------

-- SWS: Set last touched track to match track selection (deprecated)


Same as Track: Set first selected track as last touched track

--------------------------------------------------

-- Xenakios/SWS: Time selection adaptive delete

Deletes part of selected item within time selection or selected item if it's not within time selection


https://forum.cockos.com/showpost.php?p=2784154&postcount=3323

--------------------------------------------------

-- SWS/wol: Toggle enable extended zoom for envelopes in track lane

-- https://forums.cockos.com/showthread.php?t=163122

--------------------------------------------------

Media Explorer

-- Preview: Fast forward a little bit / Preview: Rewind a little bit

Each moves the preview player playhead by 8 ms

--------------------------------------------------


-- Track: Go to next track

if Shift+Click or Ctrl+Click selection is made 

from bottom to top, the track selected is the track after the last selected one (last touched)
from top to bottom, the track selected is the track after the first selected one (last touched)

Track: Go to previous track

from bottom to top, the track selected is the track previous to the last selected one (last touched)
from top to bottom, the track selected is the track previous to the first selected one (last touched)


!!!! Even though these actions select tracks, in essense what they change is the last touched track and work relative to the last touched track.

That's evident if after manual selection of a track you change the target track for insert/paste by clicking

on another track within Arrange while Prefs -> Editing behavior -> Mouse -> Mouse click/edit in arrange view: Sets track for insert/paste is enabled.

The next/previous track will be relative to the track you clicked the last even if the last clicked track isn't selected.


These two actions only work right away if there's an active last touched track (can be indicated by the bracket attached to the edit cursor). 

Last touched track is cleared with mouse click within Arrange below the last track.

So if there's no active last touched track these actions dosn't select a new track but BOTH make the very last track the last touched and select 

it if it's non-selected. A new track will only be selected and made the last touched on the next run provided the last touched track is still active.


--------------------------------------------------

-- Action: Modify MIDI CC/mousewheel: Negative

Reverses mouswheel direction for custom actions from forward/out/up - next/down, backward/in/down - previous/up

The direction is determined by actions

Action: Skip next action if CC parameter <0/mid
'NEXT/DOWN' action
Action: Skip next action if CC parameter >0/mid
'PREVIOUS/UP' action

Placing 'Action: Modify MIDI CC/mousewheel: Negative' at the beginning of the custom action reverses the direction


--------------------------------------------------

-- Track: Insert new track at end of track list vs Track: Insert new track at end of mixer


These behave differently when the option 'Auto-arrange tracks in mixer' is turned off (action Mixer: Toggle autoarrange)

which allows free reordering of tracks in the Mixer while retaining their indices and in which case

'Track: Insert new track at end of mixer' will insert a new track after whatever track which is placed last 

in the Mixer regardless of its index


--------------------------------------------------

-- Transport: Play/stop (move edit cursor on stop)

The action is suitable for stopping recording as well


--------------------------------------------------

-- Navigate: Move edit cursor left/right by grid


Moves the edit cursor by grid size relatively if Snapping is turned off


--------------------------------------------------


-- Select note nearest to the edit cursor

Selects a note event nearest to the edit cursor at the currently active pitch (pitch cursor position)

If there's no note at the current pitch in the neighborhood of the edit cursor,
a matching note at a pitch closest to the current and higher than it is selected,
if there's no matching note at a pitch higher than the current one, the first found matching note
at a pitch lower than it is selected


--------------------------------------------------

-- View: Toggle show MIDI editor windows

Only affects last selected MIDI item for opening and currently active MIDI Editor window for closure.
Always close if a MIDI Editor window is open, even if another MIDI item is selected.
Must be used to close the window as well, otherwise if you try to apply it to another item 
having closed the current one manually it must be reset which requires a few idle executions


--------------------------------------------------


-- Take: Implode selected fixed lane tracks to takes using best efforts (overlapping items may be shortened)
VS
-- Take: implode items on the same track

The first action also disables FIL (fixed item lanes) mode


--------------------------------------------------

-- File: Save new version of project (automatically increment project name)

Updates name of the open project


-- File: Save copy of project (automatically increment project name)

Keeps the project name the same, display a message about the path of the created file copy


--------------------------------------------------

-- Action: Skip next action, set CC parameter to relative +1 if action armed, 0 otherwise

-- Action: Skip next action, set CC parameter to relative +1 if action toggle state enabled, -1 if disabled, 0 if toggle state unavailable.

and actions which evaluate the CC parameter set by these actions

Action: Skip next action if CC parameter !=0/mid
Action: Skip next action if CC parameter <=0/mid
Action: Skip next action if CC parameter <0/mid
Action: Skip next action if CC parameter ==0/mid
Action: Skip next action if CC parameter >=0/mid
Action: Skip next action if CC parameter >0/mid

have their scope limited to a particular custom action they're executed within

Setting CC parameter within one custom action doesn't affect this parameter within another custom action
so nested actions each can have its own CC parameter which makes simulation of AND and OR operators possible,
see "IF, IF NOT statements, AND and OR operators for regular custom actions (conditional custom actions)" paragraph
in this document

When action is executed with a click or a shortcut, for the purposes of the abovelisted actions CC parameter is <0,
not ==0 as could be expected.


--------------------------------------------------


Actions suffixed with '(MIDI/OSC only)' CAN BE USED WITH REGULAR SHORTCUTS


If multiple shortcuts are assigned, each shortcut can trigger them at different mode (absolute or relatve) selected

and with different MIDI values specified in the Keyboard/MIDI/OSC input dialogue

https://www.youtube.com/watch?v=kSpi2cJ-v84



============================================================================

Action list section IDs

Main section ID = 0
Main (alt recording) section ID = 100
Main (alt-1) - Main (alt-16) = 1 - 15
MIDI Editor section ID = 32060

MIDI Event list editor section ID = 32061
MIDI Inline editor section ID = 32062
Media Explorer section ID = 32063
Crossfade Editor section ID = 32064


Main (alt recording) - for using different keyboard shortcuts or different actions bound to the same shortcut when in record mode
provided 'Use alternate keyboard section when recording' option is enabled under Preferences > General > Keyboard/Multitouch

User Guide chapter 15.10 Keyboard Shortcuts for Recording

https://forum.cockos.com/showthread.php?t=215508
https://forum.cockos.com/showpost.php?p=2077375&postcount=3

===========================================================================

Preperation for

Custom: IadAslan_Bounce In Place - Item Selection (showthread.php?t=221654) see preparation in Tips.txt
Custom: IadAslan_Bounce In Place - Time Selection (showthread.php?t=221654) (create time sel. and select items) see preparation in Tips.txt


- Install latest SWS Extension
- Open Render Options (File -> Render)
- Set "Source" to "Master Mix"
- Set "Bounds" to "Time Selection"
- Leave "Directory" empty, it automatically selects the current project directory by default
- Check "Silently increment filenames to avoid overwriting"
- Check "Add rendered items to new tracks in project"
- Add tail, adjust other preferences if you feel the need to do so


https://forum.cockos.com/showpost.php?p=2142756&postcount=7


Actual custom actions


Custom: IadAslan_Bounce In Place - Item Selection (showthread.php?t=221654) see preparation in Tips.txt

- SWS: Save selected Item(s)
- Item properties: Solo
- Time selection: Set time selection to items
- SWS: Save master FX enabled state
- SWS: Disable master FX
- File: Render project, using the most recent render settings, auto-close render dialog
- SWS: Restore saved selected item(s)
- Item properties: Unsolo
- Item properties: Mute
- SWS: Restore master FX enabled state


Custom: IadAslan_Bounce In Place - Time Selection (showthread.php?t=221654) (create time sel. and select items) see preparation in Tips.txt


- SWS: Save selected Item(s)
- Item properties: Solo
- SWS: Save master FX enabled state
- SWS: Disable master FX
- File: Render project, using the most recent render settings, auto-close render dialog
- SWS: Restore saved selected item(s)
- Item properties: Unsolo
- Item properties: Mute
- SWS: Restore master FX enabled state


===========================================================================

To be able to record a video demo with sound and voiceover concurrently, add line rearoute_loopback=8 into the reaper.ini file in [REAPER] section. The number can vary. Then reload the program. The newly added inputs and outputs should be listed in the Audio Hardware Outputs list in the Master track routing window.
Then to record you use two projects side by side in different tabs, one for the demo, the second for voiceover recording. In the demo project Master track routing window add a loopback output while in the voiceover project add a new track and select a loopback input with the same number as the output in the demo project. Thus in the voiceover project you have two tracks, one is for voice and another is for audio coming from the demo project.

This may work out of the box provided 'Run background projects' option is enabled, but these additional outputs/inputs allow recording specific tracks without soloing them in the source project

https://www.youtube.com/watch?v=E52s-RaYKuM
https://www.youtube.com/watch?v=sBuFHJlZ19Q

May be irrelevant for the latest versions of REAPER

--------------------------------------------------------

-- Rearoute loopback

Justin:

You can set rearoute_loopback=1 in your reaper.ini (right under [REAPER]), and then you will have loopback inputs and outputs which you can use to send between projects. (if you are on Windows, this will mean you lose ReaRoute capability, though, but you probably don't need it).


https://forum.cockos.com/showthread.php?p=1796913#post1796913


Since build 6.69 supports up to 512 channel

https://www.youtube.com/watch?v=GKa3uGbz854&t=97s


and since version 7 is a built-in option in Preferences -> Audio -> Virtual loopback audio hardware
can be used alongside the parameter in reaper.ini

https://www.youtube.com/watch?v=FAKiHozcE8o?t=1203s


Example of a use case:

Record on multiple tracks while printing FX on the way in via an FX chain on a single track

1. Select Aux (Rearoute) Loopback output on the track housing the FX chain
2. Select a parallel Aux (Rearoute) Loopback input in the recording preferences of the recording track

https://www.youtube.com/watch?v=J4VZshHlVgU


===========================================================================

How actions command IDs work

https://forum.cockos.com/showpost.php?p=2050919&postcount=8

===========================================================================

Undo extraflags

https://forum.cockos.com/showpost.php?p=1398469&postcount=4
https://forum.cockos.com/showthread.php?t=185118
https://forum.cockos.com/showthread.php?t=207466
https://forum.cockos.com/showthread.php?t=205780
https://forums.cockos.com/showthread.php?p=2084802
https://www.reaper.fm/sdk/reascript/reascript.php


https://forum.cockos.com/showpost.php?p=1980498&postcount=2

reaper.Undo_EndBlock("undo text", extraflags)

extraflags values


UNDO_STATE_ALL      = -1 OR 0xFFFFFFFF as per the specs https://www.reaper.fm/sdk/plugin/reaper_plugin.h (which probably doesn't matter much)
UNDO_STATE_TRACKCFG =  1 -- has track/master vol/pan/routing, ALL envelopes (master included)
UNDO_STATE_FX       =  2 -- track/master fx
UNDO_STATE_ITEMS    =  4 -- track items
UNDO_STATE_MISCCFG  =  8 -- loop selection, markers, regions, extensions!
UNDO_STATE_FREEZE   = 16 -- freeze state -- note that isfreeze is used independently, this is only used for the undo system to serialize the already frozen state


schwa:

Undo_BeginBlock will suppress REAPER creating any undo points until Undo_EndBlock is called. This allows the extension to perform more complex tasks that call in to multiple API functions that would ordinarily create undo points, without the overhead of creating individual points for what is effectively a single consolidated action.

The whichState parameter to the Undo_OnStateChange functions is a bitmask that is used with the UNDO_STATE_* flags that are declared in reaper_plugin.h. For example, if your extension changes both media items (perhaps by changing their length) and tracks (perhaps by adding a track), you might call Undo_OnStateChangeEx("text for undo point", UNDO_STATE_ITEMS|UNDO_STATE_TRACKCFG, -1).

If you want to create a new actions section (similar to the Main or MIDI sections), you must create a new KbdSectionInfo. However, you probably would only want to do that if you have created an entirely new context for these actions, such as a new dialog window similar to the MIDI editor or Media Explorer. If your actions are meant to be used in an existing context, such as the main arrange view or the MIDI editor, it would be easier to simply add the actions to the appropriate existing actions section.

The SWS source is usually the best place to look for hints on API questions. In fact, that's where I looked to see where the UNDO_STATE_* flags were published


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


schwa:

I'm not sure if this is fully documented (if not we'll add it), but the flag passed to Undo_EndBlock() controls how much of the project needs to be serialized for the undo point. -1 means "everything changed," so everything gets serialized, every track, media item, fx, the timeline, routing, and ARA state. As you've seen, serializing the ARA state may take a while -- this is completely out of REAPER's control, all we can do is ask the plugin for its state.

If you know that your script can only have affected certain parts of the project, you can pass that information as the flag argument to Undo_EndBlock which will make it much more efficient.
 
UNDO_STATE_ALL -1 OR 0xFFFFFFFF as per the specs https://www.reaper.fm/sdk/plugin/reaper_plugin.h (which probably doesn't matter much)
UNDO_STATE_TRACKCFG 1 // track/master vol/pan/routing, routing/hwout envelopes too
UNDO_STATE_FX 2 // track/master fx
UNDO_STATE_ITEMS 4 // track items
UNDO_STATE_MISCCFG 8 // loop selection, markers, regions, extensions
UNDO_STATE_FREEZE 16 // freeze state
UNDO_STATE_TRACKENV 32 // non-FX envelopes only
UNDO_STATE_FXENV 64 // FX envelopes, implied by UNDO_STATE_FX too
UNDO_STATE_POOLEDENVS 128 // contents of automation items -- not position, length, rate etc of automation items, which is part of envelope state
UNDO_STATE_FX_ARA 256 // ARA state

So if your script may have affected tracks and media items only but not FX, you could pass flag=5 (1+4) for example. If your script may have affected everything but freeze state, automation items and ARA state, you could pass flag=111 (1+2+4+8+32+64), etc.


https://forum.cockos.com/showpost.php?p=2090533&postcount=27

===========================================================================

reaper.PreventUIRefresh()


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


===========================================================================


If undo point entry isn't written into the undo list for changes in the MIDI Editor

is solved by using Undo_OnStateChange_Item() or Undo_OnStateChange() and Undo_OnStateChange2()

or MarkTrackItemsDirty() between the UndoBlock functions

or a dummy sequence 
reaper.SetMediaItemSelected(item, false)
reaper.SetMediaItemSelected(item, true)


https://forum.cockos.com/showthread.php?t=185118 (post 6)
OR
https://forum.cockos.com/showthread.php?p=1925555
https://forum.cockos.com/showthread.php?t=205780
https://forums.cockos.com/showthread.php?t=207466


===========================================================================

Setting preferences through ReaScript

Some belong to config others to REAPER settings stored in the reaper.ini

The config settings available through the API, project and global can be accessed with 

reaper.SNM_GetIntConfigVar
reaper.SNM_SetIntConfigVar
reaper.SNM_GetDoubleConfigVar  
reaper.SNM_SetDoubleConfigVar

Don't require restart

The reaper.ini settings can be changed with 

reaper.BR_Win32_GetPrivateProfileString
reaper.BR_Win32_WritePrivateProfileString

But require restart to take effect


https://forum.cockos.com/showthread.php?p=1872791
https://forum.cockos.com/showthread.php?t=206715 -- SNM_SetIntConfigVar-variables and tools


see Reaper-Preferences ConfigVariables-Documentation (Ultrashal).doc
and
REAPER IntConfigVars.txt


https://forum.cockos.com/showthread.php?t=183548 -- colors


Example of changing audio buffer size:
https://forum.cockos.com/showthread.php?t=180568

-- writing to reaper.ini file

inipath = reaper.get_ini_file()
retval, value = reaper.BR_Win32_GetPrivateProfileString("reaper", "asio_bsize", "512", inipath)
--retval, value = reaper.BR_Win32_GetPrivateProfileString("reaper", "asio_bsize", "", inipath)
--reaper.BR_Win32_WritePrivateProfileString(sectionName, keyName, value, inipath)

OR

-- reportedly doesn't work

reaper.Audio_Quit()
reaper.SNM_SetIntConfigVar("asio_bsize", 512)
fa
reaper.Audio_Init()


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

local retval, stringOut = reaper.BR_Win32_GetPrivateProfileString("section", "key", "",  reaper.get_ini_file())
reaper.BR_Win32_WritePrivateProfileString( "section", "key", stringOut, reaper.get_ini_file() )
reaper.TrackList_AdjustWindows(true) -- doesn't help in updating
reaper.UpdateArrange()


-- getting multiple values from reaper.ini

local config = {
  this=1, -- fill with default values
  that=2,
  other=3,
}

for key, _ in pairs(config) do
  config[key] = ({reaper.BR_Win32_GetPrivateProfileString(SECTION_NAME, key, config[key], FILE_PATH)})[2]
  reaper.ShowConsoleMsg(string.format('%s = %s\n', key, config[key]))
end

https://forum.cockos.com/showthread.php?t=215414 -- sample rate

reaper.SNM_SetIntConfigVar('projsrate', 48000)
reaper.Audio_Quit()
reaper.Audio_Init()

https://forum.cockos.com/showthread.php?p=1872441 -- proj. sample rate

https://forum.cockos.com/showpost.php?p=1184648&postcount=3 -- Breeder on how to manipulate bits

https://forum.cockos.com/showthread.php?t=176351 -- FnA on how to manipulate dual trim setting + defer, flipping bits shorthand by FnA

https://forum.cockos.com/showthread.php?t=206619 -- Mespotine on manipulating mouse modifiers

https://forum.cockos.com/showpost.php?p=1617828&postcount=8 planetnine on how to compare bitfields


-- to check if bit 4 is set
value = reaper.SNM_GetIntConfigVar("param name", -1)
if value&4 == 4 then ....


--to set bit 4 OFF
value = reaper.SNM_SetIntConfigVar("param name", value&~4)
--to set bit 4 ON
value = reaper.SNM_SetIntConfigVar("param name", value|4)



Google search:
reaper change preference with reascript site:forum.cockos.com

===========================================================================

To have items always snap to samples (crucial for nulling)

Enable project sample rate at File -> Project settings -> Project settings tab -> Project sample rate checkbox

Tick 'Snap to project sample rate' checkbox in Snap/Grid settings window

https://forums.cockos.com/showthread.php?t=244419

===========================================================================

reaper.Main_OnCommand(command, flag) flag argument https://forum.cockos.com/showthread.php?t=212712

===========================================================================

Accessing Inline MIDI editor with scripts

The inline editors are not considered "MIDI editors" by the API.

MIDIEditor functions don't work on inline editors, so you'll have to get the take by using (for example) GetItemFromPoint and BR_IsMidiOpenInInlineEditor.

Once you have the take, the MIDI API functions work fine.

try this...

boolean reaper.BR_IsMidiOpenInInlineEditor(MediaItem_Take take)
[SWS] Check if take has MIDI inline editor open and returns true or false.

https://forum.cockos.com/showpost.php?p=2244237&postcount=4
https://forum.cockos.com/showthread.php?t=234253

--------------------------------------------------

Accessing custom action from Inline MIDI Editor

To be accessed from the Inline MIDI Editor section a custom action must be created there to begin with.

The way to access this section from the actual Inline MIDI editor is pretty convoluted. For this 'Show action list' action from the Main action list needs to be added to the Media Item Context menu which is then can be opened by right clicking on the Inline MIDI Editor ribbon.

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


===========================================================================

X-Raym ReaScript template

https://forum.cockos.com/showthread.php?t=155659
https://www.extremraym.com/en/reapack/#ReaPack_For_Developers
https://reapack.com/upload/reascript

===========================================================================

-- Logical gates

AND, exactly both are true -- if A and B / if A and A == B
OR, either one or both are true -- if A or B
NOR, exactly both are false --  if not A and not B / if not A and A == B / if not (A and B)
XOR exclusive OR, exactly one is true, but not both and not none -- if (A or B) and A ~= B
XNOR, either both or none are true -- if A == B
NAND, either one or none, but not both -- if (A or B or (not A and not B)) and A ~= B

===========================================================================

--Setting script toggle state

https://forum.cockos.com/showthread.php?t=196079
https://forum.cockos.com/showpost.php?p=1886108&postcount=12

===========================================================================

-- Custom action length limitation

https://mespotin.uber.space/Ultraschall/Reaper-Filetype-Descriptions.html#Reaper-kb.ini
https://forums.cockos.com/showthread.php?t=204595

All components whose code crosses 1024 bytes mark of the custom action entire code starting with ACT, get cut off

The custom action is truncated inside REAPER but its code in reaper-kb.ini remains intact

===========================================================================

REAPER API uses UTF-8 encoding

https://forum.cockos.com/showpost.php?p=2114674&postcount=7

===========================================================================

https://github.com/ReaTeam/ReaScripts/pull/585#discussion_r550915553

ReaPack has a feature for displaying formatted help text (via the @about) tag. 
A ReaScript can open its own ReaPack about page with the following snippet:

function help()
  local scriptName = ({reaper.get_action_context()})[2]:match("([^/\\_]+).lua$")

  if not reaper.ReaPack_GetOwner then
    reaper.MB('This feature requires ReaPack v1.2 or newer.', scriptName, 0)
    return
  end
​
  local owner = reaper.ReaPack_GetOwner(({reaper.get_action_context()})[2])
​
  if not owner then
    reaper.MB(string.format(
      'This feature is unavailable because "%s" was not installed using ReaPack.',
      scriptName), scriptName, 0)
    return
  end
​
  reaper.ReaPack_AboutInstalledPackage(owner)
  reaper.ReaPack_FreeEntry(owner)
end



other ReaPack tags

-- @website https://forum.cockos.com/member.php?u=134058
-- @changelog

===========================================================================

-- Using ReaPack

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

===========================================================================

-- ReaPack versioning


ReaPack version numbers are not decimal (they're an infinite list of integer and alphabetic components). Because 2.1 from the previous PR is lower than 1.03, I renamed it to 2.4 for the update to be distributed.

While 2.11 is valid (higher than 2.4), releasing this will prevent any versions from 2.5 to 2.10 from being released as updates in the future. Patch updates should increment a third integer component: eg. 2.4.1.


https://github.com/ReaTeam/ReaScripts/pull/693#issuecomment-809623218

===========================================================================

Docker functions

https://forums.cockos.com/showthread.php?p=1992935

===========================================================================

Using held down keys

https://forum.cockos.com/showpost.php?p=2119739&postcount=38
https://github.com/ReaTeam/ReaScripts-Templates/blob/master/Templates/X-Raym_Continuous%20push%20shortcut.lua

===========================================================================

Undo undos a bunch of undo points at once
In the Undo log it will have "Undo multiple changes" as the last thing
"undo multiple changes" appears when Reaper's undo memory is full.
The size can be changed in "Preferences -> General -> Maximum undo memory use:
Also helps checking the option "when approaching full undo memory, keep newest undo states"

Someone elsewhere has pointed out that to get a sensible behaviour one of the Undo Settings 
is "when approaching full undo memory, keep newest undo states" and that should be checked. 
The default is the somewhat thoughtless unchecking of that.

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

===========================================================================

Using chunks to change FX names

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

Using chunks, LBX chunk functions

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

Splitting strings with gmatch preserving empty strings

https://stackoverflow.com/questions/32847099/split-a-string-by-n-or-r-using-string-gmatch

for line in yourString:gmatch("([^\n]*)\n?") do
  -- do something
end

for line in chunk:gmatch("[^\r\n]+") do
  -- do something
end

===========================================================================

Lokasenna's custom Help window with GUI functions

https://forum.cockos.com/showpost.php?p=1991304&postcount=3

And my_getViewport() function

local _, _, w, h = reaper.my_getViewport(0, 0, 0, 0, 0, 0, 0, 0, 1)
local l, t, r, b = reaper.my_getViewport(0, 0, 0, 0, pl, pt, pr, pb, want_workspace)

returns left/top/right/bottom of viewport. If want_workspace is 0, then returns the full monitor coordinates, otherwise returns the workspace.

pl/pt/pr/pb define a rectangle which will be used for multimonitors -- it will return the viewport that that rectangle is on/closest to.

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


===========================================================================

Working with clipboard

https://forums.cockos.com/showthread.php?p=1948512

===========================================================================

To insert JS plugins with reaper.TrackFX_AddByName() use names stored in reaper-jsfx.ini, 

basically their file names

To query any plugin the type prefix should be omitted 

or removed with fx_name = fx_name:gsub('(.+: )','') after using 

retval, fx_name = reaper.TrackFX_GetFXName(track, fxnumber, '')


https://forums.cockos.com/showthread.php?p=2056195
https://forum.cockos.com/showthread.php?t=232120

===========================================================================

Recording processed and raw input simultaneously with input FX

You could also set the track to 4 channels, then set REAPER to monitor a mono source, 
have the input fx chain copy the raw signal to 3/4, the processed signal to 1/2, 
and set the record mode to "record input (force multichannel)". 
This way you could record the processed and raw signals in the same (4 channel) file.

https://forum.cockos.com/showpost.php?p=791307&postcount=8

see Input fx-raw & processed as per Justin (BenK-msx) info inside.RTrackTemplate

===========================================================================

VIDEO

It's usually helpful to make sure the project video dimensions are set (in project settings), 
things get a little unpredictable if you start doing video processors and that setting is left blank. 

https://forum.cockos.com/showpost.php?p=2285677&postcount=7

===========================================================================

USING gmem

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


===========================================================================

Virtual MIDI keyboard as actions toolbar using LoopBE virtual MIDI cable

1. Install LoopBE
2. Enable it for input and output in Preferences -> Audio -> MIDI Devices
3. Create a new track
4. Right click the Record button and check Recording: disable (input montoring only)
5. Right click the Record button and check Monitor input (or do it from the TCP - the loudpeaker icon)
6. Right click the Record button and check Input: MIDI -> Virtual MIDI keyboard -> All channels
(or from the drop-down menu next to input FX on the TCP)
7. Open track Routing window and select LoopBe Internal MIDI from - MIDI Hardware Output - upper drop-down menu
8. Arm track for recording having clicked in the Record button !!!!!!!! (ABSOLUTELY CRUCIAL)
9. Open Action list, select an action to assign a shortcut to, click Add button on the lower panel
10. While 'Keyboard/OSC/MIDI Input' dialogue is open, click a key on the Virtual MIDI Keyboard to assign it as a shortcut and click OK

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

see a much more detailed guide at 
https://stash.reaper.fm/49960/Trigger%20actions%20with%20MIDI%20items%20from%20within%20REAPER%20without%20MIDI%20control%20surface.pdf

===========================================================================

To use 3d party virtual MIDI keyboard/controller with LoopBE virtual MIDI cable
to assign CC messages to plugin parameters, particularly input and Monitor FX

see above 'Virtual MIDI keyboard as actions toolbar using LoopBE virtual MIDI cable'

2. Only leave MIDI input for LooBE must in Preferences -> Audio -> MIDI Devices
6. Select LoopBe Internal MIDI -> All Channels (or any one specific)
7. Irrelevant
9, 10 Irrelevant

MIDI via CC assigned under Learn dialogue only works for plugins with embedded parameter MIDI map ????????
Otherwise MIDI Link to parameter must be used under FX 'Param' button menu

===========================================================================

Creating control path midi with a virtual midi cable

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


===========================================================================

Each action line in the S&M_Cyclactions.ini is limited to 8191 characters (after the = sign). 
Anything past that limit is truncated on startup...

https://github.com/reaper-oss/sws/issues/1439#issuecomment-720184027

===========================================================================

The total amount of possible actions (across all sections) appears to be smaller than 2^16-1

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

===========================================================================

GUID


You can generate one randomly yourself if you like. On Windows REAPER uses the OS GUID functions to generate 
(on other platforms a PRNG is used). GUID collisions will generally be fine though could generate 
less-than-optimal behavior in certain instances.

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

===========================================================================

reaper.GetSubProjectFromSource(PCM_source src)

if the project is not open in a tab it will still be null
https://forums.cockos.com/showpost.php?p=2167754&postcount=3


reaper.SelectProjectInstance(ReaProject proj) -- works on projects open in tabs

p,fn=reaper.EnumProjects(1,"")
reaper.SelectProjectInstance(p)


https://forums.cockos.com/showthread.php?t=223915

===========================================================================

!!!!!!!! IN BATCH BITWISE OPERATIONS AFTER SETTING ONE FLAG THE STATE MUST BE CALLED REPEATEDLY WITH

reaper.SNM_GetIntConfigVar() FOR SETTING EVERY NEXT FLAG

===========================================================================

reaper.atexit() doesn't accept arguments, only function name, any conditons for the included function must 
be placed outside

-- cfillion

SWS Extensions are unloaded before reaper.atexit callbacks are invoked

Function to exit once SWS extension actions/functions are no longer active

https://forum.cockos.com/showpost.php?p=2365753&postcount=8


reaper.EnumProjects(0) returns nil when REAPER is exiting:

reaper.atexit(function()
  if reaper.EnumProjects(0) then -- check whether SWS functions are still available (REAPER is not exiting)
    reaper.SNM_SetDoubleConfigVar("envtranstime", origTransitionTime)
  end
end)


https://forum.cockos.com/showpost.php?p=2225040&postcount=9

===========================================================================

Video processor


https://forum.cockos.com/showthread.php?t=213455
https://forum.cockos.com/showthread.php?t=205385
https://forum.cockos.com/showthread.php?t=215078
https://mespotin.uber.space/Ultraschall/Reaper_API_Video_Documentation.html

===========================================================================

-- Media Explorer 'Play through selected track' option

you first select a track, then play in the media explorer. 
If you change selected tracks you need to restart playback or change sounds in the media explorer before the routing changes.
If multiple tracks are selected the first is used.
If no tracks are selected the main-out is used.



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



=========================================================================

-- Hexadecimal, binary, high word, low word


https://stackoverflow.com/questions/1436190/c-sharp-get-and-set-the-high-order-word-of-an-integer low and high words for take FX index

https://stackoverflow.com/questions/6090561/how-to-use-high-and-low-bytes

https://stackoverflow.com/questions/13137151/why-use-0xffff-over-65535/13137237

https://stackoverflow.com/questions/45270401/trailing-zeros-c

https://www.gamedev.net/forums/topic/414290-please-explain-high-and-low-order-bitword-terminology/

https://en.wikipedia.org/wiki/Bitwise_operation

https://stackoverflow.com/questions/10090326/how-to-extract-specific-bits-from-a-number-in-c

https://stackoverflow.com/questions/8011700/how-do-i-extract-specific-n-bits-of-a-32-bit-unsigned-integer-in-c

https://stackoverflow.com/questions/21540158/how-do-i-extract-bits-from-32-bit-number

https://www.geeksforgeeks.org/extract-k-bits-given-position-number/

https://www.rapidtables.com/convert/number/decimal-to-binary.html

https://www.rapidtables.com/calc/math/binary-calculator.html

------------------------------------------------------------------------

int(eger) has 4 bytes. word has 2 bytes. Therefore int has 2 words.

 ___ ___ ___ ___
| G | G | B | B |
|___|___|___|___| 


Green (GG) - low-order word.

Blue (BB) - high-order word.

 
The picture shows bytes in memory, in little-endian format, where the byte order is reverse than in hexadecimal representation (0xHHHHLLLL) and bit-shift operator names. 

The low-order word adds its exact value to the total value of the int. The high-order word adds its value multiplied by 0x10000 (left-shifted by 16 bits).

To store two values L and H into low-order and high-order word of integer value R, use this:

R = H<<16|L
or
R = MakeInt(L H)
 
To get low-order word and high-order word:

L = R&0xFFFF
H = R>>16


High-order byte, low-order byte

Sometimes some value can be stored in high-order byte and low-order byte of a word. Everything is similar as above.

To store two values L and H into low-order and high-order byte of word value R, use this:

R = H<<8|L

To get low-order byte and high-order byte:

L = R&0xFF
H = R>>8&0xFF


https://www.quickmacros.com/help/Other/IDP_HIWORD.html

----------------------------------------------------------------------

(x & 0x0000FFFF) << 16 | (x & 0xFFFF0000) >> 16, here x is any decimal number. What does this expression mean?


This expression uses bit masking and bit shifting.

First (x & 0x0000FFFF) is a bitwise AND (&) of x and a mask value which is given in hexadecimal. Each digit of a hexadecimal number is 4 bits, so the fact that there are 8 digits tells you that this is a 32-bit value. F is the hex for the binary pattern 1111, so 0x0000FFFF is the binary value:

00000000000000001111111111111111

A logical AND has the property that the result contains a 1 wherever both the original operands have a 1 in a given position. Since the mask contains all 1s in the bottom 16 bits, this operation has the effect of ‘letting through’ the bottom 16 bits of x, while forcing the top 16 bits to be 0.

e.g.

0101101010010110 AND 
0000000011111111 = 
0000000010010110 

The other part of the expression:

(x & 0xFFFF0000) does the opposite - it selects the top 16 bits of x, and sets the bottom 16 bits to 0.

<< 16 is a leftwise shift by 16 binary places. >> 16 is a rightwise shift by 16 binary places.

A left or right shift is fairly self-explanatory - it just shifts the bits left or right. Bits that fall off the end are lost, and ‘new’ bits shifted in are set to 0.

So something like:

000110110 << 2 → 011011000

So in the original expression, having masked off the high 16 bits, they are shifted down to become the low 16 bits. And, the low 16 bits having been isolated are shifted up to the high 16 bits.

So after those two operations, the top 16 bits of x are now at the bottom, and the bottom 16 bits of x are now at the top.

All that remains is to recombine them into a single 32-bit value. That’s what the logical OR (|) operator does. A logical OR yields a 1 where either of the original operands are a 1. However, since all of the high 16 bits are a 0 in the first expression after the shift, and all of the low 16 bits are a 0 in the second expression after the shift, it simply copies the original bits unchanged to the result, effectively reglueing the two parts together.

So the result is that the high 16 bits end up in the low 16 bits, and the low 16 bits end up in the high 16 bits. The upper and lower 16 bits have swapped places.

So that’s what it does.

The bigger question of why it does this is unanswered. It’s possibly part of some bit-smooshing operation in cryptography or at least obfuscation. Very similar code is used to swap the endianness of values received over a network (big endian) to a little-endian processor (or vice versa), but in that case the values would be operated on in chunks of 8 bits, not 16 like this.

https://www.quora.com/x-0x0000FFFF-16-x-0xFFFF0000-16-here-x-is-any-decimal-number-What-does-this-expression-mean


----------------------------------------------------------------------

A mask defines which bits you want to keep, and which bits you want to clear.

Masking is the act of applying a mask to a value. This is accomplished by doing:

Bitwise ANDing in order to extract a subset of the bits in the value
Bitwise ORing in order to set a subset of the bits in the value
Bitwise XORing in order to toggle a subset of the bits in the value
Below is an example of extracting a subset of the bits in the value:

Mask:   00001111b
Value:  01010101b

Applying the mask to the value means that we want to clear the first (higher) 4 bits, and keep the last (lower) 4 bits. Thus we have extracted the lower 4 bits. The result is:

Mask:   00001111b
Value:  01010101b
Result: 00000101b

Masking is implemented using AND, so in C we get:

uint8_t stuff(...) {
  uint8_t mask = 0x0f;   // 00001111b
  uint8_t value = 0x55;  // 01010101b
  return mask & value;
}

Here is a fairly common use-case: Extracting individual bytes from a larger word. We define the high-order bits in the word as the first byte. We use two operators for this, &, and >> (shift right). This is how we can extract the four bytes from a 32-bit integer:

void more_stuff(uint32_t value) {             // Example value: 0x01020304
    uint32_t byte1 = (value >> 24);           // 0x01020304 >> 24 is 0x01 so
                                              // no masking is necessary
    uint32_t byte2 = (value >> 16) & 0xff;    // 0x01020304 >> 16 is 0x0102 so
                                              // we must mask to get 0x02
    uint32_t byte3 = (value >> 8)  & 0xff;    // 0x01020304 >> 8 is 0x010203 so
                                              // we must mask to get 0x03
    uint32_t byte4 = value & 0xff;            // here we only mask, no shifting
                                              // is necessary
    ...
}

Notice that you could switch the order of the operators above, you could first do the mask, then the shift. The results are the same, but now you would have to use a different mask:

uint32_t byte3 = (value & 0xff00) >> 8;


We are doing AND operation in this example. There are also other masking operators- OR, XOR.

Bit-Masking means imposing mask over bits. Here is a bit-masking with AND-

     1 1 1 0 1 1 0 1   [input]
(&)  0 0 1 1 1 1 0 0    [mask]
------------------------------
     0 0 1 0 1 1 0 0  [output]

So, only the middle 4 bits (as these bits are 1 in this mask) remain.

Lets see this with XOR-

     1 1 1 0 1 1 0 1   [input]
(^)  0 0 1 1 1 1 0 0    [mask]
------------------------------
     1 1 0 1 0 0 0 1  [output]

Now, the middle 4 bits are flipped (1 became 0, 0 became 1).

So, using bit-mask we can access individual bits [https://stackoverflow.com/questions/47981/how-do-you-set-clear-and-toggle-a-single-bit]. 

Sometimes, this technique may also be used for improving performance. Take this for example-

bool isOdd(int i) {
    return i%2;
}

This function tells if an integer is odd/even. We can achieve the same result with more efficiency using bit-mask-

bool isOdd(int i) {
    return i&1;
}

Short Explanation: If the least significant bit of a binary number is 1 then it is odd (https://www.computerhope.com/jargon/l/leastsb.htm); 

for 0 it will be even. So, by doing AND with 1 we are removing all other bits except for the least significant bit i.e.:

     55  ->  0 0 1 1 0 1 1 1   [input]
(&)   1  ->  0 0 0 0 0 0 0 1    [mask]
---------------------------------------
      1  <-  0 0 0 0 0 0 0 1  [output]


Also, to convert an integer to an odd no. if it is an even number: i=i|1. 

This comes in handy when we are trying to generate a sequence like 1, 3, 5,..., 2, 4, 6,...

You can also use the following operation to find the number with only the least significant bit from an integer: lsb = i&-i


https://stackoverflow.com/questions/10493411/what-is-bit-masking

----------------------------------------------------------------------------

Each hexadecimal digit stands for four bits.

To convert the hex number 0XFFFF to decimal (or any other hexadecimal number for that matter), you follow these steps:

Step 1) Multiply the last digit by 1, Multiply the second to last digit by 16, Multiply the third to the last digit by 16 x 16, Multiply the fourth to the last digit by 16 x 16 x 16, Multiply the fifth to the last digit by 16 x 16 x 16 x 16 and so on until all the digits are used.

Step 2) Add up all the products you got from Step 1 to get the answer to 0XFFFF in decimal.

Here is the math using using the steps above showing you how to convert 0XFFFF to decimal.

F x 1 = 15
F x 16 = 240
F x 16 x 16 = 3840
F x 16 x 16 x 16 = 61440

15 + 240 + 3840 + 61440 = 65535


https://decimal.info/hex-to-decimal/F/how-to-convert-0XFFFF-to-decimal.html



HOW BITS ARE COUNTED

  0     1     2     3     4     5     6     7     8     9    10    11    12    13    14    15

0000, 0001, 0010, 0011, 0100, 0101, 0110, 0111, 1000, 1001, 1010, 1011, 1100, 1101, 1110, 1111


=========================================================================

-- Switch FX presets at runtime with ReaControlMIDI

-- https://www.youtube.com/watch?v=216O6xGWCxU

1. 	In the target plugin enable + -> Link to MIDI program change
2. 	Insert a new track
3. 	Insert ReaControlMIDI on this new track
4. 	Checkmark Bank/Program select option
5. 	Load stock GM.reabank as a bank using 'Load file' button
6. 	Optionally select channel in the MIDI channel: drop-down menu or leave it at 'all'
7. 	Create a MIDI send from the new track to the track with the target plugin
8. 	If you now manually change program in ReaControlMIDI the plugin presets must follow
9. 	Insert a MIDI item on the new track
10. 	Open the MIDI item and in the slide-up menu in the CC lane select 'Bank/Program select' entry
11. 	Double click within the CC lane and in the pop-up panel select MIDI channel which corresponds 
	to the one used by ReaControlMIDI and the target plugin and type in program number or alternatively
	load the same GM.reabank file and select the program from the drop-down list and hit OK
12.	To refine placement of the progam marker turn off snapping

In fact ReaControlMIDI isn't necessary, the MIDI send is enough. To limit MIDI Programm change message 
to a particular plugin if there're several on the track, select specific MIDI channel or Bus in the send properties
and make the target plugin only receive MIDI on this channel/Bus, while setting other plugins to other channels/Busses

Also look for custom action 'Switch preset via MIDI without running playback (if using MIDI item with PC event, select the MIDI item)'
which allows switching presets with a MIDI item without playback being on

Custom: Switch preset via MIDI without running playback (if using MIDI item with PC event, select the MIDI item)
  Item navigation: Move cursor to start of items
  View: Move cursor right 8 pixels
  Track: Toggle mute for master track
  Transport: Play
  Transport: Stop
  Track: Toggle mute for master track

a modded version of one posted at https://old.reddit.com/r/Reaper/comments/119lw66/help_reaper_marker_automation/

=========================================================================

-- ReaPack 2 ways to upload scripts in a bundle

https://github.com/ReaTeam/ReaScripts/pull/582

see 

ReaPack submit several scripts as a bundle in a metapackage (movie).mp4
ReaPack submit several scripts as a bundle reusing the code (movie).mp4


=========================================================================

-- Scripts and themes

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


=========================================================================

-- Round up a value to certain number of decimal places

math.floor((result+.005)*100)/100 -- 2

math.floor((result+.0005)*1000)/1000 -- 3

https://old.reddit.com/r/Reaper/comments/mx49y1/looking_for_a_script_to_edit_an_action/


=========================================================================

GetMediaItemTake_Source() doesn't work for reversed takes and sections, that is those
which have either 'Section' or 'Reverse' checkboxes checked in the 'Item properties' window (F2)

Use GetMediaSourceParent() instead

https://forums.cockos.com/showthread.php?t=231606

=========================================================================

-- Formatting Chapter tag of ID3 metadata


If you add project markers named "CHAP=This is the first chapter", "CHAP=Chapter 2", 

"CHAP=Here is another chapter", etc, then render to MP3 with embed metadata enabled, 

the chapter markers should be embedded in the MP3 (they're also supported by FLAC).

https://forum.cockos.com/showthread.php?t=214245#10


The project marker should read "CHAP=some content". The chapters will be automatically numbered.

The mp3 chapter tag encoding doesn't support chapter numbers as a separate field from the chapter name

https://forum.cockos.com/showthread.php?t=235766&highlight=chapter


This is possible in REAPER 6.16 and later. If you open the project metadata dialog, 

you can see all of the types of metadata that REAPER supports, including chapter markers, 

which are supported for mp3, flac, ogg, and opus files. You can embed chapter markers 

by creating project markers or regions named "CHAP=XXX", for example "CHAP=Introduction", 

"CHAP=A Dark and Stormy Night", etc. In the render dialog, check the box to embed the 

metadata into the rendered file.


https://forum.cockos.com/showthread.php?t=245738#2


=========================================================================

-- Automatic cutting up takes with empty items during recording / auto-punch with loop and context (pre/post-roll)

Automatic cutting up! :)

Say you know that your audio/midi performance should only play on bars 4-8 before you record it. But you also know, that you need to start playing/listening before bar 4 and your last note/input will continue after bar 8.

Then you put an empty item on the track (to which recording is being done).

Now, if you record something from bars 1-12 on that track, it will be broken up into three items: 1->4, 4->8, and 8->12. This would make deleting the areas outside of 4->8 only a few clicks.

Personally, I think it's easier/better to do this editing after the fact for most use-cases. One workflow where this would be useful is if you're recording yourself with a loop of the section you're working on. You could:

    Put a loop from the point you need to start listening to the point where you'll be ready for another pass.
    Put an empty item roughly where the actual take will happen (inside the loop area).
    Now you can hit record, walk away from the computer and do as many takes as you need.
    When you get back, it will be trivial to remove any noise in the pre/post-roll sections.

Again, this is very niche, but it is a valid workflow. In most cases, it's probably faster to edit manually, but it might be useful in some scenarios where things are off-grid.

(Caveat: I'm assuming the default Reaper behaviour)


https://old.reddit.com/r/Reaper/comments/n5v4pw/empty_item/gx7tdzi/

=========================================================================


-- Options -> Show overlapping media items in lanes


Useful for avoiding a situation when MIDI automation affects overlapping notes of different drum sounds.
Being separated to different items which still sit on the same track and are fed MIDI from the same plugin
overlapping notes of different parts can have independent MIDI automation.

https://old.reddit.com/r/Reaper/comments/czpl7a/multiple_midi_items_stacking_on_a_single_track_how/


=========================================================================

-- To swingify a complete song

1. Set project BPM to the target song BPM, the song MUST fit the project tempo and vice versa
2. Align the item with the grid/ruler
3. Set grid to 16th notes
4. Add stretch markers to the song item at every 16th division (with custom action or script preferably)
5. Adjust swing grid to taste
6. Run Item: Snap stretch markers to grid

Swing shifts every 2nd division in the grid regardless of the grid resolution

online service http://www.musinformatics.com/swingify

=========================================================================

-- ashcat_lt ReaComp transparent RMS buss compression technique

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


I've been using a technique lately for a very transparent kind of volume leveling. 

It works well for vocals (a lot like that VocalRider plugin, I think), 
but I also do it right on the Master to get a bit more "loudness" without 
losing so much transient information.
The trick is to set the RMS window pretty big, but then set the pre-comp 
to somewhere around half the RMS window. This way, the compressor is reacting 
to the average level around the current sample - both past and future - so that 
if one bear is significantly louder than the next, it sort of gently 
dips the volume leading into the louder hit, and then comes back up afterwards 
in a pretty natural way. Attack and release are basically built into the process, 
so I'll set those parameters to 0, and I usually use a very low ratio - 1.1 or 1.2. 
Then, for even greater transparency, I'll usually set the threshold so that it just 
barely starts squishing on some of the louder parts, and then crank the knee where 
up so that it's almost always doing just a tiny bit, but it's almost always in the 
knee, and almost never hits the full ratio. I sometimes try to calculate the time 
constants to cover a beat or two of the song's tempo, but I've found that it's not 
super critical, as long as it's pretty long. Pre-comp only goes to 250ms, I think, 
so that limits things a little. All of the really fast transients still get through 
with the same proportional relationship compared to what's going on around them, 
but the overall dynamic range is reduced very transparently.


Edit - it's worth at least mentioning that the RMS level of anything that's not 
a square wave is always less than its peak level. At least to a certain point, 
the longer you set the RMS window, the lower the level that hits the detector and shows 
on the meter, and the lower the threshold needed to get the same amount of gain reduction. 
It can be kind of tough to A/B different RMS sizes, or even say for sure where any 
perceived differences are coming from.

I also use it with all time constants at zero as a variable-slope clipper. It's so darn 
versatile, even without side-chaining and pre/post EQ finagling.

Just grab some mix, remove any compression/limiting you've got on the Master, 
stick in ReaComp and go for it.

I've found that by shelving down the low end just a bit before the slow gooey prescient 
comp, and then shelving back up on the other end, I'm getting some almost scary dynamics 
while pushing crest factors up to -12dbfs and more. In fact, I'm worried that I might 
be overdoing things, but it just sounds so damn good!

Edit -
Also, when I'm doing this slow thing, I set attack and release to 0 because they're 
essentially redundant and in fact work against what i'm trying to acheive. Basically, 
the relationship of the pre-comp to the RMS time determines your attack/release 
times, but you can push your attacks to start before the transients. When pre-comp is 
exactly half of RMS, then it is applying maximum gain reduction exactly when it is loudest, 
it heads down a little early, and comes back a little late, and it lets anything fast that 
happens kind of just sail on through. If pre-comp is a little less than half, then it's 
a little more like a traditional attack/release, in that it reaches maximum crush a little 
late. Going the other way is like having a very timid soundguy anticipating your moves and 
turning down the fader when it looks like your going to get loud.


Example settings:

Comp 1: pre-comp 250, attack/release 0, ratio 1.2, knee size 24 db, lowpass 20000, highpass 0, RMS size 509.8, thresh -13.1
Comp 2: pre-comp 50, attack/release 0, ratio 2.6, knee size 6.3 db, lowpass 20000, highpass 0, RMS size 105, thresh -10
Comp 3: pre-comp 5, attack/release 0, ratio 5.9, knee size 6.3 db, lowpass 20000, highpass 0, RMS size 10.8, thresh -8.3

Those three comps were in series on the Master. Slow faster fastest. Each a little harder 
but at a higher threshold. Don't remember what it was from. I might regret it now, and don't 
much use that arrangement anymore. Nowadays it's mostly just the first really slow one with 
preemphasis/deemphasis from ReaEQ on either side followed by a saturator.


whiteaxxxe's example settings: precomp 250ms, RMS size 500ms, attack & release 0, threshold to taste.



=========================================================================

-- File size for recording/gluing settings

https://forum.cockos.com/showthread.php?t=173567
https://forums.cockos.com/showthread.php?p=1944272
https://forum.cockos.com/showthread.php?t=224828


=========================================================================

-- To place sub-project in its own folder with a custom name


Specify a secondary recording path (must be full) in the Project settings and select 'Secondary only' 
under 'Record to audio path' in the Track Recording settings. 
But for each new file you'll have to update the path in the Project settings.

The effective Track Recording settings path is the one set for the uppermost track if several are selected

Secondary recording path is independent of the primary

Subproject file name convention is defined at Preferences -> Recording -> Filename format for recorded files


In fact all this may be overkill. If you set Preferences -> Recording -> Filename format to $trackslashes and 

name your topmost selected track say subproject/one a subproject one.rpp will be crated in folder \subproject.

The name can be formatted differently with wildcards. With the said track named subproject/ and name format 

being $trackslashes$datetime the subproject named after the current date and time will be created in folder \subproject

If primary media path is set in the Project settings, that's where the subproject folder will be placed under.


https://old.reddit.com/r/Reaper/comments/nmvu3b/subproject_default_save_settings/

=========================================================================

-- Under- overrun indication during recording

The transport flashes red on a processing underrun, and optionally flashes yellow on a hardware underrun:
option Transport: Flash transport yellow on possible audio device underrun in Transport context menu

https://forum.cockos.com/showthread.php?p=1942953#9

=========================================================================

-- Item granular volume adjustment

First activate take volume envelope, for example with Mouse modifiers: 

Media item context - double click Shift+Ctrl - SWS/S&M: Show take volume envelope OR Take: Toggle take volume envelope

Mouse Modifiers:

Arrange view context - right drag Shift+Ctrl - Marquee select items and time ignoring snap (both options can be checked)

Envelope segment context - left drag Shift+Ctrl - Move envelope segment [only part within time selection is moved]


=========================================================================

-- If REAPER doesn't fully save the state of some plugins try enabling 

Run As -> Dedicated process option in the respective plugin context menu within the FX browser


https://old.reddit.com/r/Reaper/comments/nq2hzo/anyone_else_have_issues_with_reaper_resetting/h0aajn9/


=========================================================================

-- Same script commandID versions in different Action list sections


In sections other than Main the command ID of the script at the same path is displayed with appended infix, e.g.

Main 0: RS9de8cea86eb5a13361c01d1f0ae1d5f86c998101 -- no infix

MIDI Editor 32060: RS7d3c_9de8cea86eb5a13361c01d1f0ae1d5f86c998101 -- infix is 7d3c_ (7d3c is 32060 in hexadecimal)

MIDI Event list editor 32061: RS7d3d_9de8cea86eb5a13361c01d1f0ae1d5f86c998101 -- infix is 7d3d_ (7d3d is 32061 in hexadecimal)

MIDI Inline editor 32062: RS7d3e_9de8cea86eb5a13361c01d1f0ae1d5f86c998101 -- infix is 7d3e_ (7d3e is 32062 in hexadecimal)

Media Explorer 32063: RS7d3f_9de8cea86eb5a13361c01d1f0ae1d5f86c998101  -- infix is 7d3f_ (7d3f is 32063 in hexadecimal)


This is also reflected in the .ini files

The numeric command IDs from different sections differ by the last digit 

The difference between commandIDs of the Main and MIDI Editor sections is exactly 1, e.g.

56614 and 56613 of which the one stemming from the Main section is greater

But only if REAPER starts with both of them present. If one is installed while REAPER is already running

then it's assigned what's presumably the first availabe numeric commandID which sticks until restart.

When a script is deleted, its entry is removed from reaper-kb.ini, but is still cached within REAPER

and not recognized until restart.

At the same time NamedCommandLookup() using named commandID of the MIDI Editor instance of the script 

from which the infix has been stripped DOES return Main section numeric commandID even if there's no script in there.

The same is true for ReverseNamedCommandLookup() but it's less useful because numeric relationships between 

commandIDs of instances in different section are not so obvious

===================================================================================

--  Split items and space slices evently

1. Set Ripple mode per track to ON
2. Auto trim/split to split
3. Set Ripple mode to OFF
4. Select all items besides the very first

5. Nudge/set items:
Nuge - position - value to space out by - measure unit
6. After each nudge select 1 less items until the very last
OR
Use SWS 'Reposition selected items..' which acts in one go, all must be selected

===================================================================================

-- RS5k

About the new TrackFX_SetNamedConfigParm(), TrackFX_GetNamedConfigParm(), TakeFX_SetNamedConfigParm(), and TakeFX_GetNamedConfigParm() APIs:

These are designed to allow setting/getting plug-in specific parameters that are not exposed as normal VST-style parameters. The first use of this is for ReaSamplomatic5k, to allow getting/setting the list of sample files.

Lua examples:

ok, fn = reaper.TrackFX_GetNamedConfigParm(track,fx, "FILE0") -- get first sample filename
ok, fn2 = reaper.TrackFX_GetNamedConfigParm(track,fx, "FILE1") -- get second sample filename


ok = reaper.TrackFX_SetNamedConfigParm(track,fx, "FILE0", fn) -- set first sample filename
ok = reaper.TrackFX_SetNamedConfigParm(track,fx, "FILE1", fn2) -- set second sample filename -- note that FILE0 must exist before you can set FILE1, etc.

ok = reaper.TrackFX_SetNamedConfigParm(track,fx, "-FILE0", "") -- remove first sample (second sample becomes first sample)

ok = reaper.TrackFX_SetNamedConfigParm(track,fx, "+FILE0", fn) -- insert sample (old FILE0 becomes FILE1)

ok = reaper.TrackFX_SetNamedConfigParm(track,fx, "-FILE*", "") -- remove all samples


-- Finally, when the script is finished updating the samples, it should call (this will trigger actually loading the samples from disk, adding an undo point, etc):
reaper.TrackFX_SetNamedConfigParm(track,fx, "DONE","")
If other REAPER plug-ins have parameters that you'd like having script access to, let me know. I suppose having this for JSFX filename-parameters would be handy too.

https://forum.cockos.com/showthread.php?p=1817782#post1817782
https://forum.cockos.com/showpost.php?p=1817782&postcount=5

===================================================================================

-- RS5k as a multi-sample player using List velocity layers

Use Insert Piz Here midiConverter3 plugin upstream from the RS5k instance and set it to convert pitch to velocity


https://github.com/michaelsjackson/reaper_forums/issues/8
https://forum.cockos.com/showthread.php?t=237804


===================================================================================

-- FX local to project

JS per-project are JS found in /project_path/Effects
So if you want to give someone a project with some custom FX, you can 
(and they won't have to install them).


If a local JSFX file becomes unavailable during the session, REAPER reuses a file with the same FX name
from the \Effects directory, if any, when the unavailable JSFX is loaded from the FX Browser


If you don't want to install the JS library

Go to Program Files\REAPER\InstallData, rename or delete the Effects directory, 
and create an empty file named "Effects". This will prevent the installer from writing 
to this path (and REAPER won't try to replace your AppData Effects directory with the file).


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


JSFX local to project are only displayed in the FX browser if the project is saved and they aren't listed in reaper-jsfx.ini

/ReaperBlog_Macro Controller test.jsfx" "" // local JSFX path in the chunk

JS: /ReaperBlog_Macro Controller test.jsfx // local JSFX name displayed in the FX chain

The format of local JSFX preset file name in the REAPER /presets folder is js-_Project__(JSFX file name).ini

So in order for a local JSFX to load presets saved using its regular version the original preset file must be duplicated 

and renamed to match the abovementioned format

===================================================================================

-- GUI libraries for REAPER

Reaper Toolkit by tack https://forum.cockos.com/showthread.php?t=255897 ||  https://reapertoolkit.dev/

Rea ImGUI by cfillion https://forums.cockos.com/showthread.php?t=250419

ReaImGui Knobs https://github.com/AntoineBalaine/perken-reaper-scripts/tree/rack/imgui/knobs   https://forums.cockos.com/showthread.php?t=288811

Scythe v3 by Lokasenna https://jalovatt.github.io/scythe/  || https://github.com/jalovatt/scythe || 
Lokasenna v1
https://forum.cockos.com/showthread.php?t=176662

Lokasenna v2
https://github.com/jalovatt/Lokasenna_GUI + ReaTeam repo
https://forum.cockos.com/showthread.php?t=177772
https://mespotin.uber.space/3rd_party_modules/Lokasenna_GUI%20v2/Developer%20Tools/Documentation.html

eugen2777's library https://github.com/EUGEN27771/ReaScripts/blob/master/Templates/GUI/gen_Simple%20GUI%20template%20for%20scripts.lua

A mod of eugen2777's library by Daniel Lumertz https://forum.cockos.com/showpost.php?p=2383883&postcount=101



https://forum.cockos.com/showpost.php?p=2466618&postcount=5


===================================================================================

-- Lua MIDI library

MIDI Utils API by sockmonkey72

https://forum.cockos.com/showthread.php?p=2630436


===================================================================================

-- Ultraschall Lua API by mespotine

https://forum.cockos.com/showthread.php?t=214539
https://ultraschall.fm/api/
https://mespotin.uber.space/Ultraschall/US_Api_Introduction_and_Concepts.html
https://github.com/Ultraschall/ultraschall-lua-api-for-reaper/


===================================================================================

-- Record from soundcard output


Set your audio driver to WASAPI in shared loopback mode, set your track input to stereo 1/2 and hit record.

Be sure to turn off monitoring beforehand, otherwise you'll get feedback

If there's no input right after setting the audio driver, make REAPER program window inactive and then active again


https://old.reddit.com/r/Reaper/comments/q130ik/hey_does_anybody_know_how_route_browser_music_to/hfc4ze4/


===================================================================================

-- If render is slow


On Preferences->Device->[x] Request Block Size, I'm set up for 16. 16 is slow at rendering - 
tops out about 3.0 times realtime.

If I set this to 1024 ( the limit on my interface ) , I get a vast increase in speed - 
like "blink and you miss it" fast. It's not quite the 192 ratio between 16 and 1024, more like 77 times real time.

Changing this isn't a real hardship - I just have to make sure I set it back when I'm done rendering. 


It does seem to cause a reset on the ASIO driver ( there's a couple seconds before the change takes effect.)


https://old.reddit.com/r/Reaper/comments/q1otpb/slow_render_culprit_found/


===================================================================================

-- Humanizing stretch marker snapping

Add stretch markers to transients in item or according to the note division the item content corresponds to. 

Set the grid to the finest division 1/256 and run Snap stretch markers to grid 

https://old.reddit.com/r/Reaper/comments/ogs0d0/about_audio_quantization/



===================================================================================

-- Importing with BPM info in the file name

-- Preferences -> Media -> Video/Import/Misc -> Media with embedded tempo information -> When media suggests BPM 

The bpm-in-filename conversion only works if the filename starts with a number, which yours does, and the file is (within error bars) an exact number of beats or half-beats using that tempo, which yours is not. The point is to avoid converting based on numbers that aren't tempos.

https://forum.cockos.com/showpost.php?p=2216061&postcount=5


===================================================================================

-- Remove reverb with compressor and polarity flip


1. Place the same material on two different tracks
2. Flip polarity on one of the tracks
3. Load compressor on the track with flipped polarity
The compressor must preferably have a short attack, at the very least the attack must be set to a minimum
4. Lower threshhold untill the comp starts reacting, then tweak release time 
and maybe the threshhold and mix between dry and wet signals


https://www.youtube.com/watch?v=9c57YnS7ppA
https://riddlermike.wordpress.com/2013/08/25/deverb-for-free-removing-reverb-using-free-plugins/

===================================================================================

-- Command IDs

there are two kinds of command IDs. The built-in actions have 
a fixed numeric ID which can be directly used. 
Extension plugin, custom and script actions are identified 
by a "named command ID" (for scripts it's a hash derived from the path). 
These actions also have an underlying numeric ID but, 
because it's determined at runtime, it's not guaranteed to always be the same.

A named command ID must be converted to its current underlying 
numeric ID using NamedCommandLookup before being able to run 
the script using Main_OnCommand or an external program like 
AutoHotkey posting a WM_COMMAND message.

cfillion


https://forum.cockos.com/showthread.php?t=207894 post 8


===================================================================================

-- SWS extension window state data stored in reaper.ini


input = '6B010000F900000039040000030200000000000000000000A7'

data = input:gsub('%x%x', function(byte) return string.char(tonumber(byte, 16)) end)

left, top, right, bottom, state, whichdock = string.unpack(' General -> 'Maximum undo history' may glitch out if the input number is too big, e.g. 9999999999

https://old.reddit.com/r/Reaper/comments/rh7uwz/reaper_limits_my_undo_history_to_8/


==============================================================

-- Media item rate


Orig item length = current length / rate

Rate = current item length / new item length  (if longer then rate is less than 1, otherwise greater)

Rate is relative to orig item length, isn't directly linked to BPM


==============================================================

-- P_EXT

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

So we can implement custom data into some chunks, like track, since v6.36.

track = reaper.GetTrack(0,0)
retval = reaper.GetSetMediaTrackInfo_String(track, "P_EXT:SINGLE LINE", "Single Line", true)

which is written like this in the .rpp:
 


Though it is very different if it is in multiline

retval = reaper.GetSetMediaTrackInfo_String(track, "P_EXT:MULTI LINE", "Line 1\nLine 2", true)

it output:


>

Note that similar behavior can be found using other ExtState functions

From SetProjExtState in multiline:

  
    >
  >

==============================================================

-- Expand Action list synonym theaurus

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

schwa:

You can expand Action list search synonym list via a langpack. 
If you are already using a langpack (to translate strings in REAPER to another language or dialect), edit it; 
if not, download the sample langpack from landoleet.org. Add or edit this section:

Code:
[actionlist_synonyms]
;0000000000000001=open,display,view,show,hide
;0000000000000002=delete,clear,remove
;0000000000000003=insert,add
;0000000000000004=deselect,unselect

To add "erase" as a synonym for delete:

Code:
[actionlist_synonyms]
;0000000000000001=open,display,view,show,hide
0000000000000002=delete,clear,remove,erase
;0000000000000003=insert,add
;0000000000000004=deselect,unselect

To add another synonym group:

Code:
[actionlist_synonyms]
;0000000000000001=open,display,view,show,hide
0000000000000002=delete,clear,remove,erase
;0000000000000003=insert,add
;0000000000000004=deselect,unselect
0000000000000005=item,thing,object


==============================================================

-- IDE Theme

Open Theme development / tweaker and scroll down to the bottom to the section ReaScript/JSFX etc. 

Double click on the section name to open context menu and use Load default IDE theme

Alternatively place the following code into a .txt file, save and rename the extension into .ReaperIDETheme, 

then load by double clicking on the aforementioned section name in the Tweaker and going Load IDE theme from file. 

It's v5 default IDE color scheme

[REAPER_IDE_THEME]
ide_colors=c0c0c0 000000 c0c0c0 0000c0 000000 00c0c0 00ffff 000000 00ff00 000000 6080c0 000000 c0c0c0 c00000 ffff00 000000 ff8080 000000 00c0ff 000000 ffc0c0 000000 c0ff80 000000 000000 00c0c0 c0c0c0 c00000 c0c000 000000

https://old.reddit.com/r/Reaper/comments/je0mf3/cant_see_text_in_jsfx_internal_editor/g9cqbtq/

==============================================================

-- Create a measure from a MIDI item

1. Set the MIDI item time base to Time

2. Set it to ignore project tempo at Media Item Properties -> Properties... (button) --- otherwise it loops

Can be done automatically with actions:

	SWS/BR: Enable "Ignore project tempo" for selected MIDI items (use tempo at item's start)
	SWS/BR: Enable "Ignore project tempo" for selected MIDI items preserving time position of MIDI events (use tempo at item's start)

3. Use any of the 3 actions:
	
	Create measure from time selection (detect tempo, try to create single measure)
	Create measure from time selection (new time signature)..

==============================================================

-- Lag in playback start

If occurs when cursor position is changed during playback

May be due to 'Do not change playback position immediately when seeking (smooth seek)' option being enabled

https://old.reddit.com/r/Reaper/comments/rpslue/playback_used_to_be_instant_when_click_elsewhere/

==============================================================

-- To move selected MIDI note(s) regardless of mouse cursor position


In Preferences -> Editing behavior -> Mouse modifiers -> Context: MIDI Piano roll -> left drag

Bind action 'Move selected notes -> Just move' to a modifier and when the modifier is held down 

you'll be able to move a note regardless of the mouse cursor position

The same can be done for 'Move selected notes -> Ignoring snap' by binding it to a different modifier

https://old.reddit.com/r/Reaper/comments/rtbxtk/grabbing_notes_on_piano_roll/

==============================================================

-- Creating shorctuts for REAPER CLI commands

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

==============================================================

-- Resampling in the signal chain


Resampling happens before all FX (all FX run at the same samplerate).

https://www.askjf.com/index.php?q=5388s

==============================================================

-- IDE breakpoints

This is for defer-scripts. You can uncheck the "Run defer() code"-checkbox. 

After that, you can run each defer-cycle individually by clicking at the Step-button.

the atexit-Button runs all functions that are associated by "gfx.atexit()".

So if you want to stop the (paused) defer-script with all atexitted-functions, just hit this button.


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

==============================================================

-- Marker/Region dump format

#,Name,Start,End,Length,Color
M1,,2.4.00,,,0000A0
M3,test,2.4.56,,,
R1,,3.4.00,4.2.00,0.2.00,FF0080

measures and beats make sure that on import the position isn't affected
by tempo change

time signature though affects position as well, so at import must 
be recalculated, native action doesn't do that


==============================================================

Q: Is there a possibility for the instance effect oversampling in reaper 
to allow higher oversampling rates than 768k? 

Justin on June 1 2022: If you want to experiment, you can edit the .rpp, look for NEXT_FX_OVERSAMPLE. 
0=no oversampling, 1=~96k, 2=~192k, etc. 15 is the max allowed. It might blow up.

ah oops actually we limit it to *16

will allow higher values via script in a build coming soon

increasing the limit to 10 (1024x), or 45-49MHz...

https://www.askjf.com/index.php?q=6206s

==============================================================

-- Rendering multi-channel


There's action Track: Render tracks to multichannel post-fader stem tracks (and mute originals)

This is done in place, meaning the rendered item will be added to the project.

For this to work route each track to a single bus track set to have 8 channels under 'Track channels:' in the I/O preferences. 
Then again in the I/O preferences of the bus track route each send to a different channel under 'Receive from track:', that is 1 through 8. 
Then select the bus track and run the action.

You can also render them out via Render dialogue having set 'Channels:' menu to 8 and 'Source:' menu to 'Master mix'. 
But first set the Master track to 8 channels and in I/O preferences under 'Parent channels:' of each of the 8 tracks to be rendered 
choose a different mono channel.

If 'Selected track (stems)' instead of 'Master mix' is selected in 'Source:' menu, 'Channels:' menu must be set to the track channel count, i.e. 8


+ https://forums.cockos.com/showthread.php?t=100687
+ https://forum.cockos.com/showthread.php?t=165064

==============================================================

-- Observations on overlapping items in lanes, 
-- irrelevant for builds 6.54 and onward (https://forum.cockos.com/showthread.php?t=267390)


Within track chunk chunks of overlapping items aren't listed in ascending order of their IIDs as they are displayed in lanes, but according to their global 

relative position expressed as IP_ITEMNUMBER parameter value of GetMediaItemInfo_Value() function and returned as the iterator value in items loop.


Both actions (discontinued since 6.54)

Item lanes: Move item down one lane (when showing overlapping items in lanes)

Item lanes: Move item up one lane (when showing overlapping items in lanes)

when first applied cause actual IIDs in overlapping items change from none to the number of such items less 1, i.e. nil, 1, 2, 3 etc, regardless of the direction

and the actual item they're applied to, the sequence is initialized from top to bottom

different clusters of overlapping items can have identical IID sequences which doesn't cause conflict

they can also co-exist with identically IID indexed non-overlapping items

item numbers (IP_ITEMNUMBER) within track do not match their IIDs, neither in values nor in order of their sequence,

applying the above actions doesn't change IP_ITEMNUMBER values


Within track chunk chunks of overlapping items aren't listed in ascending order of their IIDs as they are displayed in lanes, but according to their global 

relative position expressed as IP_ITEMNUMBER parameter value of GetMediaItemInfo_Value() function and returned as the iterator value in items loop. 


What governs the order of overlapping items with identical IIDs i couldn't figure out (maybe their actual IDs). What governs on the track the order of 

overlapping items with identical start and end coordinates (not their vertical order when they're displayed in lanes) i couldn't figure out either. It may be 

linked to their pointers.


When overlapping items with identical IIDs from the same cluster are manipulated (shifted, trimmed etc.) their order in lanes changes if the change affects their 

order within track.


When imploding while the lanes are collapsed the logic of item ordering within track isn't clear, it's difficult to predict which item will end up being the 

outermost (visible).


When copying an item with IID, the IID of the copy only changes if the copy's start or end coordinates differ from the source item, if an item is copied and 

immediately pasted over itself so that two instances overlap, the copy's IID doesn't change. If the source item didn't have IID because of being the 1st of the 

overlapping items (as happens after applying the above native actions), for the copy pasted over it the IID is autogenerated following the global sequence


When overlapping item lanes are collapsed, the visible item is the one whose chunk is the last in the sequence of the overlapping items cluster inside the track 

chunk. Overlapping item lanes are collapsed when I_LASTY values of all the items in the cluster are <= 15 which is true for builds prior to 6.54: 

1) at certain TCP height while 'Maximum number of lanes when showing overlapping items in lanes' option value at Preferences -> Appearance option is set to be 
equal or greater than the actual number of mutually overlapping items, 

2) when this value is set to 1 and for builds prior to 6.54 

3) when Preferences -> Appearance -> Media Item Positioning -> Offset by is set to 0


Copying overlapping items, re-ordered either by actions or by this script, doesn't keep the same order for the copies, instead they're reordered according to 

items order on the track and within the track chunk. https://forum.cockos.com/showthread.php?t=265287


==============================================================

-- reaper-jsfx.ini


The file seems to list ALL JSFX

REV entries in my file are fewer than the NAME entries by 3, 

because 2 NAME entries point to non-existent files and therefore only contain path, 

without the name (which helps to identify them), the 3d one references 

a non-JSFX txt file which doesn't have desc: tag.

These 3 odd NAME entries are the last in the NAME entries list, 

don't follow the alphabetic order of preceding NAME entries and instead 

alphabetically sorted among themselves.

So REV entries apparently only apply to files which exist and contain desc: tag.

Changes to JSFX names made in the NAME entries inside the file is reflected in the FX browser

after REAPER is restarted but renders these FX unavailable.


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

==============================================================

-- Categories in FX Browser

A plugin can only reside in one category.

When plugins cache is cleared at Preferences -> Plugins -> VST -> Re-scan -> Clear cache ...

custom categories are lost.


==============================================================

-- 'No-op (no action)' action

schwa:

The action is meant to collect shortcuts which were of action which no longer exists on the system, 
such as a custom action that has been deleted, a reascript that no longer exists, or an extension action 
that is not there because the extension changed or is no longer installed.

It shows up as "no-op" instead of unassigned because if whatever it was bound to does come back 
(like if you reinstall a missing extension), Reaper can restore the shortcut.

https://forums.cockos.com/showthread.php?t=52167


It goes back to the old way of setting up macros, where it was necessary to blank out unused slots. 
Seems so long ago.... I suspect it's left in for backwards compatibility.


https://forums.cockos.com/showthread.php?t=25445#4

==============================================================

-- Using JS plugin sliders to do the math


Q: I'd like to have a reverb which adjusts the room size depending on the panning, with central pan=small room, 

100% right or left, big room. I know I can link parameters with click->parameter->link from midi or fx parameter, 

but that won't work as it will make the room small when we are panned to the left, medium in the middle and big in th right, 

which is not what I want.

I would need the room size parameter (S) to be linked to the pan one (P) through the function S=|P|+ c, 

with c being the value of the room with central panning, which I can decide.


A: Create a JS plugin with two parameters. Parameter one will be linked to whatever is generating the LFO value. 

The JS is taking this value and calculating the function, with the result going to parameter two. 

Link parameter two to the relevant parameter on your reverb. Very handy technique for one-off interoperability.

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

desc: Parameter Converter
//tags: utility
//author: yellowmix

// no audio
in_pin:none
out_pin:none

slider1:0<0,100>Assign this to Input Parameter
slider2:0<0,100>Assign this to Output Parameter

@sample

  slider2 = slider1 * 0.5

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

Change desc to describe what your plugin does, author to your name, change the logic in the @sample section to whatever you need. 

Feel free to change the slider range and values to match the input/output.


https://old.reddit.com/r/Reaper/comments/vls2vn/can_i_link_two_parameters_using_mathemathical/

==============================================================

-- Mouse position / context dependent actions

Reno.thestraws

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

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


==============================================================

-- Automation modes

https://www.youtube.com/watch?v=ckjl-rpzDPA
https://www.youtube.com/watch?v=JHGGZiXUnqI

1. Trim/Read - allows previewing and trimming the envelope by moving/affecting the control of the parameter being automated 
without affecting the actual curve, so effectively changing envelope Base parameter available also in automation item properties.
When activated, the control setting is transfered to the envelope while the control itself is reset, which allows trimming.
During playback the control of the automated parameter doesn't follow the envelope's existing curve.

2. Read - In playback the control of the automated parameter follows the envelope's existing curve. Any manual adjustments
to the parameter are ignored being overriden by the envelope.

3. Touch - allows punching in envelope change by moving/affecting the control of the parameter being automated.
Only applies change for as long as it's being effected by the user, otherwise simply follows the envelope's existing curve.
As soon as the user stops changing the parameter the value it was set to before automation recording started is restored.

4. Latch - allows writing envelope curve by moving/affecting the control of the parameter being automated.
Once effected by the user continues writing envelope even without user interference until transport is stopped.
If during playback the control of the automated parameter isn't affected by the user, it simply follows the envelope's existing curve.
So differs from Touch mode in that the parameter value it was set to before automation recording started isn't restored
and the last registered value continues to be recorded.

5.Latch preview - doesn't write an envelope curve, only allows prevewing how changing the setting of the parameter being automated affects the output.
If during playback the control of the automated parameter isn't affected by the user, it simply follows the envelope's existing curve.

6. Write - writes envelope curve immediately without user having to move/affect the control of the parameter being automated. 
Like in the Latch mode continues writing the last value the parameter was set to. Main mode to write automation when there's none.
During playback overwrites the envelope using the value the control has been last parked at, therefore isn't suitable for previewing the envelope. 
To preview use Read, Trim/Read or Touch.


-- Showcase of actions 'Automation: Write current values for actively-writing envelopes ...'


https://www.youtube.com/watch?v=8szptXeVDCo


==============================================================

-- RS5k round robin setup


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

https://forum.cockos.com/showthread.php?t=131531#35
https://forum.cockos.com/showthread.php?t=131531&page=3#85

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

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

https://www.google.com/search?q=reaper+round+robin+percentage

https://www.google.com/search?q=ReaSamplomatic+round-robin

https://www.youtube.com/watch?v=zjfsUKgOVr4


https://forums.cockos.com/showthread.php?p=1366920

# of 
instances  	1   2   3   4   5   6   7   8   9   10   11   12

1	       100 50  33  25   20  17  14  13  11  10   9    8

2		  100  50  33   25  20  17  14  13  11   10   9

3		      100  50   33  25  20  17  14  13   11   10

4			  100   50  33  25  20  17  14   13   11

5			       100  50  33  25  20  17   14   13

6				   100  50  33  25  20   17   14

7				       100  50  33  25   20   17

8					   100  50  33   25   20

9					       100  50   33   25

10					           100   50   33

11							100   50

12							     100


remember to check Remove played notes from FX chain on all RS5k instances 

but the last in the chain, the one with 100% probability


RR formula:

probability per instance in % = 100 / (number or RS5k instances - instance number + 1)

https://forum.cockos.com/showthread.php?t=131531&page=3#96

-----------------------------------------------------------------------

Round-robin with multiple velocities


If you have 8 velocities and 6 hits per velocity, loading 48 samples into one instance of RS5k 

is still the wrong way to do it. RS5k will take those 48 samples and use them as 48 different velocities. 

Try playing 6 consecutive hits at the same velocity and it will always play the same sample.

It's a bit counter intuitive but you need to take those 48 samples and divide them in 6 groups made of 8 samples 

of different velocities. Something like this:

Group 1: Hardest 1, Hard 1, regular 1,Soft 1, softest 1, ghost 1... (8 samples per group)

Group 2: Hardest 2, Hard 2, regular 2,Soft 2, softest 2, ghost 2...

...

Group 6: Hardest 6, Hard 6, regular 6,Soft 6, softest 6, ghost 6...

Then you need to load 6 instances of RS5k on the same track, one for every group, and activate the round robin button 

in every instance of the plugin. Then set the probability from 1/6 in the first instance, then 1/5 and so on until 1 

in the final instance of RS5K in the track. Also, every instance of RS5k has to have the "remove played notes from midi stream" ON.


https://www.reddit.com/r/Reaper/comments/hxzpan/comment/fzg2x5s/?utm_source=share&utm_medium=web2x&context=3


Also see chapter 17.12 of the User Guide

==============================================================

-- Sharing RS5k instruments


These can be shared as FX chains or as track templates. 

To ensure that the media files which accompany the instruments are loaded from any location

on the destination machine, the FX chain or the Track template files must reside in the same

folder as the media files and be loaded from there.

If the media files were originally stored in the REAPER resource directory, they can be

placed there on the destination machine, in which case the location of the FX chain and Track template

files doesn't matter because the media file paths will be relative


==============================================================

-- Find peaks at a certain level in an audio item


In the Dynamic Split tool only enable 'At transients' option under Split ponits

and manipulate Transient Detection Settings under Set transent sensitivity.

From 'Action to perform' list select either Add transient guide markers

or add stretch markers

==============================================================

-- Exclusive track display system

1. Show/hide tracks with custom actions (2015)

https://www.youtube.com/watch?v=PYJCedHTPOI

2. Quickly Show & Hide Tracks in REAPER | Track Manager and SWS Actions (2017)

https://www.youtube.com/watch?v=CptaYGBhiFI

3. Track Show / Hide Group Toggles (2019)

https://www.youtube.com/watch?v=Hlsb3Ioordg

4. Selecting tracks by name - the better way - custom mixer toolbar 2019

https://www.youtube.com/watch?v=0Xdj_Qnq61U

5. jump to track in tcp ?

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

Schwa:

In the track manager, under options check "hide filtered-out tracks in TCP." 
Then you can leave the track manager open and type in the filter field.


==============================================================

-- Calculate plugin latency in REAPER

(1/(sample rate)) * PDC = latency in seconds (multiply by 1000 to convert to ms)

For example

(1/44100) * 500 pdc samples = just over 11ms

https://old.reddit.com/r/Reaper/comments/wx0fy4/view_plugin_latency/

==============================================================

-- Automate velocity

The problem is that MIDI velocity isn't a continuous controller. 

They are individual MIDI events that accompany the note.

What you want to do is insert JS: MIDI Velocity Control as the first FX before your virtual instrument. 

We are going to abuse the crap out of this JS' ability to modify incoming MIDI.

You want to show track envelopes for Min Velocity and Max Velocity. See where we're heading?

Now you've got automatable track envelopes. 

What you want to do is make both Min and Max Velocity envelopes identical. 

The value they share is the value the velocity will be forced into.

If there is a gap between values, if the original velocity is less than the minimum, 

it becomes the minimum, and if the original velocity is greater than the maximum, 

it becomes the maximum, and if the original value is inbetween, it does not change. 

So you must give JS: MIDI Velocity Control no choice.


https://old.reddit.com/r/Reaper/comments/3yzkn8/automating_midi_velocities/

==============================================================

-- Project saving settings: Prefs > Project > Project saving section


The first three rows or tickboxes are for the single backup file made on every manual save.

Starting with 'Every X minutes' on the fourth line and below - that is for the auto-backup feature, 

and has nothing to do with the previous three rows.

However in auto-backup there is no automatic pruning of the files above a certain number or size.


https://old.reddit.com/r/Reaper/comments/wxeyy6/accessing_previous_save_points_reaper/ilqvf7e/


==============================================================

-- SWS Command Parameters utility additional configs beyond A and B

so all 'Xenakios/SWS: Set fades of selected items to configuration' actions can be utilized


In the Xenakios_Commands.ini create a new config following the pattern: 

FADECONF_C=In-Length In-Shape Out-Length Out-Shape

So as example for Fade Config C this line can look like this:


FADECONF_C=20 1 15 0

- Fade in length: 20 seconds
- Fade in shape: 1
- Fade out length: 15 seconds
- Fade out shape: 0

Do the same for the other Fade configs D-F:

FADECONF_D=
FADECONF_E=
FADECONF_F=


As a side note: The Fade Shape number goes from 0-6 (representing the 7 different shape types).


https://forum.cockos.com/showthread.php?t=205957 by solger


==============================================================

-- Unfreezing

After freezing the item can be moved to another track and the original can still be restored 

without affecting the frozen item.

If the frozen item was edited on the same track, at unfreeze attempt a warning message will pop up


	Unfreeze Warning
	
	Media items on 1 track have been edited after freezing!

	(Media items moved)

	(Playrate/pitch edited)

	Unfreezing may lose edits that were done post-freeze. Try to transform the frozen items to match the edits (only works for very basic edits)?

	Choosing No will restore the items to how they were originally frozen.
	
 	|       Yes       |        No       |       Cancel       |


==============================================================

https://landoleet.org/i8n/string_calculator.html

string encoder for language packs

https://forum.cockos.com/showpost.php?p=2585852&postcount=4

==============================================================

-- MIDI Editor settings

As a rule MIDI Editor settings are item specific.

* If one MIDI editor per item option is enabled at Preferences -> Editing behavior -> MIDI Editor, then each item always retains its settings

* If one MIDI editor per project is enabled, then settings enabled for specific item will be carried over to any other item if after opening one item another one is opened without the first being closed beforehand

* If one MIDI editor per track is enabled the settings are only carried over between items on the same track


==============================================================

-- Saving SWS colors so that they're available across all projects


By design they must be available to all projects because they're stored under 'custcolors' key inside reaper.ini file,

but in case they aren't ...

In the SWS Color Management dialogue click 'Save colors to file ...' 

and from the file extension menu of the Save dialogue select .ReaperTheme. 

Then copy and paste the exported file code into your theme original .ReaperTheme file just before the original code.

Now it's a theme property independent of a project.

https://old.reddit.com/r/Reaper/comments/xataha/how_do_you_set_sws_colors_to_be_the_same/

==============================================================

-- Set up MIDI channel switcher to play different instruments during performance

1. Create the piano track and the synth track

2. create another track, it will act as the midi router

3. Create a send from router to piano. audio -> none. Midi 1 -> all

4. create a send from router to synth. Audio -> none. midi 2 -> all

5. add JS: Midi router/transpose plugin on the router track

6. set output channel to 2 on the plugin

7. param -> FX parameter list -> learn -> bypass

8. untick everything

9. press the button u want on your keyboard. This will be the switch.

if the button is a momentary, set the drop-down menu to TOGGLE. If the button is already a toggle leave the drop-down to ABSOLUTE

10. record arm the router track

11. Play

This solution records the midi on the router track. You will have to move the recorded 

midi information to the respective tracks once the session is done.

https://old.reddit.com/r/Reaper/comments/xadom5/switch_channel_with_midi/

==============================================================

-- Set time selection or loop precisely

1. Create an empty MIDI item
2. Open its Item Properties dialogue
3. In the left-hand corner input the desired Position and Length times
4. Run 'Time selection: Set time selection to items' or 'Loop points: Set loop points to items'
5. Delete the item

https://old.reddit.com/r/Reaper/comments/xc2tgk/can_you_set_the_timeselection_via_textinput_in/

==============================================================

-- Change timing of MIDI beats

1. Duplicate a 1/4th worth of MIDI data in Arrange

2. Change grid resolution

3. Stretch or shrink the MIDI item duplicate to fill exactly 1 beat

https://www.youtube.com/watch?v=ER6F59EebWw

==============================================================

-- SWS Notes font size

since v2.13 in S&M.ini change the value of the Fontsize key in [Notes] section

https://forum.cockos.com/showpost.php?p=2601423&postcount=3099

==============================================================

-- JSFX LFO as a modulation source for plugin parameters

lfo by youn

https://stash.reaper.fm/v/9283/lfo


https://forum.cockos.com/showthread.php?p=782873#7
https://forum.cockos.com/showthread.php?t=85296

How to set up https://forum.cockos.com/showthread.php?t=94519#9


==============================================================

-- Lock track from deletion

Tracks which have items cannot be deleted without the dialogue asking for confirmation.

Likewise tracks which have sends/receives

So to lock an empty track place a dummy item on it so at deletion attempt the dialogue is evoked


==============================================================

-- Playing multiple projects at once


Steps:
1) Open or create multiple projects.
2) Right click on any of the tabs and enable the following
'Run background projects'
'Run stopped background projects'
'Play stopped background projects with active project'
'Synchronize play times w/play background projects'
3) Hit play and both projects should be running.

Notes: The important thing to remember is that backround projects are any projects other than
the currently selected/active project. So if you switch to a different tab.., the previous tab automaticaly becomes a background project.

'Play stopped background projects with active project': --- What this does, is it allows all projects to share some of the transport buttons
(Play, Stop, Go to start, Go to end).., for some reason the pause button is not shared.
If this is turned off only the active project will start when you press play.., but you can still switch tabs and then press play again
and that project will also start to play.

'Synchronize play times w/play background projects': So what this does, is it syncs the play start positions of all projects with the
currently active project. If for example your play cursor is at 2.1.00 in the active project when you press play all background projects
will also start from this time.


For live input or VST instruments you'll want to do the same thing.., except you won't need to hit play unless you're using a plugin that requires it.

One of the cool things to remember is that each project can be set to different BPM and PlayRates.

Oh..., one other thing, if you want to record what is comming out of all playing projects, you can use the command "Save live output to disk(bounce)' found under the File menu or actions list. In the dialog window that opens, you'll probably what to enable the option 'Stop saving output on first stop'.., this will stop the recording when you click on the transport stop button.


https://forums.cockos.com/showthread.php?t=143150 

==============================================================

-- Auto-save

For the auto-save to work all there's to do is set the time, frequency and enable 

'Save to timestamped file in project directory' and/or 'Save to timestamped file in additional directory'

THAT'S IT, the last two options are less useful, other options are irrelevant for auto-save

When the Preferences window is open auto-saving stops
https://forum.cockos.com/showthread.php?t=272227

==============================================================

-- MIDI velocity envelope


not many are aware of that the Volume (Pre-FX) automation affects MIDI velocity as well. So you could do the same with a pre-FX volume envelope and no MIDI FX on the track. It's a bit weird because you have dB values, not percentage but it's ok to work with nevertheless. I am just sometimes too lazy to create the MIDI FX and go this way.

Track > Envelopes > Toggle volume (pre-FX) active. This now puts an envelope on your MIDI track that can be edited like a regular envelope, but controls the MIDI velocity, thereby retaining any dynamics in your VSTi instrument samples!


https://forum.cockos.com/showthread.php?p=311511
https://forum.cockos.com/showthread.php?p=1094403

==============================================================

-- Move multiple markers at once (contiguous)

THIS IS IRRELEVANT SINCE BUILD 7.62 WHERE MULTIPLE MARKERS CAN BE SELECTED AND MOVED AT ONCE BY LEFT MOUSE DRAGGING
OR BY HAVING RIPPLE EDIT ALL TRACKS + RIPPLE EDIT ALL AFFECTS REGIONS/MARKERS ENABLED AND MOVING A DUMMY ITEM TO EFFECT MARKERS MOVEMENT

1. Create an empty track
2. Create an empty item which encompasses all markers to be moved
3. Select the item
4. Run action Item: Split items at project markers
5. Enable 'Ripple edit all tracks'
6. Locked all other items
7. Enable 'Locked items are unaffected by ripple'
8. Select all slices
9. Move

Works for regions as well but splitting must be done manually since 'Item: Split items at project markers' doesn't work with regions

WARNING: if start of any of your splits coincide with another item even if locked, 
the item will still move in global ripple edit mode if 'Locked items interrupt ripple' is ON 
in the Preferences -> Editing behavior, and markers won't move with splits if the markers cross locked items,
only works with 'Locked items are unaffected by ripple'

https://www.youtube.com/watch?v=wXpcMFbo7wk

==============================================================

-- reaper.CF_GetCustomColor(integer index, integer color)
-- reaper.CF_SetCustomColor(integer index, integer color)


integer color "0xBBGGRR" means hexadecimal notation. If you convert each number in your RGB (255, 0, 0) 

into hexadecimal, you get: (FF, 00, 00). Replace RR, GG and BB from the documentation with 

your color's values and you get: 0x0000FF, which is the integer value for that color on Windows.

reaper.CF_SetCustomColor(0, 0x0000FF) -- 0 = first custom color


https://forum.cockos.com/showthread.php?t=29640&page=78#3119


==============================================================

-- reaper.ini special keys/flags


1. You can set rearoute_loopback=1 in your reaper.ini (right under [REAPER]), 
and then you will have loopback inputs and outputs which you can use to send between projects. 
(if you are on Windows, this will mean you lose ReaRoute capability, though, but you probably don't need it).

https://forum.cockos.com/showthread.php?p=1796913#post1796913

Since build 6.69 supports up to 512 channel

https://www.youtube.com/watch?v=GKa3uGbz854&t=97s

and since version 7 there's a built-in option in Preferences -> Audio -> Virtual loopback audio hardware
which can be used alongside the parameter in reaper.ini but if both are enabled each option is allocated
half of the maximum number of channels, i.e. 256

https://www.youtube.com/watch?v=FAKiHozcE8o?t=1203s


2. When debugging undo related things, set "debug=1" in reaper.ini, 

restart REAPER, and you'll see an added column in the undo history 

which lets you see a summary of what changed.

https://forum.cockos.com/showthread.php?t=272617#2


3. midi_hw_debug=1 ini file option to enable win32 debug messages on MIDI output errors 

(since build 7.39 but may not be supported in official builds, added officially in build 7.42)

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


4. add experimental option (reaper.ini areasel=2) to not merge adjacent selection regions (Razor Edits)

since build 7.40

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


5. Since build 7.77 value at key default_media_path= can override default media path


==============================================================

-- Scope of actions 'Item: Propagate to (all) similarly-named items/active takes (on track)'


To active takes all 'Take properties' of the source 'Media Item Properties' window are propagated

To items also fades, snap offset, number of takes in the source, 'Loop source' and 'Play all takes' checkbox settings are propagated. 

If the target item is multi-take its active take name must match the source item/take name to be affected by propagation.

'Item time base' and 'Item mix behavior settings' and the checkbox settings next to them besides the 2 mentioned above aren't propagated.


==============================================================

-- Finding child windows - jsader

For most how-to questions about window-related functions, the best source of info 

is Microsoft's own documentation fo rthe corresponding Win32 C++ functions.

but if you need to find an ID of a child window yourself, you can use JS_Window_GetLong(windowHWND, "ID"). 

Use it together with JS_Window_FromPoint to get the ID of the window under the mouse:

id = reaper.JS_Window_GetLong(reaper.JS_Window_FromPoint(reaper.GetMousePosition()), "ID")

https://forum.cockos.com/showpost.php?p=2429972&postcount=1555

==============================================================

-- Cursors - jsader


The numbers for standard Windows cursor can be found here: LoadCursor function.

The list of REAPER's custom cursors are here: Custom Cursors. This list is outdated though, and doesn't include recent additions such as notation key signature cursors.

The numbers in this list are also misleading. The IDs that you use for setcursor are 105 for adjustfade, then 182-191 for some others, etc. (Thanks to cfillion and Xenakios for telling me this recently. They also referred me to Resource Hacker to find all the actual IDs.) I don't know all the correct IDs yet.

The first time that you use a certain string as the second parameter in the function (even an empty string, AFAIK), that string becomes the user-specified "name" for the cursor number. Next time you use that string, it will override whatever number you used. I think that name will remain in memory until you restart REAPER.

For example, if you run gfx.setcursor(182, "dragdrop"), you can later load the cursor again using a dummy number such as gfx.setcursor(1, "dragdrop"). But if you try gfx.setcursor(183, "dragdrop"), it will also override 183 and load dragdrop instead.

This may get confusing, so it may be better to stick with numbers gfx.setcursor(n, tostring(n)).

EDIT: Other IDs for cursors are 417-420, 429-434, 450, 453, 460-465, 472, 473, 488, 502-503, 515, 517, 525-535, and 1009-1011.


https://forum.cockos.com/showthread.php?p=2008003


==============================================================

-- IF, IF NOT statements, AND and OR operators for regular custom actions (conditional custom actions)


When action is executed with a click or a shortcut, for the purposes of the actions listed below CC parameter is <0,
not ==0 as could be expected.


Actions to be used are named 'Action: Skip next action ...'

Action: Skip next action if CC parameter <0/mid -- mousewwheel in, skip next, run action B
-- action A
Action: Skip next action if CC parameter >0/mid -- mousewwheel out, skip next, run action A
-- action B

useful to dictate action depending on the mouse wheel direction

if each alternative action is comprised of several individual actions, each must be preceded with 'Action: Skip next ...' action, e.g.


Custom: Shift time selection by grid (map to mousewheel - out = right, in = left)
  ------------------------------------------------------------ alternative 1
  Action: Skip next action if CC parameter <0/mid
  Go to start of time selection
  Action: Skip next action if CC parameter <0/mid
  View: Move cursor right to grid division
  Action: Skip next action if CC parameter <0/mid
  Time selection: Set start point
  Action: Skip next action if CC parameter <0/mid
  Go to end of time selection
  Action: Skip next action if CC parameter <0/mid
  View: Move cursor right to grid division
  Action: Skip next action if CC parameter <0/mid
  Time selection: Set end point
  ------------------------------------------------------------ alternative 2
  Action: Skip next action if CC parameter >0/mid
  Go to start of time selection
  Action: Skip next action if CC parameter >0/mid
  View: Move cursor left to grid division
  Action: Skip next action if CC parameter >0/mid
  Time selection: Set start point
  Action: Skip next action if CC parameter >0/mid
  Go to end of time selection
  Action: Skip next action if CC parameter >0/mid
  View: Move cursor left to grid division
  Action: Skip next action if CC parameter >0/mid
  Time selection: Set end point


The action 
Action: Skip next action, set CC parameter to relative +1 if action toggle state enabled, -1 if disabled, 0 if toggle state unavailable.
can be used to detect toggle state and set CC param to refer to downstream with another 'Action: Skip next action ...'

Custom: REAPERMania_Seek by clicking the item during playback (assign to mouse modifier)
  Action: Skip next action, set CC parameter to relative +1 if action toggle state enabled, -1 if disabled, 0 if toggle state unavailable.
  Transport: Play <------------------------------------------ the action reports toggle state, single skip, see next custom action example
  View: Move edit cusor to mouse cursor
  Action: Skip next action if CC parameter <=0/mid
  Transport: Play


Custom: Toggle alternate M shortcut
  Action: Skip next action, set CC parameter to relative +1 if action toggle state enabled, -1 if disabled, 0 if toggle state unavailable.
  SWS/S&M: Dummy toggle 1 <------------------------------------ can be toggled from a toolbar or a menu item
  Action: Skip next action if CC parameter >0/mid
  Markers: Insert marker at current position <----------------- the action doesn't report toggle state therefore is preceded with 2 modifier actions, double skip
  Action: Skip next action if CC parameter <0/mid
  Track: Toggle mute for selected tracks


Custom: Toggle alternate M shortcut
  Action: Skip next action, set CC parameter to relative +1 if action armed, 0 otherwise.
  Action: Skip next action if CC parameter >0/mid <----------------- any action can be used for arming as long as it itself doesn't perform a specific action, can be  armed from a toolbar button, toggle actions cannot be armed
  Action: Skip next action if CC parameter >0/mid
  Markers: Insert marker at current position
  Action: Skip next action if CC parameter ==0/mid
  Track: Toggle mute for selected tracks

Still conditioning behavior on a toggle state is preferable over armed state because armed state hinders free usage of Arrange

Custom: Toggle alternate M shortcut (proof of concept) -- activate 'Toggle show track icons in mixer' from toolbar button
  Action: Skip next action, set CC parameter to relative +1 if action toggle state enabled, -1 if disabled, 0 if toggle state unavailable.
  Mixer: Toggle show track icons in mixer <--------------------- conditional toggle action, seem pretty innocuous setting which doesn't interfere with the workflow
  Action: Skip next action if CC parameter >0/mid
  Markers: Insert marker at current position
  Action: Skip next action if CC parameter <0/mid
  Track: Toggle mute for selected tracks

-- In the following custom action the toggle state is automatically set to Off once the action which depends on its being On has been executed
-- If a series of actions depend on the toggle state each must be preceded with the corresponding 'Skip next action' action

Custom: Toggle alternate M shortcut MOMENTARY (proof of concept) -- activate 'Toggle show track icons in mixer' from toolbar button
  Action: Skip next action, set CC parameter to relative +1 if action toggle state enabled, -1 if disabled, 0 if toggle state unavailable.
  Mixer: Toggle show track icons in mixer <--------------------- conditional toggle action
  Action: Skip next action if CC parameter >0/mid
  Markers: Insert marker at current position
  Action: Skip next action if CC parameter <0/mid
  Track: Toggle mute for selected tracks
  Action: Skip next action if CC parameter <0/mid
  Mixer: Toggle show track icons in mixer

-- as native dummy toggle actions the following can be used linked to a toolbar button because they don't alter behavior drastically
-- and in a way which may militate against the workflow or playback or layout/appearance

View: Toggle transport visible
View: Toggle show/hide item labels
View: Toggle show media cues in items
View: Toggle master track visible
View: Toggle displaying labels above/within media items
View: Toggle auto-view-scroll while recording
View: Toggle auto-view-scroll during playback
Transport: Toggle preserve pitch in audio items when changing master playrate
Track: Toggle show/hide in mixer
Track: Toggle all track grouping enabled
Toggle external timecode synchronization
Monitoring FX: Toggle bypass
Mixer: Toggle tracks with receives in mixer
Mixer: Toggle show track icons in mixer
Mixer: Toggle show icons for the last track in a folder
Options: Show FX inserts in TCP (when size permits)
Options: Show sends in TCP (when size permits)
Some locking toggle actions
Item properties: Toggle item play all takes


-- Or a dummy Lua script with the following code can be used to toggle the state:

/////////////////////////////////////////////////////////

local is_new_value, fullpath, sectionID, cmdID, mode, resolution, val = reaper.get_action_context()
local state = reaper.GetToggleCommandStateEx(sectionID, cmdID) < 1
reaper.SetToggleCommandState(sectionID, cmdID, state and 1 or 0)
-- OR
local state = reaper.GetToggleCommandStateEx(sectionID, cmdID)
reaper.SetToggleCommandState(sectionID, cmdID, state~1) -- flip the bit

////////////////////////////////////////////////////////


-- Temporarily change toggle state in order to perform an action without altering the settings permanently, mainly useful for changing options toggle state
-- MIND THAT NOT ALL ACTIONS LABELED 'TOGGLE' ACTUALLY REPORT THE TOGGLE STATE, SUCH AS THOSE WHICH AFFECT SELECTED OBJECTS

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Custom: Temporary toggle to OFF
  Action: Skip next action, set CC parameter to relative +1 if action toggle state enabled, -1 if disabled, 0 if toggle state unavailable.
  Options: Toggle snapping
  Action: Skip next action if CC parameter <0/mid ---------------------- if previous action toggle state had initially been OFF, CC was set to -1, 
									therefore next action will be skipped and won't run to change the toggle state to OFF, 
									otherwise it won't be skipped and will run to change the toggle state to OFF
  Options: Toggle snapping
  Move edit cursor to start of next measure  --------------------------- run the main action or a sequence thereof which need the toggle action to be OFF
  Action: Skip next action if CC parameter <0/mid --------------------- if 'Toggle snapping' action toggle state had initially been OFF, CC was set to -1, 											therefore next action will be skipped and won't run to restore the initial toggle state, 										otherwise it won't be skipped and will run to restore the initial toggle 
									state, that is ON after being set to OFF above
  Options: Toggle snapping

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>


>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Custom: Temporary toggle to ON
  Action: Skip next action, set CC parameter to relative +1 if action toggle state enabled, -1 if disabled, 0 if toggle state unavailable.
  Options: Toggle snapping
  Action: Skip next action if CC parameter >0/mid ---------------------- if previous action toggle state had initially been OFF, CC was set to -1, 
									therefore next action won't be skipped and will run to change the toggle state to ON,
									otherwise it will be skipped and won't run to change the toggle state to ON
  Options: Toggle snapping
  Move edit cursor to start of next measure --------------------------- run the main action or a sequence thereof which need the toggle action to be ON
  Action: Skip next action if CC parameter >0/mid --------------------- if 'Toggle snapping' action toggle state had initially been OFF, CC was set to -1, 											therefore next action won't be skipped and will run to restore the initial toggle 
									state, otherwise it will be skipped and won't run to restore the initial toggle state, 
									that is OFF after being set to ON above
  Options: Toggle snapping

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>



-- Bypass an action

There's a way to bypass an action, however for a sequence of actions it's quite ungainly 
unless such sequence is converted into another custom action and used as such


Action: Skip next action, set CC parameter to relative +1 if action armed, 0 otherwise
-- YOUR ACTION TO BYPASS (here only used for state evaluation)
Action: Skip next action if CC parameter ==0/mid
-- YOUR ACTION TO BYPASS

First you set CC parameter to 0 based on the state of your action (it must not be armed) and skip it 
and then you skip it based on the CC parameter just set. With many actions you'd need to replicate this 
sequence for each action that needs bypassing because only one action can be skipped at a time.

Bypass can also be conditioned by another toggle action, e.g.

Action: Skip next action, set CC parameter to relative +1 if action toggle state enabled, -1 if disabled, 0 if toggle state unavailable.
-- TOGGLE ACTION (here only used for state evaluation)
Action: Skip next action if CC parameter >0/mid  OR  <0/mid ---------- depeding on which toggle state is required as a condition
-- YOUR ACTION TO BYPASS



-- Toggle two toggle actions in sync which is achieved by simulating AND logic operator

If one action is ON AND another is OFF, toggle the second to ON as well, and vice versa,
if one is OFF AND another is ON, toggle the second to OFF as well,
this requires using nested custom actions for the second action

-- MAIN ACTION:

Custom: Toggle continuous scrolling during playback
  View: Continuous scrolling during playback --------------- toggle, then evaluate toggle state and based on it toggle the second action
  Action: Skip next action, set CC parameter to relative +1 if action toggle state enabled, -1 if disabled, 0 if toggle state unavailable.
  View: Continuous scrolling during playback
  Action: Skip next action if CC parameter <0/mid
  Custom: Toggle continuous scrolling during playback - Toggle auto-view-scroll ON (component)
  Action: Skip next action if CC parameter >0/mid
  Custom: Toggle continuous scrolling during playback - Toggle auto-view-scroll OFF (component)

-- NESTED CUSTOM ACTIONS:

Custom: Toggle continuous scrolling during playback - Toggle auto-view-scroll OFF (component)
  Action: Skip next action, set CC parameter to relative +1 if action toggle state enabled, -1 if disabled, 0 if toggle state unavailable.
  View: Toggle auto-view-scroll during playback
  Action: Skip next action if CC parameter <0/mid
  View: Toggle auto-view-scroll during playback

Custom: Toggle continuous scrolling during playback - Toggle auto-view-scroll ON (component)
  Action: Skip next action, set CC parameter to relative +1 if action toggle state enabled, -1 if disabled, 0 if toggle state unavailable.
  View: Toggle auto-view-scroll during playback
  Action: Skip next action if CC parameter >0/mid
  View: Toggle auto-view-scroll during playback


-- Another example of AND operator simulation
-- Delete action conditional on enabled 'Ripple edit all tracks' AND disabled 'Selecting one grouped item selects group' options

-- MAIN ACTION:

Custom: Conditional item delete AND
  Action: Skip next action, set CC parameter to relative +1 if action toggle state enabled, -1 if disabled, 0 if toggle state unavailable.
  Toggle ripple editing all tracks
  Action: Skip next action if CC parameter <0/mid --------------- the nested custom action will be executed if 'Ripple edit all tracks' is ON
  Custom: Conditional item delete (component)

-- NESTED ACTION:

Custom: Conditional item delete (component)
  Action: Skip next action, set CC parameter to relative +1 if action toggle state enabled, -1 if disabled, 0 if toggle state unavailable.
  Options: Selecting one grouped item selects group
  Action: Skip next action if CC parameter >0/mid --------------- Delete will be executed if 'Selecting one grouped item selects group' is OFF
  Item: Remove items



-- OR operator simulation
-- Delete action conditional on eiher enabled 'Ripple edit all tracks' OR disabled 'Selecting one grouped item selects group' options

-- MAIN ACTION:

Custom: Conditional item delete OR
  Action: Skip next action, set CC parameter to relative +1 if action toggle state enabled, -1 if disabled, 0 if toggle state unavailable.
  Toggle ripple editing all tracks
  Action: Skip next action if CC parameter <0/mid
  Item: Remove items
  Action: Skip next action if CC parameter >0/mid ------- if 'Ripple edit all tracks' is OFF, evaluate toggle state of 'Selecting one grouped item selects group'
  Custom: Conditional item delete OR (component)


-- NESTED ACTION:

Custom: Conditional delete OR (component)
  Action: Skip next action, set CC parameter to relative +1 if action toggle state enabled, -1 if disabled, 0 if toggle state unavailable.
  Options: Selecting one grouped item selects group
  Action: Skip next action if CC parameter >0/mid
  Item: Remove items


The actions

Action: Skip next action, set CC parameter to relative +1 if action armed, 0 otherwise

Action: Skip next action, set CC parameter to relative +1 if action toggle state enabled, -1 if disabled, 0 if toggle state unavailable.

and actions which evaluate the CC parameter set by these actions

Action: Skip next action if CC parameter !=0/mid
Action: Skip next action if CC parameter <=0/mid
Action: Skip next action if CC parameter <0/mid
Action: Skip next action if CC parameter ==0/mid
Action: Skip next action if CC parameter >=0/mid
Action: Skip next action if CC parameter >0/mid

have their scope limited to a particular custom action they're executed within

Setting CC parameter within one custom action doesn't affect this parameter within another custom action
so nested actions each can have its own CC parameter which makes simulation of AND and OR operators possible



sources:
https://www.stephenschappler.com/2017/05/30/quick-reaper-tip-adjust-item-volume-or-pitch-with-mousewheel/
https://youtu.be/QO9LTaN_WvE?t=267 -- Advanced item nudging + https://reaperblog.net/2018/01/advanced-item-nudging/
https://youtu.be/hX9a60NGQX4?t=273 -- Seeking Within Media Items in REAPER
https://www.google.com/search?q=reaper+skip+next+action+site:forum.cockos.com


==============================================================

-- Smooth scrolling

https://old.reddit.com/r/Reaper/comments/10f4whe/found_a_workaround_for_smooth_scrolling/

Add: Action: Modify MIDI CC/mousewheel: 0.5x
Add this multiple times, I've got 6 of it: View: Scroll vertically (MIDI CC relative/mousewheel)

With this action you have twice the steps, and to me it's enough to keep me oriented. 
It also scrolls 3 times as far which some times is too much, so I use shift + scroll for this action and ctrl + shift + scroll for fine scrolling.

I made the fine scrolling action so that it scrolls about 80% of the view, 
so that if your vertically zoomed in to the max and scroll to see the automation lane of a track, 
you still see the bottom 20% of the track.

Add: 
Action: Modify MIDI CC/mousewheel: 0.5x
Action: Modify MIDI CC/mousewheel: -10%
Action: Modify MIDI CC/mousewheel: -10%
Action: Modify MIDI CC/mousewheel: -10%
View: Scroll vertically (MIDI CC relative/mousewheel)
View: Scroll vertically (MIDI CC relative/mousewheel)
View: Scroll vertically (MIDI CC relative/mousewheel)


==============================================================

-- Rendering both multi-channel and mono tracks in one pass


Using 'Selected tracks (stems)' as Source setting in the Render window


Place a muted mono item on the tracks which are meant to be rendered out in mono, 

otherwise even if it's technically mono it will be rendered out as stereo


https://old.reddit.com/r/Reaper/comments/10tjmuf/how_to_make_tracks_mono_for_exporting/

==============================================================

-- Modulate plugin parameter randomly

The problem was Modulation can only be linked from 'knob' sources, so we need a FX that actually shows randomized value.

1. Make a simple 16-th note MIDI pattern to trigger random steps.
2. Put MIDI Note Randomize, select the same note as the one populated with note events in the MIDI item, it will generate random notes
3. Put MIDI Note Examiner, it shows MIDI note info on its 'knobs', this is needed for creating random slider movements
4. Put some FX to be modulated
5. Link plugin control to MIDI Examiner Data Byte 1 parameter via parameter modulation

https://old.reddit.com/r/Reaper/comments/10zh8pk/solved_random_step_modulation_done_easy/


==============================================================

-- MIDI Editor Quantize tool -- HOW IT REALLY WORKS for note length and end

The tool sets the length to the next larger grid size, so a 1/128 note length can be set
to any length, but say a 1/16 note cannot be set to any smaller size because
it already covers then (i.e. 1/32, 1/64, 1/128 are included in 1/16).

The tool remembers the initial note size so after extending a 1/128 note with while the tool is open
its 1/128 size can still be restored

To set a note length to grid size use action 'Edit: Set note lengths to grid size' after setting grid size


https://forum.cockos.com/showthread.php?t=169924#10 -- starts here

==============================================================

-- Scroll track into view using Track Manager and SWS Console


1. Filter the list by name

2. Select the found track in the list

3. Click Set selection from: List down at the bottom

4. Run the action Track: Vertical scroll selected tracks into view

OR BETTER

1. Enable the option Mirror track selection

2. Enable the option Scroll to selected track when mirroring selection

3. Filter the list by name

4. Select the found track in the list


with the SWS Console

1. Run the action SWS: Open console with 'S' to select track(s)

2. Type in the full track name or part of it followed by an asterisk if you're sure that it will be unique

3. Click enter

4. Run the action Track: Vertical scroll selected tracks into view


==============================================================

-- Compressing and expanding MIDI velocities and CC automation

1. Select events

2. Open Event Properties dialogue

3a. To compress:

In the Value field use either division operator / with values greater than 1 or multiplication operator * with values lesser than 1

When all values are decreased by e.g. half the difference between then is halved as well,

e.g. 100 vs 50, 100 - 50 = 50 -- diff

after halving: 50 vs 25, 50 - 25 = 25 -- diff

Then they can be increased together with + operator to raise the overal volume

3b. To expand:

In the Value field use either division operator / with values lesser than 1 or multiplication operator * with values greater than 1

e.g. 50 vs 25, 50 - 25 = 25 -- diff

after doubling: 100 vs 50, 100 - 50 = 50 -- diff

Then they can be decreased together with - operator to lower the overal volume

https://www.youtube.com/watch?v=vqIOh7-AhqA&t=422s

==============================================================

-- Automating plugins with MIDI automation

When in the FX chain plugin is in any slot other than the 1st to ensure

that MIDI automation, set via Parameter modulation, does affect it properly 

under the '2 in 2 out' button click 'I/O' button and under the MIDI Output

enable 'Merges with MIDI bus' option

https://old.reddit.com/r/Reaper/comments/11h23e9/reaeq_cc_automation_not_working_inside_of_midi/

==============================================================

-- Associate theme with a project


It's possible with a script containing the function

reaper.OpenColorThemeFile(theme_file_path)

added to the SWS project startup actions, so every time you open this particular
 
template the global startup action will run and apply the theme whose file path 

is passed as theme_file_path argument in the above function

And after doing some search found out that SWS extension already offers this feature as actions

SWS/S&M: Resources - Load theme, slot N

So you only associate a theme with a slot and add the corresponding action to the SWS project startup actions utility.

https://forum.cockos.com/showthread.php?t=117680#15

https://old.reddit.com/r/Reaper/comments/11s0urb/project_template_specific_theme/

==============================================================

-- Storing record mode between projects and session

Record mode toggle states aren't stored in reaper.exe file or any .ini files

So every new project starts withfactory defaults.

The 3 record modes:

Options: New recording splits existing items and creates new takes (default)
Options: New recording trims existing items behind new recording (tape mode)
Options: New recording creates new media items

Are saved with project or project template.

So to have a particular mode default for new projects either project template
should be used or SWS Global startup action

It's saved in AUTOXFADE parameter as 129, 133 and 137 values respectively

https://old.reddit.com/r/Reaper/comments/11su9i1/how_to_make_tape_mode_recording_the_default_on/

==============================================================

-- CC Lanes visibility concept

Visible means selected in the left hand CC menu in the MIDI editor

REGARDLESS if the CC lane being collapsed or uncollapsed

This is what the following actions imply:

Edit: Select all CC events in time selection (in all visible CC lanes)

Edit: Select all events in time selection (in all visible CC lanes)


==============================================================

-- Creating a tempo map

1) make sure to have a simple shortcut for the action "insert marker at play cursor"
2) play the song and tap along with every bar (or half note, or quarter note, depending on how fine you want the tempo map to be)
3) zoom in and match markers with transients if necessary (the more accurately you tapped, the less there is to do here)
4) go to the menu bar and look for "Extensions -> Tempo -> Convert project markers to tempo markers..."
5) set the correct time signature, indicate how many markers count for a measure (depending on 2), check "Remove project markers", and press "Convert"
This will not only create a tempo map as in the video, but also add stretch markers to all items which give the flexibility to move items around and quantize them to the grid. This is useful when trying to sketch out a song from fragments of a jam session that was recorded without a click. Unfortunately, the process is just as tedious as in the video. Wish there was an easier way to do this.

https://www.youtube.com/watch?v=2SB73rGeIXQ


Also
https://www.youtube.com/watch?v=ScD5Z5jPL-o
https://www.youtube.com/watch?v=C2Z5mjufb98
https://www.youtube.com/watch?v=sjT9WuC1Zc0
https://www.youtube.com/watch?v=2KZDpBWX5LA

==============================================================

-- Exporting a tempo map

Insert an empty track, insert a MIDI file on it spanning all project tempo changes,
and export it via File -> Export project MIDI.
The crucial setting in the export dialogue is Multitrack MIDI (type 1 MIDI file),
type 0 won't allow REAPER to read the tempo data back when the MIDI file is imported


==============================================================


-- Creating midi note color maps

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

==============================================================


-- How to have certain windows always show up undocked


open a window and position it in a specific area (undocked), then clos 

the window and re-saved the screenset. Now whenever you will switch back 

to the same screenset and open the window again, it will open in that 

exact spot (undocked)


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

==============================================================

-- API Syntax files for IDE

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


==============================================================

-- To open project with FX offline

1. Select the project file in the File Browser
2. Hold Ctrl+Shift
3. Click OK to load the project
A prompt will pop-up offering to load it with FX offline


1. Drag and drop project file into the Arrange, 'Open RPP choice'adialogue will appear offering some options
2. Hold Ctrl+Shift and chose to open the project
A prompt will pop-up offering to load it with FX offline

https://forums.cockos.com/showthread.php?p=2276169

==============================================================

-- reaper.ini

lastcwd= key

That's literally the last working directory, saved at exit, loaded on startup. 

We don't change it too many places, but some file browse dialogs end up changing it, 

I think? and a script could (via chdir())

https://www.askjf.com/index.php?q=5473s

==============================================================

-- Trigger multi-sample in RS5k at different velocities from audio source

For this you need 2 tracks with the same audio material

1. on one track you insert Audio To MIDI Drum Trigger, MIDI Velocity Control, RS5k (in this order)

2. from another track you send audio to the first one on channels 3/4 or any other except 1/2

3. in the first track enable parameter modulation from audio signal for 'Velocity add' slider of MIDI Velocity Control plugin, the audio source should be channels 3/4, that is audio coming in from the second track

then it's a matter of playing with parameter modulation settings

see track semplate Trigger multi-samples in RS5k from audio based on audio volume.RTrackTemplate

The solution is based on ashcat_lt suggestion at https://forums.cockos.com/showthread.php?t=197392
Prompted by a question at https://www.youtube.com/watch?v=PTNy4SYRNbo&lc=UgwrwqbPiREVrwdmZ8R4AaABAg


==============================================================

-- Convetring individial drum tracks into MIDI

1. Split with the Dynamic split with the following settings:

'At transients' is the only option checked under 'Split points'
'Min slice length' and 'Min silence legth' sliders are at the minimum
'Split selected item' option is enabled under 'Action to perform' 
'Create chromatic MIDI from slices' is checked
The rest is unchecked

2. Adjust the threshold with 'Transient Detection settings' dialogue

'Use zero crossings' can be unchecked since we won't be using the audio

3. Hit the 'Split' button in the Dynamic split dialogue

4. Keeping the source audio item selected right click the item and run 'Heal splits in items'

5. Select all the MIDI notes in the generated MIDI item, right click -> Note properties, 
from the 'Note:' menu select the target note to move all the notes to and click Apply

5. If you need to combine all the created MIDI items into one, place them on top of each other
then marquee select so that items underneath are selected as well, right click on the item and run 'Glue items'
to glue them into one.

--------------

Alternative method using 'Audio to MIDI Drum Trigger' stock JS plugin and the action
'Apply trac/take FX to items as new takes (MIDI output)' + some tricks

https://www.youtube.com/watch?v=VwgvBtAZLZU

==============================================================

-- Obscure file formats


REAPER can read .sd2 files! If the file does not already have a filename extension, add .sd2 (or .raw or .pcm), 

and drag them into REAPER. You should get a popup window with some more information.

Because .sd2 files do not natively include metadata about the bit depth or sample rate, REAPER will guess at those 

parameters when importing. If the file doesn't sound right, open the source file properties for information about how 

to change the decoding parameters.


https://forum.cockos.com/showthread.php?t=281830#14

==============================================================

-- Preserve sample length at different pitches in RS5k


To play RS5K Samples at different pitches while preserving sample length, select Mode: Sample, and place the ReaVoice vst after RS5K.

You may want to adjust settings on RS5K such as Max Voices: 1, and selecting if you want it to Obey note-offs, Loop, or Xfade.

You can select the number of voices you want to play simultaneously in ReaVoice.

There will likely be a strange, slight delay before ReaVoice starts to generate the intended result. I suggest resampling/recording 

the output until this feature is improved and integrated into RS5K so that you can play it in real time like Akai, Ableton, or Maschine samplers.


https://forum.cockos.com/showthread.php?t=184952#29

==============================================================


-- Moving marker / region start/end to the edit cursor

1. Set the ruler time unit to Minutes:Seconds OR Seconds
2. Open 'Region/Marker Manager'
3. Place the Edit cursor at the desired location
4. Double click the time readout in the Transport
5. From the 'Jump to time/marker/region' copy the time value displayed in the 'Jump to' field
which is the Edit custor current time
6. Double click Start or End field of the relevant marker/region in the 'Region/Marker Manager'
5. Paste the value copied in step 5
7. Hit enter to confirm.

To move those to an item start, from Media Items Ptoperties dialogue extract item start time value
and follow steps 6-7 from above


==============================================================

-- Ramapping Virtual MIDI keyboard note computer keyboard keys associations

https://forums.cockos.com/showthread.php?t=11905#12
https://forum.cockos.com/showthread.php?t=158271#10

For REAPER to recognize non-ASCII characters, these must be listed as their codepoints,
i.e. Ù must be listed as 217 (decimal) or 0x00D9 (hexadecimal) which you can look up 
for example here https://www.charset.org/utf-8 where the code in hexadecimal format appears as U+00D9,
mere saving the file in UTF-8 format won't work.


==============================================================

-- ReaSamplomatic5000 (RS5k) velocity to gain (volume, amplitude) formula


Linear interpolation of gain (so if mapping 0..127 to -inf .. +0dB, 63 would be around -6dB (0.5), 32 would be around -12dB (0.25) etc.


https://www.askjf.com/index.php?q=6883s


==============================================================

-- Scripts to quantize audio by MIDI notes similar to Logic as shown in https://www.youtube.com/watch?v=d_Sey1tAmpo


Create stretch markers from MIDI notes by spk77

https://forums.cockos.com/showthread.php?p=1463470


Quantize Audio Takes via Reference MIDI Take by Eviluess

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


bfut_MIDI notes control items stretch markers.lua


MPL QuantizeTool

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


==============================================================

-- How to exclude items on certain tracks when copying/moving region


Items lock doesn't prevent copying/moving them with regions.


Instead using action 'Track: Cut tracks' or a combination of 

'Track: Copy tracks' and 'Track: Remove tracks'

cut the track(s) whose items you don't want moved or copied with the region, 

then move/copy the region, then paste the cut track(s) back in.

If the cut tracks weren't contiguous after pasting they will be

so re-ordering may be required


==============================================================

-- Way to temporarily change and toggle mouse modifiers config since REAPER 7
-- instead of deprecated 'Set default mouse modifier action for...' actions

The intended replacement for the deprecated actions is to create a simple reascript. 
For example the deprecated action 'Set default mouse modifier for media item left drag 
to move item contents ignoring snap' can be replaced with this reascript:

reaper.SetMouseModifier("Media item left drag", 0, "Move item contents ignoring snap")

Benefits: you can set as many modifiers as you want in the same reascript, you can do other things 
in the reascript too, you can set non-default (shift, control, shift+control, etc) modifiers 
just as easily, but most importantly the system doesn't require us adding a zillion more actions 
every time we add support for new mouse modifiers.


https://forums.cockos.com/showthread.php?t=283579&page=3#113
https://www.youtube.com/watch?v=FAKiHozcE8o&t=1391s

All 803 'Set default mouse modifier action for...' actions as of REAPER 6.83
https://forum.cockos.com/showthread.php?t=284185

==============================================================

-- Creating muilti-channel input and output on a single track


Create a new track, and click the I/O routing button for that track.

Disable "Master send channels from/to"

Select number of track channels, eg 24.

Close the routing dialogue.

In the track panel select your multichannel input, eg "Input 24 channel > [your device] 1-24"

Open the I/O routing dialog again on the track and select "Audio Hardware Output > [your device] output 1 / 2"

Under the fader for that hardware send, select "Multichannel source > 24 channels > 1-24.

Enable monitoring on the selected track (the little speaker symbol)

The track should now work like a multichannel tape machine, with all inputs monitored through their respective outputs, 
and will create audio items with 24 channels - or up to 64 if your hardware has enough inputs and outputs.

https://reddit.com/r/Reaper/comments/17j4c3w/ripple_patching/k6yw1hl/


==============================================================

-- Javascript/Typescript for Reaper Scripts (Lua transpiler + Reaper types)


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

==============================================================

-- Rust bindings for REAPER

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


==============================================================

-- Using

CF_CreatePreview()
CF_Preview_Play()
CF_PCM_Source_SetSectionInfo()


https://github.com/reaper-oss/sws/issues/1804
https://github.com/reaper-oss/sws/issues/1806


==============================================================

-- How to create a mousewheel script that will trigger sequentially a series of actions

https://forums.cockos.com/showthread.php?p=2477735

==============================================================

-- Action Options: Automatically insert automation item when activating envelope that is bypassed outside of automation items and not displayed in envelope lane

Schwa

...the behavior is complex!

In general, existing envelope points that exist outside of automation items are hidden if you then enable "bypass envelope outside of automation items", regardless of whether or not the envelope is displayed in its own lane. Toggling that option doesn't create new automation items.

When envelopes are displayed in their own lanes by default, and envelopes are bypassed outside of automation items, activating a new envelope does not automatically create an automation item on the envelope, because it's obvious the new envelope exists.

When envelopes are not displayed in their own lanes by default, and envelopes are bypassed outside of automation items, you have a problem when you activate a brand-new envelope: you have no way to see that the envelope exists. The option "Options: Automatically insert automation item when activating envelope that is bypassed outside of automation items and not displayed in envelope lane" exists to handle that problem, by automatically inserting an automation item in the media lane when you create a new envelope in that situation.


https://forum.cockos.com/showthread.php?p=1975784#5

==============================================================

-- Changing some of the theme's fonts via Theme Development settings

Open Theme Development settings with the action Theme development: Show theme tweak/configuration window, search for font

You'll find 16 'WALTER font' slots, some are already taken, most are not.

In the theme's rtconfig.txt file locate section

; ----------------- WALTER -------------------
; font #1 - MCP Track Numbers

; font #2 - Extended Mixer

; font #3 - Transport Selection

; font #4 - Envcp labels

; font #5 - Transport Rate

; font #6 - Extended Mixer - Large layouts
; -------------------------------------------

This section only serves as a reminder what is what because it's commented out.

These font numbers correspond to WALTER font slots in the Theme Development settings
and are assigned to UI elements inside the code, e.g. trans.rate.font (#5), trans.sel.font (#3),
tcp.fxparm.font (#2) as of v5 default theme. So in the rtconfig.txt file you search for any
elements which end with '.font' and collate their font setting with the reminder list above.
SInce there're 16 WALTER font slots and only 6 are enganed by default, the non-engaged slots can
be linked to other elements or used to changed the font setting without affecting the original
WALTER font slot setting.

based on White Tie's suggestions:

Make one of your theme editor 'WALTER font' settings into a big bold fella, 
then set its number for 'trans.bpm.edit.font' within your theme's WALTER.

https://forum.cockos.com/showthread.php?t=131790#4

The theme's maker changes that using trans.bpm.tap.font in the rtconfig file, 
which points to an entry that you should be able to change in the theme tweak/configuration window

https://forums.cockos.com/showthread.php?t=235369#2


==============================================================

You can work around gluing items by moving them to a sub-project as a way of non destructively consolidating item FX

https://www.reddit.com/r/Reaper/comments/18od1v1/best_little_reaper_tips_and_tricks/


==============================================================

-- Setting up shortcuts for toggling with momentary MIDI buttons

-- Script for muting 1st selected track which must be mapped to a momentary button 


local is_new_value, filename, sectionID, cmdID, mode, resolution, val = reaper.get_action_context()

local name, flags = reaper.GetTrackState(reaper.GetSelectedTrack(0,0))
local track_muted = flags&8 == 8

	if (val == 127 or val > 0) and track_muted then
	reaper.Main_OnCommand(40731,0) -- Track: Unmute tracks
	elseif (val == 127 or val > 0) and not track_muted then
	reaper.Main_OnCommand(40730,0) -- Track: Mute tracks
	end
	
do return reaper.defer(function() do return end end) end


https://www.reddit.com/r/Reaper/comments/xryy58/use_momentary_midi_buttons_for_shortcuts_need_help/

==============================================================

-- Action shortcut behavior

-- returned as mode, resolution and val:

local is_new_value, fullpath, sectionID, cmdID, mode, resolution, val = r.get_action_context()

-- Click (mode 0, resolution 127), mousewheel (mode 1, resolution 127)
-- Absolute (mode 0, resolution 127) - rotary knob 0 - 127
-- Relative 1 (mode 1, resolution 127) - rotary knob +1 -> +63 -> -64 -> -1
-- Relative 2 (mode 2, resolution 127) - rotary knob -63 -> 0 -> +63
-- Relative 3 (mode 3, resolution 127) - rotary knob +1 -> +63 -> 0 -> -1 -> -63

resolution probably can be 14 bit which is 16,383

==============================================================

-- Inverse envelopes (when point value of one envelope is increased, on the other it's decreased and vice versa)

1. Create an automation item (AI) under an envelope curve or create a new AI with an envelope
2. Duplicate it creating a pooled copy
3. Place the pulled copy on the envelope of another track, on another envelope of the same track
   OR on the same envelope at another location on the timeline
4. Open AI properties window of the second AI instance and set its Amplitude parameter to -100
5. Change value of any point in either instance of these AIs, the value of the parallel point in another instance will be inverted.

https://old.reddit.com/r/Reaper/comments/1akbqgj/is_there_a_way_to_entangle_to_points_on_say_pan/


==============================================================

-- Navigating item with the Edit cursor

1. Right click the video item -> Item settings -> Display item ruler (select option which includes time line division you need)
2. Open Edit -> Nudge/Set Items
3. Select Edit cursor from the 2nd drop down menu of the Nudge/Set Items utility
4. Select required time division from the last drop down menu
5. And in the 3d (to:) field key in values to move the cursor to or by depending on the selection in the 1st drop down menu.

Before starting run 'Item navigation: Move cursor to start of items' action to set edit cursor to the item start

==============================================================

-- Trigger random sample

Besides resorting to RS5k round robin setup (see elsewhere in this doc) ...

Populate RS5k with a bunch of samples as velocity layers under List button 
(the limit i assume is 127 as the number of velocity levels) and then randomize 
velocity with a plugin inserted upstream. The downside is that velocity cannot 
be used to control their volume.

Instead of a single dedicated plugin a plugin chain can be used:

JS: schwa/midi_humanizer
JS: MIDI/midi_velocitycontrol

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

OR 

MIDI_Probalocity

OR

MIDI_Variant

both by IXix

https://forums.cockos.com/showthread.php?p=1978337
https://github.com/IXix/JSFX/tree/master


==============================================================

-- Convert audio drums to MIDI

https://www.reddit.com/r/Reaper/comments/1aurro9/audio_drums_to_midi/


1. Insert the following plugins on a track in the following order:

ReaEQ 1
ReaGate 1
ReaEQ 2
ReaGate 2
ReaEQ 3
ReaGate 3
JS: Volume/Pan Smoother

2. Set their routing under '2 in 2 out' button as follows:

ReaEQ 1 - 1/2 -> 3/4
ReaGate 1 - 3/4 -> 3/4

ReaEQ 2 - 1/2 -> 5/6
ReaGate 2 - 5/6 -> 5/6

ReaEQ 3 - 1/2 -> 7/8
ReaGate 3 - 7/8 -> 7/8

JS: Volume/Pan Smoother - 3/4 -> 1/2, 5/6 -> 1/2, 7/8 -> 1/2

3. Configure these plugins as follows:

----- Kick band
ReaEQ 1 - One tab, Type: Low pass, Frequency: 150, Bandwidth: 0.88
ReaGate 1 - Threshold -6 dB, Send MIDI on open/close enabled, note: 60, the rest is default

----- Snare band
ReaEQ 2 - Tab 1, Type: Band, Frequency: 1400, Gain: 8, Bandwidth: 1.40
	  Tab 2, Type: Hi Pass, Frequency: 700, Gain: 0, Bandwidth: 2 (default)
	  Tab 3, Type: Low Pass, Frequency: 2800, Gain: 0, Bandwidth: 2 (default)
ReaGate 1 - Threshold -3.5 dB, Send MIDI on open/close enabled, note: 62, the rest is default

----- Hats band
ReaEQ 2 - One, Type: Hi Pass, Frequency: 9900, Gain: -4.6, Bandwidth: 0.34
ReaGate 1 - Threshold -13.8 dB, Send MIDI on open/close enabled, note: 64, the rest is default

4. Create a send from the track with the above chain to another empty track

5. Disable Audio send, disable Record monitoring

6. In the record button right click context menu select Record: output -> Record: output (MIDI)

7. In the record button right click context menu select Track recording settings (Input Quantize, Format, etc.)

Enable 'Quantize track MIDI recording' option

Set Quantize to: 1/16

Enable 'Quantize note-offs'

Strength 100%

The rest is to taste but for the sake accuracy keep Swing at 0% and 'Quantize within' sliders at 0% and 100%

8. Record on the second track

9. While it's directly below the original audio item open the recorded MIDI file in the MIDI Editor 
docked in the bottom docker and tweak the recording relative to the orgiginal audio.

The options 'Sync Editor transport to project transport' and 'Use the same grid division in arrange view and MIDI Editor'

under MIDI Editor Options can be enabled.


OR DOWNLOAD THIS SETUP AS A TRACK TEMPLATE AT

https://stash.reaper.fm/v/48244/Multi-band%20gate%20for%20audio%20drums%20to%20MIDI%20conversion.RTrackTemplate


--------------------------------------------

Method 2


https://youtu.be/fZhU0HyLreI?t=47
https://www.youtube.com/watch?v=VwgvBtAZLZU


1. Duplicate the track with the drum stem/break as many times as there're elements you wish to convert to MIDI

2. On each of these tracks insert 'Audio to MIDI Trigger' JSFX plugin

3. Open 'Transient detection settings' dialogue from the main View menu and make sure the checkbox 'Display threshold in media items...' is ticked

4. For each drum stem/break copy in turn while its selected set transient detection threshold using the dialogue and then paste the threshold value 

into 'Audio to MIDI Trigger' JSFX plugin Threshold parameter field. The dialogue is only used as a visual aid.

5. Set 'Audio to MIDI Trigger' JSFX plugin Retrigger parameter to around 60 ms, but the sweet spot is a matter of trial and error

6. Once steps 1-5 are complete, select all drum stem/break copies and run the action 'Apply track/take FX to items as new take (MIDI)'

available in the item context menu



--------------------------------------------

Method 3


1. In the 'Dinamic split' dialogue under 'Action to perform' enable 'Split selected item' option and check 'Create chromatic MIDI from slices'

2. Run dynamic split on the selected item

3. Heal the splits in the item using action 'Item: Heal splits in items'

4. In the chromatic MIDI item just created select all notes, open 'Event properties' aka 'Note properties' dialogue

and clamp all events to the same note by selecting the desired note from the 'Note:' drop-down list and clicking OK

5. Once you've gone through steps 1-4 for each type of drum part, if you also need to combine all the parts into a single MIDI item

place all the MIDI files which have been created, on top of each other, select the top one with marquee so that the ones beneath

are also selected and Glue them


==============================================================

-- Apply frequency curve of one audio source to another

With Spectrum Matcher by Geraint Luff


https://www.youtube.com/watch?v=3Cw3Z5L-h08
https://geraintluff.github.io/jsfx/

==============================================================

-- Overlay spectra of different tracks to spot conflicts


Multiple Tracks/Channels in 1 Frequency Analyzer -- In Reaper

using Sai'ke (Joep Vanlier) Spectrum Analyzer
https://github.com/JoepVanlier/JSFX/tree/master/SpectrumAnalyzer

https://www.youtube.com/watch?v=n3haB4oCwMg


==============================================================

-- CC envelope colors

These are colored by the MIDI channel


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


==============================================================

-- MIDI banks navigation

1. Insert ReaControlMIDI plugin upstream of a plugin whose bank needs switching

2. Load a .reabank file into it

3. Save each bank selection as a ReaControlMIDI preset

4. To navigate between ReaControlMIDI presets Use 

a script https://github.com/Buy-One/REAPER-scripts/tree/main/FX/BuyOne_FX%20preset%20navigation

or SWS extension actions

SWS/S&M: Trigger preset ...

SWS/S&M: Trigger next preset ...

SWS/S&M: Trigger previous preset ...

==============================================================

-- Accessing backups

To get a backup history dialogue from an .rpp-bak file drag and drop it into the session

If it's opened by double click, provided the file is associated with REAPER, the most recent backup will load instead


==============================================================

-- TCP custom action buttons (since v7)

Changing the actions of custom buttons is quite simple: in the rtconfig file they are located in a separate block. 
Find the text "CUSTOM BUTTONs, from here", this will be the beginning of the button code.
In the first half, the sizes of the buttons and their positions are set (I do not recommend changing this, 
the code there is quite complex even for me). And in the second half there are actions assigned to buttons. 
On lines starting with "custom tcp.custom." there is what you need.
For example, the width button code:

custom tcp.custom.wdth "W" _RS8971d98edc3d0bbfc747e3717f63e4143b267fc2 "Toggle Width Knob" 


The first W inside the quotes is the letter that shows on the button.
_RS8971d98edc3d0bbfc747e3717f63e4143b267fc2 is the ID action command that this button launches.
and
Toggle Width Knob inside quotes is the tooltip text that appears when you hover the mouse over the button.

You can change these three values at your discretion, getting different display and different bound actions. Same for other buttons.
After making changes to the code, do not forget to reload the theme for the changes to take effect.


https://forum.cockos.com/showthread.php?p=2758632#20
https://forums.cockos.com/showthread.php?t=86084&page=3#109
https://forum.cockos.com/showthread.php?t=275900#3


==============================================================

-- Video processor tricks


I just discovered by accident that there is an undocumented alternative syntax for "@param" line in presets. The alternate syntax is

Code:
//@param ParameterVariableName "ParamShownName" default_value minimum_val maximum_val medium_value step_size

for example instead of:

Code:
//@param1:alpha 'alpha' 1 0 1 .5 .01
//@param2:zoom 'zoom' 1 0.01 4 1 0.01
//@param3:offX 'offset x' 0 -1 1 0 0.001
//@param4:offY 'offset y' 0 -1 1 0 0.001

you can write:

Code:
//@param alpha 'alpha' 1 0 1 .5 .01
//@param zoom 'zoom' 1 0.01 4 1 0.01
//@param offX 'offset x' 0 -1 1 0 0.001
//@param offY 'offset y' 0 -1 1 0 0.001

so you may reorder parameters or insert new ones without renumbering

BTW did you know you can increase the precision of the "rotate" angle of the "Track opacity/zoom/pan - video processor" just by changing

Code:
//@param5:rotate 'rotate' 0 -360 360 0 1

with

Code:
//@param5:rotate 'rotate' 0 -360 360 0 0.1


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


==============================================================


-- Selecting all text in project / item notes / FX comments

Since Ctr+A isn't supported, to select all place the cursor at the very beginning of the text

and hit Ctr+Shift+End

OR CONVERSELY

place the cursor at the very end and hit Ctr+Shift+Home



==============================================================

-- Importing .ReaperMenu dumps


REAPER doesn't allow importing dump files into a menu section or a toolbar

whose header (title) is different from the one stored inside .ReaperMenu file

between square brackets at the top. For example floating toolbar 2 dump cannot

be imported into a toolbar other than 2.

To overcome this change the dump file header so it matches the toolbar or the menu

title the dump file is being imported into.


==============================================================

-- Create custom named command IDs for custom actions and scripts

a method discovered by X-Raym


1. Install a script or create a custom action in the Action list

2. Export it as .ReaperKeyMap file from the Action list

3. Replace its current named command ID which looks like so "d6bfa01f0785664bac5abb42b0035b9e" inside the .ReaperKeyMap file

4. Import it back into the Action list

(with scripts they must keep residing at the same path, otherwise the path too can be modified inside the .ReaperKeyMap file: 

if the script is located inside the \Scripts directory its path must be relative to it, if it's located outside of it

it must be absolute)

5. Delete the old entries

Steps 4 and 5 can be swapped


SOME WARNINGS AND GUIDELINES

This method is a hack. It had for purpose to showcase a problem, and our desire to fínd a way to overcome it. 

Cockos developpers personnaly recommend to not abuse of it, and even to not use it at all. 

Speaking about COMMAND_ID, I don’t know yet all we have to know to make a good one, but based on what I was 

from SWS extensions, I will advice you to keep it concise, without spaces, and write it in UPPERCASE. Of course, 

it has to be unique, so add your pseudo as preíx may be a way to be sure that your COMMAND_ID will be unique.

A proper COMMAND_ID is critical. I Don’t know what are there limites but I have bad surprises with actions names 

so here as general guidelines based on my experiences: 

+ Letters, numbers and underscore (_) only

+ Letters Uppercase

+ Don’t start with an underscore (_): it will be added automatically

+ No more than 34 characters (it seems to work with more but this I cannot be sure)

+ Use a distinct initial as preíx (from your pseudo for eg), to be sure that your command IDs will be unique

Command_ID seem to be more îexible than that but it's impossible to test every scenario (aka call from other scripting language, 

diìerent OS, toolbars etc…), so keep it simple.



Script displayed name can be modified as well. In the .ReaperKeyMap file the script name will start with 'Custom:'

just like a custom action. After import it'll be replaced with 'Script:'

If you want to change a script displayed name, you will have to delete its current entry írst.


https://www.extremraym.com/en/advanced-reascripts-management/
https://www.youtube.com/watch?v=Y_K8vIuBaB8
http://forum.cockos.com/showthread.php?t=156798
https://forum.cockos.com/showthread.php?t=221328


==============================================================

-- Side-chain on the Master track

1. Send the signal of the side-chain source to channels 3/4 in parallel with 1/2

if it also has to be heard in the mix or instead of 1/2 if it must be muted by checking

relevant boxes in the VST Out matrix of the side-chain source plugin Pin connector dialogue. 

Increase the number of matrix channels if 3/4 isn't available.

2. From the Master Track channels drop-down selector in the I/O (Routing) dialogue select at least 4.

That's it.

https://www.youtube.com/watch?v=aEgdJKlC8AA

==============================================================

-- REAPER debugging with higher timer rates

will never get out of +dev builds, in the [REAPER] section, requires a restart of REAPER to take effect:

fasttimer=x
x having 1 set means run csurf/automation timers at a higher rate
x having 2 set means run misc timers from message pump if stalled (Windows only)
x having 4 set means run meter timers from message pump if stalled (Windows only)

(these can be combined, e.g. 3 is 1 and 2 set, 5 is 1 and 4, etc).

https://forum.cockos.com/showthread.php?t=293607#5

==============================================================

-- Save a script preventing its immediate execution (useful for defer scripts)


Ctrl+Shift+S

https://forum.cockos.com/showthread.php?t=274406#2


==============================================================

-- SWS Cycle action editor LABEL statement

The LABEL statement is meant to allow running SWS/IX: Label processor commands from cycle actions 

(also accessible from the SWS/S&M extension menu)

ref: https://github.com/reaper-oss/sws/issues/562


==============================================================

-- ReaTune color

Manual Correction piano roll background color has the same color settings

as the MIDI Editor background colors in the 'Theme Development / Tweaker' window


https://www.youtube.com/watch?v=3W7uVvcl1zo&lc=Ugw6A2Rcws8lR4tvCsR4AaABAg.A6xBqClyFdXA6xcyrAH1sW

==============================================================

-- Syncing up several open projects with offset


Supported since v7

1. In each project add a marker named =REF at locations from which the particular project must start playing

OR which determine by how much projects playback will be offset relative to each other if playback starts elsewhere

2. Enable the following options in project tab right-click context menu:

'Run baclkground projects'

'Play stopped background projects with active project'

'Synchronize play start times w/ play background projects'


The feature is in essence an enhancement of the last option which allows syncing with offset

The playback in each project may start from anywehere but the difference in =REF markers location

will determine the relative difference between the current playhead positions in each project



https://forum.cockos.com/showthread.php?t=284653 -- not much info here, but can be used for further discussion if needed

==============================================================


-- Render/Batch converter 'Postprocess render' window (Normalize/Limit/Fade) order of operations


trim silence => fade-in/fade-out => pad with silence => normalize => limit

https://forum.cockos.com/showthread.php?t=294334#13


==============================================================

-- A knee in envelope curve (not a smooth curve)

schwa:

That is standard/default behavior for volume envelopes, scaling by amplitude. 

If you have the default volume envelope range (preferences/editing behavior/envelope display) 

set to +12dB or +24dB then the top half of the envelope scales differently from the bottom 

(which is always -inf to +0dB). So any envelope segment that spans +0dB will have a kink.

If you don't like the kink you can either set the range to +0dB or +6dB, or you can right-click 

the envelope and set the envelope default to fader scaling.


https://forums.cockos.com/showthread.php?p=1768388#3


==============================================================

-- Fixed lanes settings priority


The options menu controls what happens when you record the *first* overlapping media item on a track. The first overlapping media item can:

1. Add lanes: this puts the track in fixed lane view, disabling "recording -> add lanes in layers" for that track.

2. Add lanes in layers: this puts the track in fixed lane view, enabling "recording -> add lanes in layers" for that track.

3. Both of those options disabled: in this case one of the other behaviors in the options menu applies (split items, tape mode, etc).

These options only affect what happens when the first overlapping item is recorded, in other words the options menu defines the default behavior for overlapping items.

Once an overlapping item has been recorded on a track, then the track settings determine the behavior. The track's "recording -> add lanes in layers" setting determines whether newly recorded lanes play in addition to previously playing lanes, or play exclusively.

The "record into first available lane" track setting is independent of all of the above behavior. If that is enabled, new recording will go into the first lane *that does not have an earlier recording above it*. The idea is that if you have overlapping recordings, the earlier recording is always above the later one.


https://forums.cockos.com/showthread.php?p=2750447#8

==============================================================


-- Quick access of properties in the Media Item Properties dialogue from keyboard


A characters which serves as quick access shortcut is underscored in the property name. 

To see the underscrore hold down ALT and press ANY character key.

If any text input field is currently active, in order to target property via quick access shortcut 

ALT must be held down, and to target 'Properties' and 'Rename file' buttons ALT must be complemented with SHIFT.

Once at least one quick access shortcut was used the rest get activated and for them ALT and SHIFT can be omitted.

If no text input field is active all quick access shortcuts can be used without ALT and SHIFT

All this only works when the Item Media Properties window is focused.


==============================================================

-- REAPER search filter syntax (REAPER User Guide, chapter 6.2 Using Search Filters)


The description mainly uses FX Browser filter examples, but the priciple is the same everywhere.


THE SEARCH STRING IS NOT CASE SENSITIVE UNLESS THE CHARACTERS SEARCH TERM IS COMPRISED OF ARE OUTSIDE OF ASCII RANGE

You can search for more than one string within the same name. For example:

eq stereo will find all plugins with both eq and stereo anywhere in their name, regardless of the order in which they appear. eq  AND  stereo would produce exactly the same results.

The filter also supports other boolean search terms notably OR and NOT, and the use of parentheseses, e.g.: comp OR lim  finds and lists all plugins with comp or lim in their name.

eq ( cockos OR melda )  finds all Cockos and Melda plug-ins with eq in their name. You must leave a space both before and after the parentheses.

cockos ( eq OR comp )  finds all Cockos plug-ins with eq or comp in their name.

blue cat NOT ( flange OR phase )   finds and lists all Blue Cat plug-ins except those with flange or phase in their name.

( chorus OR delay ) NOT ( DX: OR JS: )  finds all effects with chorus or delay in their name except Direct X and JS ones.

There are some additional techniques that you can use to make your searches more finely tuned.

Enclosing a search string in quotes (either double or single) will find only those plug-ins where the text is matched exactly. For example: “sony noise”  would find Sony Noise Gate but not Sony Express FX Noise Gate. Likewise “reaverb” would find ReaVerb but not ReaVerbate.

Typing a space immediately after the opening quotes mark will limit the search to those items where the specified string is at the very beginning of a word. For example:
“ volu” will find plug-ins which include the word volume but not convolution..

Similarly, typing a space at the end of the string will only find those items where one of the words in the FX name ends with that string.

Starting a search string with ^ will find only those items whose name begins with the specified string, and using a $ at the end of a string will find only those names that end with that string.

For example, when working in the media explorer, using ^blues as a filter would list only those items whose names begin with blues.
Similarly, in the track manager, a filter such as guitar$ would display tracks with names such as lead guitar or rhythm guitar but not guitar solo.


==============================================================

-- Media Explorer player actions

Accessibility of these actions depends on the focused part of the Media Explorer window 

and the mouse modifier they're bound to but the relationship between these isn't obvious.

Clarification follows.


Preview: Play/stop (Space) -- work when File list / Preview player is in focus

Preview: Play/pause (Ctrl+Space) -- works when Folder tree / File list / Preview player is in focus

Preview: Play (Right arrow key) -- works when Preview player is in focus


The preview player focus is activated when the it's clicked directly, the problem is that in this case the playhead is moved

to the click location which is indesirable if you want to preview from a specific location.

There're several ways to activate Preview player focus without moving its playhead: click the Media info box (if open), 

click the player scrollbar only if the last focused window was File list, click the preview player while holding down Shift



==============================================================


-- Changing tempo value of several tempo markers at once


1. Change the tempo envelope range max or min setting to the target value depending on whether the target tempo 

is greater or smaller than the points current tempo value

(right click any point -> Range/scaling for the envelope -> Tempo envelope: range)

2. Select the envelope points (must all be initially set to the same tempo value, won't work if their tempo values differ)

3. Drag them all the way up or down depending on whether the target tempo is greater or smaller than then point current tempo value

4. Restore the envelope range


If points initial tempo values differ, the method is still useful but the points must be dragged all the way up/down one by one

The good thing is that if there're points whose tempo value greater/smaller than the max/min range value which you change the setting to

they keep their values regardless of the range temporary max/min value, unless dragged explicitly up or down


==============================================================


-- Reducing plugin control range by 50% in both negative and positive directions with parameter modulation

Baseline: middle

Offset: 50%

Scale: 50%

Range -200 +200 will become -100 +100

==============================================================


-- Property names for the functions FNG_Get/SetMidiNoteIntProperty


VELOCITY, PITCH, POSITION, LENGTH, CHANNEL, SELECTED, MUTED


https://github.com/reaper-oss/sws/blob/master/Fingers/RprMidiTake.cpp#L103


==============================================================


-- Langpack files public URL (direct links Landoleet are prohibited by the server policy)


https://www.reaper.fm/files/7.x/reaperXXX.ReaperLangPack


where XXX is 3 digits of the version number, e.g, reaper733.ReaperLangPack

however for REAPER 7 it's reaper70.ReaperLangPack


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


==============================================================

-- Ensuring clean encoding of an audio into a lossless format, including streaming


The master should peak at -1 dBTP (true peak decibels)

Or at -2 dBTP if it's louder than -15 LUFS

If the master is already hitting close to 0 dBFS, it's advised to measure true peaks 

and reduce the level accordingly


Ian Shepherd
https://productionadvice.co.uk/spotify-upload-true-peak/


From experience, reducing by 0.3 dB the level of a 16 bit 44100 Hz wav file peaking at 0 dB

ensures that conversion into mp3 doesn't produce overs


useful: https://www.loudnesspenalty.com/ Find out if your music will be turned down by YouTube, Spotify, TIDAL, Apple Music and more


==============================================================

-- Recommended loudness of a master


No louder than -10 LUFS short-term at the loudest moments (with True Peaks no higher than -1)

If you follow this suggestion, you’ll be in great shape, in almost any genre. Your songs will 

be loud enough to sound “competitive”, whilst still retaining plenty of punch and dynamic contrast. 

They’ll stand shoulder to shoulder with anything else, on all the streaming platforms, 

and they won’t get turned down by a huge amount.

LFUS Integrated isn't a good metric because it's an average and two masters with the same average

may sound very different loudness wise.


Ian Shepherd
http://productionadvice.co.uk/how-loud/


==============================================================

-- Quick routing creation in projects with long track count so that there's no need 

-- to drag the mouse cursor from the source track to the detination track across a long track list


1. Place all your main destination tracks (busse, FX returns) at the top of the track list

2. Create a routing by right clicking the I/O (routing) button on the TCP/MCP

and select the destination track from the list in the context menu where it will be found

at the top of the list so no scrolling is needed

Alternatively left click the I/O (routing) button on the TCP/MCP and select the destinaion track

from the pull-up list.

Yet another alternative is using the Routing Matrix (Alt+R).


https://reddit.com/r/Reaper/comments/1iu5pxo/increase_scrolling_speed_when_drag_and_dropping_a/


=============================================================

-- Spot files to their original position at the moment of recording


Works with files with embedded BWF chunk. REAPER does write the relevant info into the recorded files.

1. Drop files into the project

2. Keep them selected or select all

3. Run action Item: Move to media source preferred position (BWF start offset)

This works provided the item source is looped (Loop source option is enabled) and its start matches its source start or its source is not looped

Since build 7.46 works for video files with encoded LTC

https://reddit.com/r/Reaper/comments/1iueutr/insert_into_project_at_origin/


=============================================================

-- Insert envelope segment maintaining envelope curve/shape


Inserting one point will always result in curve change because REAPER recalculates it
when segment length changes, which is the case when a new point is inserted.

The solution is simultaneous inserting of at least two points, so

EITHER 

1. Draw an audomation item at the location where you want the new segment to be created
2. Right click the automation item and select 'Delete automation item, preserve points'

OR

1. Create time selecton over the envelope where you want the new segment to be created
2. Select the envelope if not already selected
3. Execute action 'Envelope: Insert 4 envelope points at time selection'
4. Optionally delete extra points immediately outside of time selection


https://reddit.com/r/Reaper/comments/1j6q2yt/how_to_insert_points_without_affecting_envelope/


=============================================================

-- Convert all project media sources into another format individually

File -> Save project As.. 

Checkmark the options: 

Create project directory

Copy all media into project directory -> Convert media -> Format

https://reddit.com/r/Reaper/comments/1j8b9f0/consolidate_without_glueing/mh47v6s/


=============================================================

-- Returning to the previewed file directory in the Media Explorer


Having gone far away from the directory of the previewed file in the directory tree,

in order to relatively quickly return to the file's directory

1. Right click preview player
2. Show in explorer/finder OR execute the action 'Media: Show in explorer/finder'
3. Once the explorer/finder window opens copy its path from its address bar
4. Paste into the Media Explorer directory address bar
5. Hit Enter to switch the Media Explorer to that directory


=============================================================

-- Prevent accidental deletion of track without items


Since tracks cannot be locked, to pevent accidental deletion place a dummy item on a track, 

or add a dummy child track to it, both of which at deletion attempt will generate a warning


=============================================================

-- Plugin preset count limit for presets in REAPER native format


Based on Justin's response here https://forum.cockos.com/showthread.php?p=2670622#4 

the limit seems to depend on the preset file size (the .ini file in the /presets folder), 

which in turn depends on the amount of data stored by the plugin per patch. 

But he didn't explicitly say what the file size limit is.

The presets in excess of the limit will still be written into the file but won't show up in the preset list


=============================================================

-- Having a big item label for greater visibility

1. Select the media item
2. Right click the item -> Set time selection to items
3. Go to 'Insert' menu and click 'Insert empty item'
4. Now the empty item overlays the original item
5. Marquee (lasso) select both items
6. Hit G shortcut to group them
7. Double click this composite item
8. Type the label text inside the empty item text box which will pop up
9. In the empty item drop-down settings menu select 'Stretch image/text'
10. Click 'Apply' or 'OK'

This will work provided item grouping is enabled, the option 'Offset overlapping media vertically' 
(old name 'Show overlapping media items in lanes (when room)') is disabled.
'Selecting one item selects group' may or may not be enabled. If it's not, then the composite item 
can only be selected by marquee (lasso) selection.

To be able to access the media item properties enable the option 'Offset overlapping media vertically' 
(old name 'Show overlapping media items in lanes (when room)') so that the items are displayed in lanes 
separately and the media item is directly clickable.

Alternatively at steps 1 - 3 make sure to leave a strip of the media item not overlayed by the empty item
(preferable at both edges) so it's directly accessible to mouse click. Dragging the item by grabbing the 
underlying media item rather than the empty item overlay will also simplify media item snapping, otherwise 
the focus of snapping will be edges of the empty item.

Item label color is editable via 'Media item label' and 'Media item label (selected)' properties 
in the Theme development/tweaker dialogue.


https://reddit.com/r/Reaper/comments/1jk8ktk/clear_item_labelling/mjwecna/

=============================================================

-- Forcing SWS extension auto-coloring on a track with a custom color and/or a name designed to trigger auto-color


When an unnamed track already has a custom color, entering a name which is supposed to trigger auto-coloring won't work

The solution is naming a track with the following custom action, preferably assigned to 'Track control panel - double click' context in Mouse Modifiers

Custom: Reset track color to default and (re)name
Track: Set to default color
Track: Rename last touched track


Neither will auto-coloring work if a track is already labeled with the name which is supposed to trigger auto-color

The solution is to press the 'Force' button in the Auto-color utility or run the action 'SWS: Apply auto coloring'

which can be assigned to 'Track control panel - double click' context in Mouse Modifiers


https://www.reddit.com/r/Reaper/comments/1jnwdlp/trigger_action_by_renaming_a_track/


=============================================================

-- Audio file size calculation formulas

Lossless (uncompressed) format

Size in bits = Sample rate * Bit depth * Duration (in sec) * Channel count

Size in bytes = Size in bits / 8

Size in Kilobytes = Size in bytes /  1024

Size in Megabytes = Size in Kilobytes / 1024

Size in Gigabytes = Size in Megabytes / 1024

OR 

Size in Gigabytes = Size in bytes /  ( 1024^3 )

----------------

Bitrate (bits/sec) = Sample rate * Bit depth * Channel count

Bitrate (Kbits/sec) = Bitrate (bits/sec) / 1000

----------------

Lossy format

Size in kilobytes = Duration (in sec) * Bitrate / 8


https://medium.com/@Xclusivesocial/sample-rate-bit-depth-bitrate-4ff624cc97db

=============================================================


https://www.sample-videos.com/


=============================================================

-- Having a maximum of 2 rows of tracks displayed in the Mixer

when the option 'Show multiple rows of tracks (when size permits)' is enabled

because if the window can accommodate more rows the track will line up in as many rows.


In the theme's rtconfig.txt file find a line containing mcp_min_height 240

change the value to a greater one, save and re-archive it in the theme's file.


https://forum.cockos.com/showthread.php?p=1765552



=============================================================

-- Ensure that you don't have any invisible or tiny items at the end of the project

because it will affect project bounds in rendering


Run the action 'View: Zoom out project'

and if there're any stray items the zoom will include the timeline beyond your last visible item


https://youtu.be/y-Tu14fG4C8?t=7560

=============================================================

-- Configuruing ReaGate in podcast editing


An audio gate is an effect that will help you to reduce unwanted noise below a certain threshold. Sometimes this is called a noise gate, and it's job is really simple. It opens and it closes. When the signal is above a certain threshold, it allows the audio to pass through completely unaffected.
And when the signal falls below that threshold, it closes and completely cuts the audio.
In other words, it mutes it so you can't hear anything. And this can be a very useful tool to cut down on background noise.
A gate's job is to open when the audio is above a certain threshold and close when it's below a certain threshold.
So a really quick way to set up a gate is to play the audio that you know that you want to cut out.
There are a few ways that we can tweak the gate to make it do its job a lot better. The first thing is adjusting this control down here called hysteresis.
Because right the gate is opening and closing at the same point, say negative 24.
But adjusting this hysteresis will separate the opening portion of the gate from the closed portion of the gate.
In other words we can get the gate to open at negative 24, but we can get it to close lower than that.
Setting the hysteresis to -6 decibels means that the gate will open at -24 and close at -30 so that the part of the signal which is lower in level than the threshold but which needs to be preserved is gonna come through the gate.
Additionally we can add a little bit of hold time maybe 75 milliseconds which will force the gate to stay open once the audio falls below the threshold, it gives you a bit more wiggle room at the end of phrases. And that can also increase the release time maybe up to 150 milliseconds. What that will do is increase the time it takes from the gate to go from the open
state to the closed state which is kind of a fade out time, if you will. Now 150 milliseconds is pretty fast because
a thousand milliseconds is one second. So this is happening pretty fast, but making the release a little bit longer
will smooth out the closing of the gate and it'll make it sound less chattery.
Unfortunately, there's no way to get this audio gate to work perfectly a 100% of the time.
There are other settings that you can tweak, like the low pass and the high pass and the RMS size, which may completely crush out the signal which needs to be muted.
However, those settings will also make it less reliable for the ends of phrases, which may be about at the same level.
There's not a great way to make it do both, but that's okay because on the whole this will make a really positive effect.
And when you hear it in context, you won't hear this kind of chattery sound.
There're a few more settings that would be good to tweak. One of those is pre-open. What this will do is it will move the open window, if you will, ahead of the cursor or the playhead. So that it will get the gate to open before the audio actually
rises up above the threshold. This will help to ensure that the beginning of every word is being caught.
So if we add like seven milliseconds of pre open, that's going to move the open forward in time by seven milliseconds.
So instead of opening right here, it's actually gonna open like right here which is going to catch the very beginning
of the word which is going to sound a little bit better. 
Now I also like to increase the attack time, which is kind of the fade-in time if you will, to maybe something like 5 milliseconds. And that will make the beginning of all of the words when the gate opens sound a little bit smoother. If you find that these particular settings still sound too chattery, what you can do is increase the pre-open time a little bit more, and maybe increase the attack time a little bit more.
And that will hopefully smooth out the opening phase of the gate so that it's not sounding so chattery, which can sometimes happen.
If some stray sounds are still popping through, to try and get it to not do that, you can adjust the RMS size setting.
By increasing this just a little bit, what you're doing is telling the gate that the audio needs to remain above the threshold for three milliseconds on average in order to trigger the gate to open. Which will reduce some of little clicky sounds a little bit. But be careful with the RMS size because increasing it just a little bit can affect how it opens up on certain sounds, and it may not work all the time. If you're trying to crush those out, that's the setting, that you want to adjust and very small values should work. So maybe even two or one milliseconds might get that to be out. You wanna set this as low as possible.
Now all of that said, I do not like to run a gate completely open and completely closed. Because I think that even though it is doing a great job, it still sounds maybe a little bit too harsh, it can still sound a little bit chattery.
So one thing that can help a little bit is to reduce the dry wet blend. This Wet circular knob controls how much of the affected sound versus how much of the unaffected sound goes through this effect. In other words, by default, all of the effects are set to 100% wet, meaning you are listening to the effect 100%. But by setting it to something like 90%, it's going to introduce 10% of the unaffected sound into the mix. And this can help reduce some of that chattering. 

https://youtu.be/y-Tu14fG4C8?t=3377

=============================================================

-- Project media (recording) path setting priority

For unsaved projects:

If no path is configured in any of the preferences, REAPER default path '%USER%\Documents\REAPER Media'

Path configured in default Project settings -> Media -> Path to save media files (...), ONLY IF ABSOLUTE

Path configured at Preferences -> General -> Paths -> Default recording path, ... (defrecpath= key in reaper.ini, can't be looked up with get_config_var_string('defrecpath'))


For saved projects:

Path configured in Project settings -> Media -> Path to save media files (...), relative to project directory or absolute

Project directory root if no path is configured in the Project Settings


=============================================================

-- Look up current theme after its properties have been changed in 'Theme development / tweaker' dialogue


When a theme is selected from the list at Options -> Themes a checkmark is placed next to its file name.

Once the theme properties have been edited in the 'Theme development / tweaker' dialogue the checkmark 
is cleared and when the theme tweaker is closed nothing indicates which theme is currently open.

To look up the current theme name open the Screenset/Layouts window, go to the Layouts tab. 
The current theme is listed in the Theme row

https://forum.cockos.com/showthread.php?t=289528#3


=============================================================

-- Move parent track automation along with child track automation


1. Enable Options -> Envelope points -> Move envelope points with media items and razor edits

2. Insert an empty or a dummy MIDI item on the parent track encompassing the envelope points which need moving

3. Select this empty or dummy file and items which need moving on the child tracks

4. Drag with the mouse


Alternatively create Razor edit areas over everything which needs moving, then drag with the mouse


https://reddit.com/r/Reaper/comments/1lm09ly/is_there_any_way_to_move_parent_track_automation/


=============================================================

-- Associate plugin after reinstallation with its instances inside the project


As a result of swithing OS and plugin re-installation, association between the plugin 
and its instances inside a project saved on another system may be lost due to difference
in REAPER specific plugin ID, stored inside reaper-vstplugins64.ini or reaper-vstplugins.ini
file.

To fix this do one of the following:
A. Replace the plugin entry in the ini file on the new system with the entry which was present in this file on the old system
B. Change the ID in the FX chain code inside the .RPP file, e.g.
	 
where ID is 1515016268 which corresponds to the ID in the ini file listed at 2nd place after =, e.g.
	Surge.dll=00B2BF788836D701,1515016268,Surge (Surge Synth Team)


=============================================================

-- Multi-line captions in the Video processor

When inserted in take FX chain with the preset 'Overlay: Text/Timecode'
the video processor retrieves and displays take name. The preset does support 
multi-line text however it requires embedding the invisible line break character \n 
within the take name which is only possible with ReaScript API.

The workaround is using mutli-take items.

1. Create a multi-take MIDI item
2. As take name write text which you wish to be displayed on different line in the video
3. Insert video processor instance in the FX chain of each take
4. In the item properties enable the option 'Play all takes' -------- THIS IS CRUCIAL PART
5. Apply 'Overlay: Text/Timecode'preset to the Video processor instance in each take
6. Adjust the preset 'Y position' parameter so that take names appear at different height
thus creating a multi-line caption.

DO NOT USE FOR THIS PURPOSE DEDICATED VIDEO PROCESSOR ITEM CREATED WITH THE ACTION 'Insert dedicated video processor item'
BECAUSE IT SEEMS TO IGNORE ALL TAKES BAR THE VERY FIRST

=============================================================

-- Track/take name length limit

Track name 447 bytes, take name 512 bytes


=============================================================

-- REAPER Debug console

called with the action [developer] Debug console

To get list of supported commands, type help in the input field and click Run

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

=============================================================

-- Protect REAPER from accidental or malicious/intrusive keyboard input


REAPER has 16 'Main (alt)' action list sections all of which are duplicates of the Main section 

allowing to have different shortcuts for the same actions.

These 'alt' sections are enabled with 16 actions

'Main action section: Toggle override to alt-N'

where N is the number of the 'alt' section.

By default in the 'Main' and 'Main (alt)' sections the shortcuts are identical. But they can be overwritten or cleared from any section.

So the solution is to

A. Select one such section from the 'Section' drop-down list of the Action list window to be used to protect REAPER from keyboard input
B. Clear all shortcuts from it with the option 'Remove all shortcuts from this section' found under the 'Key map...' button of the Action list window
C. When you need to protect your session activate this section with the action mentioned above and no keyboard input will disturb 
your session until the Action list section is switched back to one which does have shortcuts.

=============================================================

-- Setting REAPER to support hi res toolbar icons and HiDPI / Retina

Toolbar icons come in two flavours, the main toolbar icons that are part of the theme (save, load, metronome, ripple edit) 
and may have separate on/off state images and so forth. I'm assuming we're not talking about them, but the second type, 
the custom toolbars with custom icons.

When you first create a custom toolbar button it will have text, let's assume you're replacing that with an icon. 
The custom icons buttons are made up of a composite of a background image, an icon, and an overlay, 
plus some additional highlight and armed animations. The background image may be very simple 
and the overlay completely blank (like in the Default 7.0 theme) or they may be very elaborate to create a button 
with an icon and a glass top, like in Imperial, because those images are part of the theme.

The icon images themselves are in (Reaper path) > data > toolbar_icons, which means you can swap themes at a whim 
but your carefully setup toolbars will continue to have its icon images.

Download these test images and unzip them into that folder. Note that each of the three images goes 
into a different folder: the root, 150 and 200. 
Then go View > Toolbar docker, and right click on that floating docker and open a blank toolbar, which will have 
a single 'Edit me" button. Rick click 
that toolbar and click 'customise toolbar'. Click the Edit button at the bottom, choose 'Set icon', and choose 
that toolbar_hidpi_testing image.

If you have an old theme that isn't set up for HiDPI (retina) display, no matter what you do, you will only see 
the red 100% image, even on your 200% HiDPI retina 4k wizbang screen that was supposed to make everything look better. 
Set Reaper to support HiDPI / Retina, and make sure this bit is in the rtconfig file of your theme:


misc_dpi_translate 50 100
misc_dpi_translate 134 150
misc_dpi_translate 174 200


Then, if you drag your new toolbar onto a 150% screen, it will show the green 150% image, and if its a 200% screen, 
it will show the blue 200% image instead - same apparent image, same apparent size, but double the resolution.


https://forum.cockos.com/showpost.php?p=2910480&postcount=7


=============================================================

-- Trooubleshooting REAPER not starting up (Segmentation Fault / Crash on Startup)

IMPORTANT: Back up your files first!

Step 1: Backup Your Configuration

Navigate to: C:\Users\[YourUsername]\AppData\Roaming\REAPER
Make a copy of REAPER.ini and name it REAPER.ini.backup
Also backup reaper-vstplugins64.ini if it exists

Step 2: Fix Window Position

Open REAPER.ini in a text editor (Notepad works fine)
Search for wnd_x= (usually near the top of the file)
If wnd_x has a negative value (like wnd_x=-8), change it to:

wnd_x=100
wnd_y=100

Don't save yet - continue to Step 3

Step 3: Reset Audio Driver to Safe Mode

In the same REAPER.ini file, search for [REAPER] section
Look for the line that says mode= (might be mode=3 for ASIO)
Change it to:

mode=0

(This sets it to dummy audio, which is safe and won't crash)

Save and close the file

Step 4: Clear VST Plugin Cache

In the same C:\Users\[YourUsername]\AppData\Roaming\REAPER folder
Find these files (if they exist):

- reaper-vstplugins64.ini
- reaper-vstshells64.ini

Rename them by adding .old to the 

- reaper-vstplugins64.ini.old
- reaper-vstshells64.ini.old

(REAPER will rebuild these files with a fresh plugin scan on next startup)

Step 5: Start REAPER

Launch REAPER normally
It should now start successfully!
REAPER will automatically rescan your plugins on first launch

Step 6: Reconfigure Audio (Important!)

Once REAPER is running:

Go to Options → Preferences → Audio → Device
Set your audio driver back to what you normally use (ASIO, WASAPI, etc.)
Configure your audio interface settings
Click OK and restart REAPER to confirm it still works

Why This Works (if it does):

- Window position fix: Prevents REAPER from trying to draw itself off-screen

- Audio mode reset: Bypasses potentially crashed ASIO drivers

- Plugin cache clear: Removes corrupted VST data that can cause segfaults during initialization

https://reddit.com/r/Reaper/comments/1q0a28g/how_to_fix_reaper_not_starting_segmentation_fault/


=============================================================

-- Action list filter syntax

https://www.youtube.com/watch?v=n-4jyHS7eVM


=============================================================

-- 'Save project As...' dialogue flags


saveFlags2 (reaper.ini config value)

Create subdirectory for project: &1 (checkbox in the dialogue is reset after a single usage of the setting, the config parameter value however isn't reset)

Copy all media to project path: &2

Copy all media to project path -> Convert media: &16 ('Convert media' checkbox in the dialogue is reset after a single usage of the setting, the config parameter value however isn't reset)

Move all media into project directory: &4

Move all media into project directory -> Copy rather than move source media if not in old project path: &36

HOWEVER THE FLAGS CANNOT BE GET AND/OR SET WIITH SNM_GetIntConfigVar/reaper.get_config_var_string AND SNM_SetIntConfigVar FUNCTIONS

=============================================================

-- MIDI notes won't snap to grid even if Snap is enabled


This may happen if MIDI item left edge was trimmed or extended after which the new left edge was aligned to grid.

To fix that open MIDI item properties (F2) and key in 0 into the 'Start in source:' field even if current value

there is all zeros. Click Apply or OK. The existing notes within the item will shift as a result, but they

can be aligned to the grid afterwards.


=============================================================

-- Prevent items on hidden tracks from being affected by Ripple edit (all tracks)

-- and actions:

-- Time selection: Insert empty space at time selection (moving later items)

-- Time selection: Remove contents of time selection (moving later items)


Before making Ripple edit or running the actions enable at
 
Preferences -> Editing Behavior -> Media Item Locking

the preferences Locked item ripple editing behavior -> 'Locked items are unaffected by ripple'

and 'Region editing and inserting/removing time affects locked items'

respectively

then temporarily lock all items on the hidden tracks and restore their state once done with the following scripts:


-- Script to lock items on hidden tracks and store their state
	
	for i=0, reaper.CountTracks(0)-1 do
	local track = reaper.GetTrack(0,i)
		if reaper.GetMediaTrackInfo_Value(track, 'B_SHOWINTCP') == 0 then
		local ret, tr_GUID = reaper.GetSetMediaTrackInfo_String(track, 'GUID', '', false) -- isSet false
		local item_GUIDs = ''
			for i=0, reaper.CountTrackMediaItems(track)-1 do
			local item = reaper.GetTrackMediaItem(track, i)
			local locked = reaper.GetMediaItemInfo_Value(item, 'C_LOCK')&1 == 1
				if not locked then
				reaper.SetMediaItemInfo_Value(item, 'C_LOCK', 1)
				reaper.UpdateItemInProject(item)
				local ret, GUID = reaper.GetSetMediaItemInfo_String(item, 'GUID', '', false) -- isSet false
				item_GUIDs = item_GUIDs..(#item_GUIDs > 0 and ',' or '')..GUID
				end
			end
			if #item_GUIDs > 0 then
			reaper.SetExtState('TEMPORARILY LOCKED ITEMS', tr_GUID, item_GUIDs, false) -- persist false
			end
		end
	end
	
	
-- Script to restore items state on hidden tracks which was changed with the above script

	for i=0, reaper.CountTracks(0)-1 do
	local track = reaper.GetTrack(0,i)
		if reaper.GetMediaTrackInfo_Value(track, 'B_SHOWINTCP') == 0 then
		local ret, tr_GUID = reaper.GetSetMediaTrackInfo_String(track, 'GUID', '', false) -- isSet false
		local stored = reaper.GetExtState('TEMPORARILY LOCKED ITEMS', tr_GUID)
			if #stored > 0 then
			reaper.DeleteExtState('TEMPORARILY LOCKED ITEMS', tr_GUID, true) -- persist true
			local items_t = {}
				for GUID in stored:gmatch('[^,]+') do
					if GUID then
					items_t[GUID] = ''
					end
				end
				if next(items_t) then
					for i=0, reaper.CountTrackMediaItems(track)-1 do
					local item = reaper.GetTrackMediaItem(track, i)
					local ret, GUID = reaper.GetSetMediaItemInfo_String(item, 'GUID', '', false) -- isSet false
						if items_t[GUID] then -- unlock
						reaper.SetMediaItemInfo_Value(item, 'C_LOCK', 0)
						end
					end
				end
			end
		end
	end


=============================================================

-- AI (automation item) automation with take envelopes

Take envelopes cannot read automation items data, so the workaround is to transfer AI automation
to take envelope by copying and pasting.

Saving

1. Activate envelope on an empty track
2. Create an AI whose length equals item's length
3. Select all take envelope points and copy them
4. Place the edit cursor exactly at the start of the AI
5. Select the AI
6. Paste
7. Save as a preset

Point 4 and 5 is crucial


Loading

1. Activate envelope on an empty track
2. Add AI preset to the activated envelope
3. Right click AI and in the context menu click Delete automation item, preserve points
4. Select all points and copy them
5. Place the edit cursor at the start of item whose take envelope you want to transfer the AI automation to
6. Select the target take envelope
7. Paste

Points 5 and 6 are crucial

demo https://stash.reaper.fm/52064/Use%20AI%20automation%20with%20take%20envelopes.gif

=============================================================

-- A script to close all FX chain windows

-- Caveat - empty input/Monitoring FX chain window cannot be closed with it

	
	-- Close take FX chain windows

	for i=0, reaper.CountMediaItems(0)-1 do
	local item = reaper.GetMediaItem(0, i)
		for i=0, reaper.CountTakes(item)-1 do	
		reaper.TakeFX_Show(reaper.GetTake(item, i), 0, 0)
		end
	end
		
	-- Close track FX chain windows indcluding the Master track main FX chain,
	-- input FX chains and Monitoring FX chain of the Master track

	for i=-1, reaper.GetNumTracks()-1 do
	local track = reaper.GetTrack(0, i) or reaper.GetMasterTrack(0)
	reaper.TrackFX_Show(track, 0, 0) -- close main FX chain
	reaper.TrackFX_Show(track, 0x1000000, 0) -- close input/Monitoring FX chain
	end

		
	do return reaper.defer(function() do return end end) end


=============================================================

-- Snap region start/end to items

Regions don't snap to item edges but they do to time selection.

Shift + double click an item to set time selection to the single item, then drag the region start/end to snap


https://reddit.com/r/Reaper/comments/1sq948m/region_snap/

=============================================================

-- REAPER window title format

 [modified] [proj  / ] - REAPER  - Registered to  [Licensed for personal/small business use] OR [Commercial license] OR EVALUATION LICENSE

[modified] is only appended to name of a modified project. Project tab index and count info may be absent if a single project tab is open. 
The owner's name may be disabled in which case only the type of license info remains in which the square brackets may be absent.

=============================================================

-- Script to condition custom actions by take's under mouse being audio

If take under mouse is audio it sets its own toggle state to 1. If its toggle state is 1 the custom action runs, otherwise does not, e.g.

----------------------------

Custom: MY CUSTOM ACTION

Take is audio.lua -- set the toggle state

Action: Skip next action, set CC parameter to relative +1 if action toggle state enabled, -1 if disabled, 0 if toggle state unavailable.

Take is audio.lua -- check the toggle state

Action: Skip next action if CC parameter <=0/mid



----------------------------


Code for the 'Take is audio.lua' script

----------------------------

	local is_new_value, scr_name, sect_ID, cmdID, mode, resol, val, contextstr = reaper.get_action_context()
	local x, y = reaper.GetMousePosition()
	local item, take = reaper.GetItemFromPoint(x, y, true) -- allow_locked true
	local state = not take and -1 or reaper.TakeIsMIDI(take) and 0 or 1
	reaper.SetToggleCommandState(sect_ID, cmdID, state)
	reaper.defer(function() end)

----------------------------


=============================================================

-- Script to select next/previous item on the same fixed lane
-- the operation depends on the script name, the key words are: next, previous

----------------------------

	local is_new_value, scr_name, sect_ID, cmd_ID, mode, resol, val, contextstr = r.get_action_context()
	local scr_name = scr_name:match('[^\\/]+_(.+)%.%w+') -- without path, scripter name & ext

	local next = scr_name:match('next')
	
	local item = reaper.GetSelectedMediaItem(0,0)

		if not item then return reaper.defer(function() end) end

	local item_idx = reaper.GetMediaItemInfo_Value(item, 'IP_ITEMNUMBER')
	local item_lane_idx = reaper.GetMediaItemInfo_Value(item, 'I_FIXEDLANE')

	local tr = reaper.GetMediaItemTrack(item)

	local target_item

	local tr_items_cnt = reaper.CountTrackMediaItems(tr)-1

	local st, fin, dir = table.unpack(next and {0, tr_items_cnt, 1} or {tr_items_cnt, 0, -1})
	
	for i=st, fin, dir do
	local item = reaper.GetTrackMediaItem(tr, i)
	local idx = reaper.GetMediaItemInfo_Value(item, 'IP_ITEMNUMBER')
	local lane_idx = reaper.GetMediaItemInfo_Value(item, 'I_FIXEDLANE')
		 if lane_idx == item_lane_idx 
		 and (next and idx > item_idx or not next and idx < item_idx)    
		 then
		 target_item = item
		 break
		 end
	end

	if target_item then
	reaper.SelectAllMediaItems(0, false) -- deselect all
	reaper.SetMediaItemSelected(target_item, true) -- select next/previous
	reaper.UpdateItemInProject(item)  
	return reaper.defer(function() end)
	end

----------------------------

=============================================================

-- Make docked window span the entire width of the docker when there're windows in adjacent dockers


Hover the mouse cursor over the divider between windows in the adjacent dockers
until the cursor changes into a double sided arrow ↔, and double click the divider.
This will toggle which of the windows is expanded to the full size of the docker.


=============================================================

-- Expand/compress distance between items

1. Select all target items
2. Run action `Razor edit: Enclose media items, including space between items`
so that the start of the Razor edit area coincides with the start of the first selected item,
and its end coincides with the end of the last selected item. Otherwise if it precedes the start 
of the 1st selected item, the item postition will change, and if it succeeds the start of the 1st
selected item or precedes the end of the last selected item, the item will be split. The items 
must be inclosed within the Razor edit area completely, which is ensured by the action.
3. Grab the edge of the Razor edit area holding down Alt key (default) and drag.
4. Shift+click the Razor edit area in the space between items to clear the Razor edit area
and have all the enclosed item selected which is a side effect of the action 'Split media items at area edges'
mapped by default to default Shift+left click in Razor edit area context.
5. Run the action 'Item properties: Set item rate to 1.0' to restore items playrate
which will change as a result of the operation

https://www.reddit.com/r/Reaper/comments/1tupudj/how_do_i_stretch_successive_items_across_time/


=============================================================

-- Select every other note in the MIDI Editor using Filter utility
(super convoluted)

In the example we select every other 8th note in a sequence of 8th notes which sarts at the start of a measure

1. Set 'Event type:' to Note
2. Check out 'Note:' checkbox
3. Set 'Low/High' notes according to the target content
4. Check out 'Position in measure:' checkbox
5. Keep the 'Low' drop-down menu opposite of the 'Position in measure:' option empty,
i.e. the starting point of the notes which will be affected, 1/8 is because the 2nd 8th note 
in the sequence is at 1/8 within the measure (1 bar) and it meets the 'every other' criterion.
The 'High' drop down-menu can be left empty.
6. In 'Reapeat every:' drop down menu select 1/4, this is the step at which
the note will be targeted. Since we select every OTHER 8th note, the distance 
between two such notes is 1/4
7. Click 'Set selection' button

If we wanted to do the reverse, i.e. select every 1st note of each note pair,
select all target notes keeping the Filter settings the same, and click 'Remove from selection' button,
OR, without selecting the notes first, in the 'Low' drop-down menu select anything smaller than 1/8, 
i.e. 1/8T and smaller, keeping 'High' drop-down menu empty and 'Reapeat every:' setting the same as above, i.e. 1/4

=============================================================

-- Copy media files used in RS5k instances into the project directory


The workaround is relevant because media files from RS5k instances aren't auto-copied into the project directory
even if the preference at  Media -> Import -> Copy imported media to project directory> is enabled
or the setting at  Media tab -> On import of media to project> is set to respect global preference
or to copy media to project path

SO EITHER

save project using Save As... option overwriting the original project file and having the option
'Copy all media into project directory' enabled in the 'Save As' dialogue
(this method also applies to copying IR files loaded into ReaVerb plugin)

OR

add files to RS5k instances from the Media Explorer using the actions
Ibsert into sample player -> Insert sample player on a new track / Reuse active sample player
in which case the ARE auto-copied


https://youtu.be/r5seIzlWzuQ?t=394


=============================================================

-- Empty slots in TCP FX list

Since build 7.75 empty slots are allowed between FX inserts both in MCP and TCP.

In TCP the feature is only supported in themes based on v7 default theme or programmed using v7 WALTER syntax.

If it's not enabled by default, in the themes' rtconfig,txt file set tcp.fxparm.visflags variable to  [-1 0 0]

https://forum.cockos.com/showthread.php?p=2948664


=============================================================

-- Convert MegaBaby sequencer pattern into MIDI item


Create an empty item as long as the entire pattern chain inside the plugin and execute action

or option from the item right click context menu 'Apply track/take FX as new take (MIDI output)'.

The advantage of converting into an empty item is that no new take is created on top of the existing one,
the original item is converted into a MIDI one.

Make sure that in all plugins downstream of the MegaBaby under `2 in 2 out` button -> I/O -> MIDI Output
MIDI Output option isn't disabled, otherwise REAPER won't be able to read back MIDI data from the MegaBaby.
Alternatively they may simply be bypassed before action execution.


=============================================================

-- Load plugin always to the same slot in the T/MCP (slots feature is supported since 7.75)


1. Load the plugin into an empty FX chain. 
2. Move it to the desired slot. 
3. Save this plugin as an FX chain preset. 
4. Turn the FX chain preset into action via the FX browser by creating a shortcut, just like you'd do with a plugin. 
5. Now to apply the FX chain use the action, which has been added to the Action list containing the name of the FX chain preset. 
If another plugin is already present in the target slot, after the FX chain import REAPER will place the included 
plugin in the next available slot, depending on the number of occupied slots past the original slot of the plugin.

=============================================================

-- Record takes so that all takes play simultaneously

1. Create an empty MIDI item as long as your take(s) is(are) going to be
2. In the empty MIDI item properties enable Play all takes
3. Set the loop to this empty MIDI item to be able to record in loops.
4. Set the recording mode to 'Auto-punch selected items'
5. Select the empty MIDI idem
6. Start recording

=============================================================

-- Attach lyric or any text to a MIDI note event (make the lyric/text display within the note event AND have an associated Notation marker)


1. In the MIDI Editor enable the option View -> Piano roll notes -> Show notation text on notes

2. Right click a note in the Piano roll

3. From the context menu select Notation -> Text/Custom -> Enter text

4. Write your lyric there for that particular piano note and click OK

The lyric will display within the note event.

5. Select 'Notation Events' from the pop-up MIDI message types menu at the bottom left hand side of the Piano Roll 

6. Under the note you will see the Notation marker with the lyric which will follow the note when it's moved.

The advantage of Notation events over Text events is that the latter don't follow the note when it's moved.


https://reddit.com/r/Reaper/comments/fyguqt/write_text_into_piano_notes_in_midi_items/
https://www.youtube.com/watch?v=hmckBiE5Qws


=============================================================

-- Highlighting item by means other than color or take markers

Create an image file with a colored strip at the top or bottom or edge, or with some abstract geometric pattern, or both.

Apply it to the item via item right click menu -> Item settings -> Item notes... and select 'Stretch image/text' in the drop-down menu

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

=============================================================

-- Video processor: prevent video processor instances on higher numbered tracks affecting video items on lower numbered tracks

Basically override video processing hierarchy.


On a track whose video processor instances scope you wish to limit to the current track
insert a built-in preset titled 'Basic helpers: Apply track FX only where track has video items'
placing it last in the chain.


https://youtu.be/mrqPG9z1OGc?t=595

=============================================================

-- Trim items to the same length after file import

For the purpose of trimming use an empty project, then transfer the trimmed items into the main one.

1. Based on the target length calculate the tempo the project will have to be set to,
using the formula 60 / target length, i.e. if items have to be trimmed down to 1.5 sec, 
the tempo the project will have to be set to will be 40.
It's implied that the target length equals 1 beat to be able to use an action in step 4.
2. Set the project to the calculated BPM
3. Import files to separate tracks or track lanes
4. Run the following custom action

Grid: Set to 1/4
Transport: Go to start of project
View: Move cursor right by grid division
Item: Select all items
Item: Trim right edge of item to edit cursor

Alternatively import items to the same track

Perform steps 1 and 2 from the above sequence
3. Move the items rightwards away from the project start ever so slightly, by some milliseconds.
This is needed for the action 'View: Move edit cursor by grid division' to work properly due to a bug
https://forum.cockos.com/showthread.php?t=311625
4. Select the items track
5. Place the edit cursor before the first item
6. Repeatedly run the following custom action 

Action: Skip next action, set CC parameter to relative +1 if action toggle state enabled, -1 if disabled, 0 if toggle state unavailable.
Options: Toggle snapping
Action: Skip next action if CC parameter <0/mid
Options: Toggle snapping
Grid: Set to 1/4
Item: Unselect (clear selection of) all items
Item navigation: Select and move to next item
View: Move cursor right by grid division
Item edit: Trim right edge of item to edit cursor
Action: Skip next action if CC parameter <0/mid
Options: Toggle snapping

ACT 1 0 "631eef196e054c46887b84219e607915" "Custom: Trim items down to 1 beat length" 2022 1157 2013 1157 40779 40289 40417 43615 41311 2013 1157

Then if needed close the gaps between item with 'Xenakios/SWS: Reposition selected items...'
with the following settings: Add time interval to - Item end; Time interval - 0 sec
Alternatively use a script from https://forum.cockos.com/showpost.php?p=2965718

=============================================================