local PATH = reaper.GetResourcePath().. "/beeps/beep.mp3"

		  local source = reaper.PCM_Source_CreateFromFile(PATH)
source5  = PATH:match(".+[/\\](.+)"),1;
local cou = 0
		local cou2 = 0	
    local function no_undo()reaper.defer(function()end)end;
    -------------------------------------------------------
  reaper.Undo_BeginBlock()
stats5 = reaper.Main_OnCommand(40061,0)
stats = reaper.Main_OnCommand(40639,0)
SC = reaper.CountSelectedMediaItems(0);    





if (SC == 0) then
	reaper.Main_OnCommand(40296, 0) -- Unselect all items
	reaper.Main_OnCommand(40421, 0) -- Unselect all items

SCC =  reaper.CountSelectedMediaItems(0);    

 CountSelItem= SCC
else
 CountSelItem= SC
end

    if CountSelItem == 0 then no_undo() return end;
    
    


    
    for i = CountSelItem-1,0,-1 do;
        
        local SelItem = reaper.GetSelectedMediaItem(0,i);
		take = reaper.GetActiveTake(SelItem )











				reaper.GetSetMediaItemTakeInfo_String(take,"P_NAME","beep",1 )
				reaper.SetMediaItemTake_Source(take,source);

  reaper.Undo_EndBlock("Censor Cut", -1)
    end;

stats = reaper.Main_OnCommand( 40635,0)

reaper.osara_outputMessage("Censor")
