- API -
dofile(reaper.AZ_GetLuaInitPath())
require("reaper_AZSTOKE_SILVER")
require("reaper_AZSTOKE_GOLD")
cancelType,inputList = reaper.AZ_GetUserInputList("LOUDMATCHIFY",2,"ListPath:,WavPath:","D:/,D:/")
jsonStr = reaper.AZ_ReadFile(inputList[1],"savedata.txt")
loudnessTable = reaper.AZ_Json_Deserialize(jsonStr)
if cancelType then
fileList = reaper.AZ_GetFilePathList(inputList[2],"wav")
startPos = 0
mediaInterval = 1
for i, value in pairs(fileList) do
item = reaper.AZ_InsertMediaTrackIdSecond(0,0,value,0,startPos)
name = reaper.AZ_GetMediaItemName(item)
reaper.AZ_SetMediaItemHANDAUTOMER(item,1)
reaper.AZ_LOUDMATCHFY_SetVolumeForMediaItem(item ,loudnessTable, 1,0)
maxMomentary = reaper.AZ_GetMediaItemLoudnessMaxMomentary(item)
endPos = reaper.AZ_GetMediaItemEndTime(item)
startPos = endPos + mediaInterval
Msg(name)
Msg(maxMomentary)
end
end
- API Detail-
Create a track
Generate save data that can be used with LOUDMATCHIFY
Prepare the file you want to adjust the volume of
- SCRIPT -
dofile(reaper.AZ_GetLuaInitPath())
require("reaper_AZSTOKE_SILVER")
require("reaper_AZSTOKE_GOLD")
・Make SILVER and GOLD available
cancelType,inputList = reaper.AZ_GetUserInputList("LOUDMATCHIFY",2,"ListPath:,WavPath:","D:/,D:/")
- Allows text input.
jsonStr = reaper.AZ_ReadFile(inputList[1],"savedata.txt")
- Search for savedata.txt in the folder containing the saved data and obtain the string.
loudnessTable = reaper.AZ_Json_Deserialize(jsonStr)
・Replace the obtained string with an array
if cancelType then
・When you press OK on the text input screen, execute the following
fileList = reaper.AZ_GetFilePathList(inputList[2],"wav")
・Get a list of files you want to adjust
startPos = 0
mediaInterval = 1
for i, value in pairs(fileList) do
・For loop for the obtained list
item = reaper.AZ_InsertMediaTrackIdSecond(0,0,value,0,startPos)
- Insert the file into track 1 and get the item
name = reaper.AZ_GetMediaItemName(item)
-Get the name of the item and assign it to name
reaper.AZ_SetMediaItemHANDAUTOMER(item,1)
・Apply the HANDAUTOMER compression rate of 1 to the item
reaper.AZ_LOUDMATCHFY_SetVolumeForMediaItem(item ,loudnessTable, 1,0)
・Execute LOUDMATCHIFY on the item, read the array of save data, and adjust the volume
maxMomentary = reaper.AZ_GetMediaItemLoudnessMaxMomentary(item)
・Output the current maxMomentary of the item
endPos = reaper.AZ_GetMediaItemEndTime(item)
・Get the end position
startPos = endPos + mediaInterval
- Set next audio position
Msg(name)
Msg(maxMomentary)
- Output name and loudness value to console
end
end
- SCRIPT -
reaper.AZ_GetUserInputList
reaper.AZ_ReadFile
reaper.AZ_Json_Deserialize
reaper.AZ_GetFilePathList
reaper.AZ_InsertMediaTrackIdSecond
reaper.AZ_GetMediaItemName
reaper.AZ_SetMediaItemHANDAUTOMER
reaper.AZ_LOUDMATCHFY_SetVolumeForMediaItem
reaper.AZ_GetMediaItemLoudnessMaxMomentary
reaper.AZ_GetMediaItemEndTime