Skip to content

Conversation

@rokujyushi
Copy link
Contributor

@rokujyushi rokujyushi commented Apr 21, 2025

EnunuConfig Extensions and Rendering Improvements

Added new properties and classes to EnunuConfig.cs to make the configuration more extensible. Modified the PhraseToEnunuNotes method to take EnunuConfig as an argument and added timbre construction logic using style_format. The GetSuggestedExpressions method has also been updated to properly load when the configuration is null. The Load method now has a condition to consider the unLoadSubBanks property, and EnunuUtils.cs now has UTF8 encoding.

Voice colours (strength, singing style) for the following sources are now loaded from config.yaml.
NNSVS/ENUNU 波音リツ CRISSCROSS 5スタイル #4130

extensions:
  ust_editor:
    - "%e/extensions/style_shifter.py"
    - "%v/flag_separator/flag_separator.py"
  timing_editor:
    - "%v/velocity_applier/velocity_applier.py"
    - "%v/timing_auto_correct/enunu_timing_auto_correct.py"
  acoustic_editor:
    - "%e/extensions/style_shifter.py"
  style_format:
    p9: 
      ldst: "{0}"
      loud: "{0}"
      nrml: "{0}"
      soft: "{0}"
    p16: 
      Std: "s{0}"
      swt: "s{0}"
      rock: "r{0}"
      brth: "b{0}"
      pop: "p{0}"
  styles:
    ldst:
      name: Loudest #OpenUtau表示名
      type: Numerical #フラグの操作コントロールの種類
      min: 0
      max: 3
      default_value: 0
      flag: p9 #USTに書き込むフラグ
      
    loud:
      name: Loud #OpenUtau表示名
      type: Numerical #フラグの操作コントロールの種類
      min: 0
      max: 3
      default_value: 0
      flag: p9 #USTに書き込むフラグ
      
    nrml:
      name: Normal #OpenUtau表示名
      type: Numerical #フラグの操作コントロールの種類
      min: 0
      max: 3
      default_value: 0
      flag: p9 #USTに書き込むフラグ
      
    soft:
      name: Soft #OpenUtau表示名
      type: Numerical #フラグの操作コントロールの種類
      min: 0
      max: 3
      default_value: 0
      flag: p9 #USTに書き込むフラグ
      
    Std:
      name: Standard #OpenUtau表示名
      type: Numerical #フラグの操作コントロールの種類
      min: 0
      max: 3
      default_value: 0
      flag: p16 #USTに書き込むフラグ
      
    swt:
      name: Sweet #OpenUtau表示名
      type: Numerical #フラグの操作コントロールの種類
      min: 0
      max: 3
      default_value: 0
      flag: p16 #USTに書き込むフラグ
      
    rock:
      name: Rock #OpenUtau表示名
      type: Numerical #フラグの操作コントロールの種類
      min: 0
      max: 3
      default_value: 0
      flag: p16 #USTに書き込むフラグ
      
    brth:
      name: Breathy #OpenUtau表示名
      type: Numerical #フラグの操作コントロールの種類
      min: 0
      max: 6
      default_value: 0
      flag: p16 #USTに書き込むフラグ
      
    pop:
      name: Pop #OpenUtau表示名
      type: Numerical #フラグの操作コントロールの種類
      min: 0
      max: 3
      default_value: 0
      flag: p16 #USTに書き込むフラグ

An option to not read in voice colours from the question file has been added.

# Global configs
sample_rate: 48000
frame_period: 5
log_f0_conditioning: true
use_world_codec: true
feature_type: world
unload_subbanks: true

EnunuConfig Extensions and Rendering Improvements

Added new properties and classes to `EnunuConfig.cs` to make the configuration more extensible. Modified the `PhraseToEnunuNotes` method to take `EnunuConfig` as an argument and added `timbre` construction logic using `style_format`. The `GetSuggestedExpressions` method has also been updated to properly load when the configuration is null. The `Load` method now has a condition to consider the `unLoadSubBanks` property, and `EnunuUtils.cs` now has `UTF8` encoding.
The lines `using System.Diagnostics;` and `using Vortice;` have been removed. This means that these namespaces are no longer used in this file.
Copilot AI review requested due to automatic review settings April 21, 2025 22:24
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces Enunu style support by extending the Enunu configuration and updating rendering logic for improved style and subbank handling.

  • Extended EnunuConfig with new properties and parsing logic for style formats and expression details.
  • Modified rendering functions to pass configuration and incorporate style formatting in note generation.
  • Updated the singer loading logic to conditionally add subbanks based on the new configuration parameter.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
OpenUtau.Core/Enunu/EnunuUtils.cs Added UTF8 encoding support.
OpenUtau.Core/Enunu/EnunuSinger.cs Adjusted subbank addition logic to consider the unLoadSubBanks setting.
OpenUtau.Core/Enunu/EnunuRenderer.cs Updated PhraseToEnunuNotes to accept a config parameter and fixed note style processing; added logic for generating suggested expressions.
OpenUtau.Core/Enunu/EnunuConfig.cs Extended config to include unLoadSubBanks and parsing for style_format and styles.
Comments suppressed due to low confidence (2)

OpenUtau.Core/Enunu/EnunuConfig.cs:14

  • [nitpick] Consider renaming 'unLoadSubBanks' to 'UnloadSubBanks' to follow standard C# naming conventions for boolean properties.
public bool unLoadSubBanks = false;

OpenUtau.Core/Enunu/EnunuRenderer.cs:300

  • The variable 'config' is referenced in GetSuggestedExpressions without a clear declaration within the method or as a class member. Ensure that 'config' is properly defined or passed to the method to avoid runtime errors.
if(config == null) {

}
}
timbre += result;
timbre = timbre.TrimEnd('/');
Copy link

Copilot AI Apr 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 'timbre' variable is declared outside the phone loop and is not reset for each iteration, which may lead to unintended accumulation of style values. Consider initializing 'timbre' inside the loop for each phone.

Copilot uses AI. Check for mistakes.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The AI seems to have a point?

Copy link
Contributor Author

@rokujyushi rokujyushi May 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stakira
The timbre is assigned a style setting for each suffix and voicebank.
The style settings are assembled in lines 254 to 284 and the result is assigned to result.
The result is appended to timbre at line 280.
As timbre is set to EnunuNote (phoneme), timbre is initialised at line 255 each time an EnunuNote is created.

…nfig は各メソッド内でのみ有効となり、クラス全体の状態を持たなくなりました。Render や GetSuggestedExpressions メソッド内で config を初期化するよう修正し、コードのスコープが明確化されました。
@rokujyushi rokujyushi marked this pull request as draft April 24, 2025 21:39
@rokujyushi
Copy link
Contributor Author

Corrected the way format is specified.

extensions:
  style_format:
    p9: 
      format: "{0}{1}{2}{3}"
      index: [ldst, loud, nrml, soft]
    p16: 
      format: "s{0}s{1}r{2}b{3}p{4}"
      index: [Std, swt, rock, brth, pop]

@rokujyushi rokujyushi marked this pull request as ready for review April 30, 2025 17:31
@rokujyushi rokujyushi requested a review from Copilot April 30, 2025 17:31
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances Enunu configuration and rendering by introducing style support, updated configuration handling, and improved encoding support. Key changes include adding a UTF8 encoding constant, updating subbank loading logic based on a new configuration flag, refactoring the PhraseToEnunuNotes method to use the latest configuration, and expanding the EnunuConfig parser to support new style format and expression properties.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
OpenUtau.Core/Enunu/EnunuUtils.cs Added a UTF8 encoding constant to support flexible text encoding.
OpenUtau.Core/Enunu/EnunuSinger.cs Modified subbanks loading condition to honor the enuconfig.unLoadSubBanks flag.
OpenUtau.Core/Enunu/EnunuRenderer.cs Updated configuration handling in PhraseToEnunuNotes and GetSuggestedExpressions; removed unused field.
OpenUtau.Core/Enunu/EnunuConfig.cs Added a new unLoadSubBanks property and extended parsing functionality for style_format and styles.
Comments suppressed due to low confidence (2)

OpenUtau.Core/Enunu/EnunuRenderer.cs:304

  • Returning null from GetSuggestedExpressions may force callers to perform extra null checks; consider returning an empty array for a more consistent API.
if (ensinger == null) { return null; }

OpenUtau.Core/Enunu/EnunuConfig.cs:206

  • Overwriting the flag variable within ParseEnunuStyleFormat may inadvertently discard valid entries if extra keys are present. Consider checking for required keys without unconditionally resetting the flag.
else { flag = false; }

rokujyushi and others added 7 commits May 8, 2025 01:33
@stakira stakira merged commit 2cc5a4e into stakira:master May 21, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants