XaiJu
Noisebud
Noisebud

patreon


What's cooking - Week 10, 2023

This post is not about a plugin but a Reaper Script. I wrote this script to change the project sample rate to the same rate as the selected media item in Reaper. I often forget to check the sample rate of incoming mix files for mastering and it is so annoying when I realize halfway through that I have been working at the wrong rate, this script bypasses my lazy brain and sets the sample rate for me.


Here's the code for the ReaScript:


-- Get the currently selected media item

local item = reaper.GetSelectedMediaItem(0, 0)

-- Check if a media item is selected
if item ~= nil then
   take = reaper.GetActiveTake(item);
   source = reaper.GetMediaItemTake_Source(take);

  -- Get the sample rate of the selected media item

     srate = reaper.GetMediaSourceSampleRate(source)

  -- Set the project sample rate to the same as the selected media item
reaper.SNM_SetIntConfigVar('projsrate', srate)
reaper.Audio_Quit()
reaper.Audio_Init()
else
  -- If no media item is selected, display an error message
  reaper.ShowMessageBox("Please select a media item.", "Error", 0)
end




More Creators