{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://json.schemastore.org/openutau-ustx.json",
  "additionalProperties": true,
  "description": "USTX file format for OpenUTAU",
  "properties": {
    "name": {
      "description": "Name of the project",
      "type": "string"
    },
    "comment": {
      "type": "string"
    },
    "output_dir": {
      "type": "string"
    },
    "cache_dir": {
      "type": "string"
    },
    "ustx_version": {
      "description": "Version of the USTX file format",
      "type": "string",
      "examples": ["0.6"]
    },
    "resolution": {
      "description": "Resolution of the project in ticks per quarter note",
      "type": "integer",
      "examples": [480]
    },
    "bpm": {
      "description": "Tempo of the project in beats per minute, deprecated in favor of tempos",
      "type": "number"
    },
    "beat_per_bar": {
      "description": "Number of beats per bar, deprecated in favor of time_signatures",
      "type": "integer"
    },
    "beat_unit": {
      "description": "Beat unit, deprecated in favor of time_signatures, deprecated in favor of time_signatures",
      "type": "integer"
    },
    "expressions": {
      "description": "List of expression definitions",
      "type": "object",
      "additionalProperties": {
        "type": "object",
        "properties": {
          "name": {
            "description": "Name of the expression",
            "type": "string"
          },
          "abbr": {
            "description": "Abbreviation of the expression",
            "type": "string"
          },
          "type": {
            "description": "Type of the expression",
            "type": "string",
            "enum": ["Curve", "Options", "Numerical"]
          },
          "min": {
            "description": "Minimum value of the expression",
            "type": "number"
          },
          "max": {
            "description": "Maximum value of the expression",
            "type": "number"
          },
          "default_value": {
            "description": "Default value of the expression",
            "type": "number"
          },
          "is_flag": {
            "description": "Whether the expression is a utau resampler flag",
            "type": "boolean"
          },
          "flag": {
            "description": "UTAU resampler flag header, used if the expression is a numerical expression",
            "type": "string"
          },
          "options": {
            "description": "List of options, used if the expression is an options expression",
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": ["name", "abbr", "type"]
      }
    },
    "exp_selectors": {
      "description": "Expressions used by the user when saving the project",
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "exp_primary": {
      "description": "Index of the expression the user was editing when saving the project",
      "type": "integer"
    },
    "exp_secondary": {
      "description": "Index of the expression the user was viewing as background when saving the project",
      "type": "integer"
    },
    "time_signatures": {
      "description": "List of time signatures",
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "bar_position": {
            "description": "Position of the time signature in bars",
            "type": "integer"
          },
          "beat_per_bar": {
            "description": "Number of beats per bar",
            "type": "integer"
          },
          "beat_unit": {
            "description": "Beat unit",
            "type": "integer"
          }
        }
      }
    },
    "tempos": {
      "description": "List of tempos",
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "position": {
            "description": "Position of the tempo in ticks",
            "type": "integer"
          },
          "bpm": {
            "description": "Tempo in beats per minute",
            "type": "number"
          }
        }
      }
    },
    "tracks": {
      "description": "Tracks in the project",
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "singer": {
            "description": "Singer of the track",
            "type": "string"
          },
          "phonemizer": {
            "description": "Phonemizer of the track",
            "type": "string"
          },
          "renderer_settings": {
            "description": "Renderer settings of the track",
            "type": "object",
            "properties": {
              "renderer": {
                "description": "Renderer of the track",
                "type": "string",
                "examples": [
                  "CLASSIC",
                  "WORLDLINE-R",
                  "VOGEN",
                  "ENUNU",
                  "DIFFSINGER"
                ]
              },
              "resampler": {
                "description": "UTAU Resampler of the track, if the renderer is CLASSIC",
                "type": "string"
              },
              "wavtool": {
                "description": "UTAU Wavtool of the track, if the renderer is CLASSIC",
                "type": "string"
              }
            }
          },
          "track_name": {
            "description": "Name of the track",
            "type": "string"
          },
          "track_color": {
            "description": "Color of the track",
            "type": "string",
            "examples": [
              "Pink",
              "Red",
              "Orange",
              "Yellow",
              "Light Green",
              "Green",
              "Light Blue",
              "Blue",
              "Purple",
              "Pink2",
              "Red2",
              "Orange2",
              "Yellow2",
              "Light Green2",
              "Green2",
              "Light Blue2",
              "Blue2",
              "Purple2"
            ]
          },
          "mute": {
            "description": "Whether the track is muted",
            "type": "boolean"
          },
          "solo": {
            "description": "Whether the track is soloed",
            "type": "boolean"
          },
          "volume": {
            "description": "Volume of the track",
            "type": "number"
          },
          "pan": {
            "description": "Pan of the track",
            "type": "number"
          },
          "voice_color_names": {
            "description": "List of voice color names",
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      }
    },
    "voice_parts": {
      "description": "Voice parts in the project",
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": true,
        "properties": {
          "name": {
            "description": "Name of the voice part",
            "type": "string"
          },
          "track_no": {
            "description": "Index of the track the voice part is in",
            "type": "integer"
          },
          "position": {
            "description": "Position of the voice part in ticks",
            "type": "integer"
          },
          "notes": {
            "description": "Notes in the voice part",
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true,
              "properties": {
                "position": {
                  "description": "Position of the note in the voice part, in ticks",
                  "type": "integer"
                },
                "duration": {
                  "description": "Duration of the note in ticks",
                  "type": "integer"
                },
                "tone": {
                  "description": "Tone of the note, MIDI number, C4 is 60",
                  "type": "integer"
                },
                "lyric": {
                  "description": "Lyric of the note",
                  "type": "string"
                },
                "pitch": {
                  "description": "Pitch control points in the note",
                  "type": "object",
                  "properties": {
                    "data": {
                      "description": "Pitch control points",
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "x": {
                            "description": "Offset of the control point from the starting point of the note in ticks",
                            "type": "number"
                          },
                          "y": {
                            "description": "Tone value of the control point from the tone of the note in 1/10 semitone",
                            "type": "number"
                          },
                          "shape": {
                            "description": "Shape of the control point",
                            "type": "string",
                            "enum": ["l", "i", "o", "io"]
                          },
                          "snap_first": {
                            "type": "boolean"
                          }
                        }
                      }
                    }
                  }
                },
                "vibrato": {
                  "description": "Vibrato of the note",
                  "type": "object",
                  "properties": {
                    "length": {
                      "description": "Length of the vibrato, relative to the duration of the note, 0~100",
                      "type": "number"
                    },
                    "period": {
                      "description": "Period of the vibrato in Milliseconds",
                      "type": "number"
                    },
                    "depth": {
                      "description": "Depth of the vibrato in cents",
                      "type": "number"
                    },
                    "in": {
                      "description": "Fade in of the vibrato in Milliseconds",
                      "type": "number"
                    },
                    "out": {
                      "description": "Fade out of the vibrato in Milliseconds",
                      "type": "number"
                    }
                  }
                },
                "phoneme_expressions": {
                  "description": "Edited numerical or options expressions of the note",
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "index": {
                        "description": "Index of the phoneme that the expression belongs to",
                        "type": "integer"
                      },
                      "abbr": {
                        "description": "Abbreviation of the expression",
                        "type": "string"
                      },
                      "value": {
                        "description": "Value of the expression",
                        "type": "number"
                      }
                    }
                  }
                },
                "phoneme_overrides": {
                  "description": "Overridden phoneme aliases in the note",
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "index": {
                        "description": "Index of the phoneme that the override belongs to",
                        "type": "integer"
                      },
                      "phoneme": {
                        "description": "Phoneme after overriding",
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "wave_parts": {
      "description": "Wave parts in the project",
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": true,
        "properties": {
          "name": {
            "description": "Name of the wave part",
            "type": "string"
          },
          "track_no": {
            "description": "Index of the track the wave part is in",
            "type": "integer"
          },
          "position": {
            "description": "Position of the wave part in ticks",
            "type": "integer"
          },
          "relative_path": {
            "description": "Relative path of the audio file",
            "type": "string"
          },
          "file_duration_ms": {
            "description": "Duration of the audio file in Milliseconds",
            "type": "number"
          }
        }
      }
    }
  },
  "type": "object"
}
