top of page
- Script Code -

dofile(reaper.AZ_GetLuaInitPath())


allCount,_ = reaper.AZ_GetTrackMediaTypeCount(0,1,"")


mediaList ={}

mediaInterval = 1

setMeidaRate = 0.7


for i = 1,allCount do

  mediaList[i] = {}

  mediaList[i]["media"]= reaper.AZ_GetMediaTrackItemSelect(0,1,i-1,0)

  mediaList[i]["startPos"]= reaper.AZ_GetTrackMediaStartTimeSeconds(0,1,i-1)   

  reaper.AZ_SetTrackMediaRate(0,1,i-1,setMeidaRate)

  mediaList[i]["length"]= reaper.AZ_GetTrackMediaLength(0,1,i-1)

end


for index, value in pairs(mediaList) do

    if index == 1 then

      startNextPos = mediaList[index].startPos+mediaList[index].length+mediaInterval

    else

       reaper.AZ_SetMediaItemStartTimeSeconds(mediaList[index].media,startNextPos)

       startNextPos = startNextPos+mediaList[index].length+mediaInterval

    end

end

- Warm Up -

  1. Multiple media in a project

- Script Detail -

dofile(reaper.AZ_GetLuaInitPath())


allCount,_ = reaper.AZ_GetTrackMediaTypeCount(0,1,"")

  • Get the total number of media items in the specified track (allCount)

mediaList ={}

  • Defining an array (medialist)

mediaInterval = 1

  • Prepare the media spacing values as variables

setMeidaRate = 0.7

  • Set the media playback speed as a variable


for i = 1,allCount do

  • Loop from 1 up to the value of the variable (allCount)

  mediaList[i] = {}

  • Define an array {} within the array (mediaList[i])

  mediaList[i]["media"]= reaper.AZ_GetMediaTrackItemSelect(0,1,i-1,0)

  • Retrieve MeidaItem and store it in the [“media”] field of mediaList[i]

  mediaList[i]["startPos"]= reaper.AZ_GetTrackMediaStartTimeSeconds(0,1,i-1) 

  • Get the media's start position and store it in mediaList[i]'s [“start”] field

  reaper.AZ_SetTrackMediaRate(0,1,i-1,setMeidaRate)

  • Set the media playback speed using the variable (setMediaRate)

  mediaList[i]["length"]= reaper.AZ_GetTrackMediaLength(0,1,i-1)

  • Get the length of the media and store it in mediaList[i]'s [“length”] property

end


for index, value in pairs(mediaList) do

  • Iterate through the array (mediaList) as many times as there are elements

    if index == 1 then

  • If the variable (index) is 1, continue below

      startNextPos = mediaList[index].startPos+mediaList[index].length+mediaInterval

  • Set the starting position of the mediaList[index] array plus the length of the media in mediaList[index] plus the media interval value (1 second) to the variable (startNextPos)

    else

  • if Statement: Check the Value of the Variable (index)
  • If it's not the first one, continue below

       reaper.AZ_SetMediaItemStartTimeSeconds(mediaList[index].media,startNextPos)

  • Set the media in the array `mediaList[index]` to the variable `startNextPos`

       startNextPos = startNextPos+mediaList[index].length+mediaInterval

  • Set the variable (startNextPos) to the sum of the variable (startNextPos) and the length of the media in array mediaList[index], plus the media interval value (1 second)

    end

  • Iterate through the array (mediaList)

end

  • All media on the specified track are played at 0.7x speed and arranged at one-second intervals.
- API LINK -
- API LINK -

Media

AZSTOKE_TrackAllMediaSetRateMoveToSec

All media in the specified track will be re-arranged at 0.7x speed every second

01_BRONZE_ss_edited.png
01_SILVER_edited_edited.png
03_GOLD_edited_edited.png
bottom of page