Editing and previewing parameters

In the Creating a project and registering Waveform file to a Cue tutorial, we showed how to create data such as projects and Cues using CRI Atom Craft Robot.
In this tutorial, we will write a Script to change the Volume of the created Cue to preview.

This tutorial uses the project created in the Creating a project and registering Waveform file to a Cue tutorial.
If you do not have this project, go back to Creating a project and registering Waveform file to a Cue 」 tutorial.

Preparing a Script file

Select "Script list..." in the Script menu to display the Script list window.
Click the New button in the Script list window to create a Script file with the name below:

Save location of Script Script file name
tutorials [CRI] tutorial03-1_edit_and_preview.py


Script Description

Double-click the created Script to open by Run the Script from the Script Editor .
In order to get an overview of the Script in the Script list window, write the Script description as follows:

# --Description:[Tutorial]Editing and previewing parameters


Importing Module

Once you have written the Script description, import the following modules to work with CRI Atom Craft in your Script.

import cri.atomcraft.project as acproject
import cri.atomcraft.preview as acpreview

In addition to the Project Module to work with the project data of CRI Atom Craft, import the Preview Module to preview.

Getting a Cue to edit

criatom_tools_atomcraft_api_tutorial_edit_and_preview_get_cue.png

To edit the parameters for Cue, you need to get the object for the target Cue.
There are two primary ways to get an object:

  • Get by search
  • Get to trace the hierarchy

This section will act as a review for the hierarchical structure. We will show how to use the following function to get the Cue to trace the Work Unit object by each level.
This method is useful if you understand the hierarchical structure of how to trace a Cue.
For the method to get by search, refer to the Object acquisition and list operation tutorial.
Use the following function to get the order of Work Unit, Cue Sheet folder, Cue Sheet and Cue.

Function name Description
get_workunit Gets a Work Unit
get_cuesheet_rootfolder Gets the Cue Sheet root folder of Work Unit
get_child_object Gets the child object by specifying the parent object


Write a script to get the Cue using these functions will be as follows:

# Get a Work Unit
workunit = acproject.get_workunit("WorkUnit_Tutorial")["data"]
# Cue Sheet root folder
cuesheet_rootfolder = acproject.get_cuesheet_rootfolder(workunit)["data"]
# Get a Cue Sheet folder "WorkUnit_Tutorial"
cuesheet_folder = acproject.get_child_object(cuesheet_rootfolder, "CueSheetFolder", "WorkUnit_Tutorial")["data"]
# Get a Cue Sheet
cuesheet = acproject.get_child_object(cuesheet_folder, "CueSheet", "Tutorial")["data"]
# Get a Cue
cue = acproject.get_child_object(cuesheet, "Cue", "gun1_High")["data"]

Description of getting Cue

To get an object by following a hierarchical structure, you first need to get a starting object called the root object.
The root object of the object structure that contains the Cue object is a Work Unit object.
You can get a Work Unit object by specifying the "Work Unit name" in the get_workunit function.
This section gets a Work Unit by specifying "WorkUnit_Tutorial" in the Work Unit name.

Next, get the Cue Sheet root folder from Work Unit using the get_cuesheet_rootfolder function.
From the Cue Sheet root folder, the get_child_object function is used to get objects by tracing the Cue Sheet folder, Cue Sheet, Cue and hierarchy.

Change the Cue parameter

criatom_tools_atomcraft_api_tutorial_edit_and_preview_change_parameter.png

You can change the parameter after getting a Cue.
Use the following function to change the Cue's volume parameter.

Function name Description
set_value Sets the parameter of the specified object


To "Change the Cue Volume to 0.5", use the following function:

# Change Cue Volume
acproject.set_value(cue, "Volume", 0.5)

Description of changing parameter of Cue

The function set_value is a general-purpose function used to change parameters.
Specify "Target object information", "Parameter field name" and "Parameter value" to use the set_value function.

For details about the parameter field names that correspond to each parameter fields for each object, refer to Parameter reference .

Before running the Script, make sure that the volume of the Cue "gun1_High" is 1.0.
After the confirmation is done, press the Run button to execute the script.
You can check that the volume of the Cue "gun1_High" has changed to 0.5.

criatom_tools_atomcraft_api_tutorial_edit_and_preview_edited.png

Cue preview

Finally, use the following function in Preview Module to perform Cue preview.

Function name Description
start_playback_cue Starts preview playback of the specified Cue


The start_playback_cue function is a simple preview function that performs preview playback by specifying the Cue.
The Script to preview the Cue "gun1_High" whose volume was changed is as follows:

# Cue playback
acpreview.start_playback_cue(cue)

Saving and running the Script

This concludes the scripting portion of this tutorial.
Save and run the Script.
If the Script runs successfully, it will change the Volume of "gun1_High" Cue to 0.5 and perform preview playback.