top of page
- Script Code -

dofile(reaper.AZ_GetLuaInitPath()) 

require("reaper_AZSTOKE_BRONZE") 

require("reaper_AZSTOKE_SILVER") 

require("reaper_AZSTOKE_GOLD") 


function Main()


    retval, inputList = reaper.AZ_GetUserInputList("Character Info", 1, "Character Name", "")

    if retval == false then 

        return 

    end

    

    characterName = inputList[1]


    reaper.AZ_DeleteAllRegion(0)

    

    itemList = reaper.AZ_GetSelectedMediaItemList(0)

    color = reaper.AZ_GetRandomColor() 

    

    --Region setting

    for i, item in pairs(itemList) do

        startPos = reaper.AZ_GetMediaItemStartTimeSeconds(item)

        endPos = reaper.AZ_GetMediaItemEndTime(item)

        name = reaper.AZ_GetMediaItemName(item)

        reaper.AZ_AddRegionMarker(0, startPos, endPos, name, 0, color)

    end

    

    --render setting

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

    render = {

        OutputDir = path,

        Channels = 1,

        FileName = "$region",

        RenderingRangeType = 5,

    }

       

    --render

    fileList = reaper.AZ_RenderToAudioFile(0, render)

    

    -- Wwise

    if reaper.AZ_Wwise_Connect("127.0.0.1",  8080) == false then return end

    

    -- Acter-Mixer Hierarchy

    rootPath = "\\Actor-Mixer Hierarchy\\Default Work Unit"

    characterPath = rootPath .. "\\Characters"

    

    workunit = reaper.AZ_Wwise_CreateWorkUnit(characterPath,  characterName, true)

    

    templetePath = rootPath .. "\\Templates\\AZ_vo_tmp"

    mixer = reaper.AZ_Wwise_CopyObject(templetePath, workunit["Path"], characterName, true)

    

    -- Events

    rootPath = "\\Events\\Default Work Unit"

    characterPath = rootPath .. "\\Characters"

    

    workunit = reaper.AZ_Wwise_CreateWorkUnit(characterPath,  characterName, true)

    

    templetePath = rootPath .. "\\Templates\\AZ_vo_tmp"

    eventFolder = reaper.AZ_Wwise_CopyObject(templetePath, workunit["Path"], characterName, true)  

    

    for i, filePath in pairs(fileList) do

        fileName = reaper.AZ_GetPathInfo(filePath)["FileNameWithoutExtension"]

        

        voiceType = string.sub(fileName, 1, 3)

        

        type_MixerPath = ""

        type_EventFolderPath = ""

        

        if voiceType == "ACT" then

            type_MixerPath = mixer["Path"] .. "\\action" 

            type_EventFolderPath = eventFolder["Path"] .. "\\battle" 

        elseif voiceType == "DMG" then

            type_MixerPath = mixer["Path"] .. "\\damage" 

            type_EventFolderPath = eventFolder["Path"] .. "\\battle" 

        else

            type_MixerPath = mixer["Path"] .. "\\event" 

            type_EventFolderPath = eventFolder["Path"] .. "\\senario"         

        end

        

        sound = reaper.AZ_Wwise_CreateSoundSFX(type_MixerPath, filePath, fileName, characterName, true)

        

        reaper.AZ_Wwise_DeleteObject(type_EventFolderPath .. "\\" .. sound["Name"])

        event = reaper.AZ_Wwise_CreateEvent(type_EventFolderPath, sound["Name"], -1)

        

        reaper.AZ_Wwise_AddActionToEvent(event["ID"], 2, sound["ID"])

        reaper.AZ_Wwise_AddActionToEvent(event["ID"], 1, sound["ID"])

    end

    

    reaper.AZ_Wwise_SaveProject()

    

    reaper.AZ_Wwise_Disconnect()

    

    

    reaper.AZ_ShowMessageBox_Info("Success!", "", reaper.AZ_WindowType_OK())

    

    return


end


Main()

- Warm Up -

  1. Arrange the files you want to export within the Reaper project

- Script Detail -

require("reaper_AZSTOKE_BRONZE") 

require("reaper_AZSTOKE_SILVER") 

require("reaper_AZSTOKE_GOLD") 


・Import RIGDOCKS


function Main()


・Define the function that contains the main process


    retval, inputList = reaper.AZ_GetUserInputList("Character Info", 1, "Character Name", "")


・Show an empty input dialog and get the character name


    if retval == false then 

        return 

    end

    

・If the dialog is canceled, end the process


    characterName = inputList[1]

    

・Store the character name in a variable


    reaper.AZ_DeleteAllRegion(0)


・Delete all regions in the project


    itemList = reaper.AZ_GetSelectedMediaItemList(0)


・Get the selected items


    color = reaper.AZ_GetRandomColor() 


・Get a random color

    

    --Region setting

    for i, item in pairs(itemList) do


・Run for each selected item


        startPos = reaper.AZ_GetMediaItemStartTimeSeconds(item)

        endPos = reaper.AZ_GetMediaItemEndTime(item)

        name = reaper.AZ_GetMediaItemName(item)

        reaper.AZ_AddRegionMarker(0, startPos, endPos, name, 0, color)


・Add a region at the item position


    end

    

    --render setting

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


・Set the export destination folder in the project file


    render = {

        OutputDir = path,

        Channels = 1,

        FileName = "$region",

        RenderingRangeType = 5,

    }

     

・Create the render settings


    --render

    fileList = reaper.AZ_RenderToAudioFile(0, render)

    

・Run rendering and get the path info


    -- Wwise

    if reaper.AZ_Wwise_Connect("127.0.0.1",  8080) == false then return end


・Connect to Wwise; on failure, end the process


    -- Acter-Mixer Hierarchy

    rootPath = "\\Actor-Mixer Hierarchy\\Default Work Unit"


・Specify the path of the Actor-Mixer Hierarchy in Wwise


    characterPath = rootPath .. "\\Characters"

    

・Specify the path of the folder for the character


    workunit = reaper.AZ_Wwise_CreateWorkUnit(characterPath,  characterName, true)

    

・Generate a work unit named after the character


    templetePath = rootPath .. "\\Templates\\AZ_vo_tmp"


・Specify the template path


    mixer = reaper.AZ_Wwise_CopyObject(templetePath, workunit["Path"], characterName, true)


・Copy the template and generate an Actor-Mixer Hierarchy named after the character

    

    -- Events

    rootPath = "\\Events\\Default Work Unit"


・Specify the path of Events in Wwise


    characterPath = rootPath .. "\\Characters"


・Specify the path of the folder for the character


    workunit = reaper.AZ_Wwise_CreateWorkUnit(characterPath,  characterName, true)

 

・Generate a work unit named after the character


    templetePath = rootPath .. "\\Templates\\AZ_vo_tmp"


・Specify the template path


    eventFolder = reaper.AZ_Wwise_CopyObject(templetePath, workunit["Path"], characterName, true)  


・Copy the template and create a folder named after the character

    

    for i, filePath in pairs(fileList) do


・Run for each file exported from Reaper


        fileName = reaper.AZ_GetPathInfo(filePath)["FileNameWithoutExtension"]

        

・Get the file name


        voiceType = string.sub(fileName, 1, 3)


・Get the first 3 characters of the file name to determine the voice type

        

        type_MixerPath = ""

        type_EventFolderPath = ""

        

        if voiceType == "ACT" then

            type_MixerPath = mixer["Path"] .. "\\action" 

            type_EventFolderPath = eventFolder["Path"] .. "\\battle" 


・For action voices, specify the path for action voices

        elseif voiceType == "DMG" then

            type_MixerPath = mixer["Path"] .. "\\damage" 

            type_EventFolderPath = eventFolder["Path"] .. "\\battle" 


・For damage voices, specify the path for damage voices


        else

            type_MixerPath = mixer["Path"] .. "\\event" 

            type_EventFolderPath = eventFolder["Path"] .. "\\senario"


・For other voices, specify the path for event voices


        end

        

        sound = reaper.AZ_Wwise_CreateSoundSFX(type_MixerPath, filePath, fileName, characterName, true)


・Create a Sound SFX object with the same name as the file at the specified path

        

        reaper.AZ_Wwise_DeleteObject(type_EventFolderPath .. "\\" .. sound["Name"])

        event = reaper.AZ_Wwise_CreateEvent(type_EventFolderPath, sound["Name"], -1)


・If an event with the same name exists, delete it, then generate an event with the same name as the Sound SFX at the specified path

        

        reaper.AZ_Wwise_AddActionToEvent(event["ID"], 2, sound["ID"])

        reaper.AZ_Wwise_AddActionToEvent(event["ID"], 1, sound["ID"])


・Add the Sound SFX's Stop and Play actions to the added event


    end

    

    reaper.AZ_Wwise_SaveProject()


・Save the project

    

    reaper.AZ_Wwise_Disconnect()


・Disconnect from Wwise

    

    reaper.AZ_ShowMessageBox_Info("Success!", "", reaper.AZ_WindowType_OK())


・Show the completion message

    

    return


・End the function


end


Main()


・Run the Main function

- API LINK -
- API LINK -

Wwise

AZSTOKE_Wwise_CreateFromTemplete_1

Create object structures from a template

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