top of page
- Script Code -

dofile(reaper.AZ_GetLuaInitPath())


require("reaper_AZSTOKE_BRONZE")

require("reaper_AZSTOKE_SILVER")

require("reaper_AZSTOKE_GOLD")


reaper.AZ_DeleteAllRegion(0)

cancelType, inputList = reaper.AZ_GetUserInputList("Insert",1,"Path:","D://")


if cancelType then

   --file import HANDAUTOMER

   fileList = reaper.AZ_GetFilePathList(inputList[1],"wav")

   

   startPos = 0

   itemList = {}

   

   for i, value in pairs(fileList) do

       itemList[i] = {}

       itemList[i]["item"] = reaper.AZ_InsertMediaTrackIdSecond(0,0,value,0,startPos)

       reaper.AZ_SetMediaItemHANDAUTOMER(itemList[i].item,3)

       itemList[i]["name"] = reaper.AZ_GetMediaItemName(itemList[i].item)

       

       --get parent

       itemList[i]["parent"] = ""

       splitList = reaper.AZ_GetStringSplitList(itemList[i].name,"_")

       table.remove(splitList)

       for e, value in pairs(splitList) do

           if e == 1 then

              itemList[i]["parent"] = itemList[i].parent..value

           else

              itemList[i]["parent"] = itemList[i].parent.."_"..value

           end

       end

       

       --next start pos setting + regionMarker

       endPos = reaper.AZ_GetMediaItemEndTime(itemList[i].item)

       reaper.AZ_AddRegionMarker(0,startPos,endPos,itemList[i].name,0,0)

       startPos = endPos + 1 

   end

   

   --render setting

   renderPath = "D:\\script\\renderdata"

   renderFileName = "render"

   

   jsonStr = reaper.AZ_ReadFile(renderPath,renderFileName..".txt")

   render = reaper.AZ_Json_Deserialize(jsonStr)

   path = reaper.AZ_SetProjectPathFolder("Rec",3)

   render.OutputDir = path

   

   --render

   fileList = reaper.AZ_RenderToAudioFile(0,render)

   

   --wwise intro

   wwisePath = "\\Actor-Mixer Hierarchy\\Default Work Unit\\Master\\VOICE"

   parent = ""

   

   if (reaper.AZ_Wwise_Connect("127.0.0.1",8080)) then

       

       --wwise object create

       for i, value in pairs(fileList) do

           

           if parent ~= itemList[i].parent then

              parent = itemList[i].parent

              containerList = reaper.AZ_Wwise_CreateContainer(wwisePath,0,itemList[i].parent)

           end

           soundVoiceList = reaper.AZ_Wwise_CreateSoundVoice(containerList.ID,value,itemList[i].name)

           itemList[i]["soundVoiceID"] = soundVoiceList.ID

       end

       

       --LOUDMATCHIFY Savedata

       jsonStr = reaper.AZ_ReadFile("D:\\script\\savedata\\savedata","savedata.txt")

       loudmatchifyList = reaper.AZ_Json_Deserialize(jsonStr)

       

       --loudness 

       for i, value in pairs(itemList) do

           wwiseVol = reaper.AZ_MIDDLESCANNER_Wwise_GetVolumeForMediaItem(itemList[i].item,"English(US)")

           reaper.AZ_LOUDMATCHIFY_SetVolumeForMediaItem(itemList[i].item,loudmatchifyList,1,wwiseVol.Volume)

           Msg(itemList[i].name)

           Msg(wwiseVol.Volume)

           Msg(reaper.AZ_GetMediaItemLoudnessMaxMomentary(itemList[i].item))

       end

       

       path = reaper.AZ_SetProjectPathFolder("Rec",3)

       render.OutputDir = path

       fileList = reaper.AZ_RenderToAudioFile(0,render)

       

       for i, value in pairs(fileList) do

           reaper.AZ_Wwise_ImportAudioFile(itemList[i].soundVoiceID,value,"English(US)")

       end

       

       reaper.AZ_Wwise_Disconnect() 

   end

end

- Warm Up -

  1. Create a track.
  2. Prepare media to insert.
  3. Generate save data that can be used with LOUDMATCHIFY.
  4. Prepare render settings.
  5. Create a WorkUnit to insert in Wwise.
- Script Detail -

dofile(reaper.AZ_GetLuaInitPath())


require("reaper_AZSTOKE_BRONZE")

require("reaper_AZSTOKE_SILVER")

require("reaper_AZSTOKE_GOLD")


・Enable BRONZE, SILVER, and GOLD APIs


reaper.AZ_DeleteAllRegion(0)


・Delete an existing region


cancelType, inputList = reaper.AZ_GetUserInputList("Insert",1,"Path:","D://")


・Specify the path of the folder where the audio files are stored.


if cancelType then

   --file import HANDAUTOMER

   fileList = reaper.AZ_GetFilePathList(inputList[1],"wav")

 

・Get the path of the audio file


   startPos = 0


・Set the start position of the audio file


   itemList = {}

 

   for i, value in pairs(fileList) do

       itemList[i] = {}

       itemList[i]["item"] = reaper.AZ_InsertMediaTrackIdSecond(0,0,value,0,startPos)


・Importing audio files into Reaper


       reaper.AZ_SetMediaItemHANDAUTOMER(itemList[i].item,3)


・Run HANDAUTOMER


       itemList[i]["name"] = reaper.AZ_GetMediaItemName(itemList[i].item)

 

・Get the name (file name) of the media item


       --get parent

       itemList[i]["parent"] = ""

       splitList = reaper.AZ_GetStringSplitList(itemList[i].name,"_")

       table.remove(splitList)

       for e, value in pairs(splitList) do

           if e == 1 then

              itemList[i]["parent"] = itemList[i].parent..value

           else

              itemList[i]["parent"] = itemList[i].parent.."_"..value

           end

       end


・Get the audio file name without the numbering (used as the container name in Wwise)

 

       --next start pos setting + regionMarker

       endPos = reaper.AZ_GetMediaItemEndTime(itemList[i].item)

       reaper.AZ_AddRegionMarker(0,startPos,endPos,itemList[i].name,0,0)


・Set region markers at media item positions


       startPos = endPos + 1


・Store information about media items in a list


   end

 

   --render setting

   renderPath = "D:\\script\\renderdata"

   renderFileName = "render"


・Get Render Setup Data from a File


   jsonStr = reaper.AZ_ReadFile(renderPath,renderFileName..".txt")

   render = reaper.AZ_Json_Deserialize(jsonStr)

   path = reaper.AZ_SetProjectPathFolder("Rec",3)

   render.OutputDir = path


・Change only the output folder


   --render

   fileList = reaper.AZ_RenderToAudioFile(0,render)

 

・Rendering execution


   --wwise intro

   wwisePath = "\\Actor-Mixer Hierarchy\\Default Work Unit\\Master\\VOICE"


・Specify the import destination in Wwise


   parent = ""

 

   if (reaper.AZ_Wwise_Connect("127.0.0.1",8080)) then

 

・Connect to Wwise


       --wwise object create

       for i, value in pairs(fileList) do


・For each media item, do the following:

 

           if parent ~= itemList[i].parent then

              parent = itemList[i].parent

              containerList = reaper.AZ_Wwise_CreateContainer(wwisePath,0,itemList[i].parent)

           end


・If the corresponding random container has not been created yet, create it.

 

           soundVoiceList = reaper.AZ_Wwise_CreateSoundVoice(containerList.ID,value,itemList[i].name)


・Importing a rendered audio file into a container


           itemList[i]["soundVoiceID"] = soundVoiceList.ID

       end

 

       --LOUDMATCHIFY Savedata

       jsonStr = reaper.AZ_ReadFile("D:\\script\\savedata\\savedata","savedata.txt")

       loudmatchifyList = reaper.AZ_Json_Deserialize(jsonStr)


・Get configuration data for LOUDMATCHIFY from a file


       --loudness 

       for i, value in pairs(itemList) do

           wwiseVol = reaper.AZ_MIDDLESCANNER_Wwise_GetVolumeForMediaItem(itemList[i].item,"English(US)")


・Run MIDDLESCANNER to get the volume settings in Wwise


           reaper.AZ_LOUDMATCHIFY_SetVolumeForMediaItem(itemList[i].item,loudmatchifyList,1,wwiseVol.Volume)


・Run LOUDMATCHIFY taking into account the results of MIDDLESCANNER


           Msg(itemList[i].name)

           Msg(wwiseVol.Volume)

           Msg(reaper.AZ_GetMediaItemLoudnessMaxMomentary(itemList[i].item))


・Output the processing result to the console

 

       end

 

       path = reaper.AZ_SetProjectPathFolder("Rec",3)

       render.OutputDir = path

       fileList = reaper.AZ_RenderToAudioFile(0,render)


・Change the output folder in the rendering settings and perform rendering.

 

       for i, value in pairs(fileList) do

           reaper.AZ_Wwise_ImportAudioFile(itemList[i].soundVoiceID,value,"English(US)")

       end

 

・Importing (replacing) rendered files into the corresponding Wwise objects


       reaper.AZ_Wwise_Disconnect() 


・Disconnecting from Wwise


   end

end

- API LINK -

Wwise

AZSTOKE_CEDEC_KYUSHU2024

[CEDEC+KYUSHU2024] Successfully automated the process from voice rough editing to Wwise implementation

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