Skip to content

Commit 96a8d29

Browse files
committed
fix(ustx, seqtool, gui): fix in-place editing, interpolation, and unicode
fix(ustx): catch SameFileError when same-path input/output; remove hardcoded SUPPORTED_EXPRESSIONS restriction; add allow_unicode=True to oyaml.dump; warn when no expression points fit any voice part fix(seqtool): replace extrapolate fill with NaN in interp1d to avoid out-of-bounds artifacts fix(pitd): fix StreamToLogger scope covering ref feature extraction fix(gui): add ensure_ascii=False to json.dump for config export docs(dyn, tenc): add notice about trim_silence clipping voiced segments docs(readme): add in-place edit tip and backup warning for v0.9.1
1 parent 8ef53bc commit 96a8d29

13 files changed

Lines changed: 60 additions & 52 deletions

File tree

README.en.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,13 @@ When using a DiffSinger virtual singer for covers, users often already have an O
8383

8484
A new USTX file with expression parameters added. The original project will not be modified.
8585

86+
> [!TIP]
87+
> Starting from `v0.9.1`, if you prefer not to generate a new project file, you can **set the output path to be the same as the input project path**. In this case, the expression parameters will be written directly into the original project file.
88+
>
89+
> Under normal circumstances, the program will only update the specified expression parameters in the selected track. It will not affect other parameters or modify other tracks.
90+
>
91+
> ⚠️ **If you plan to use this feature, please make a backup in advance to prevent potential data loss in case of errors**.
92+
8693
## ✨ Features
8794

8895
* [x] Windows support

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,13 @@
8383

8484
一个携带表情参数的新 USTX 文件。原始工程不会被修改。
8585

86+
> [!TIP]
87+
> `v0.9.1` 开始,如果您不希望额外生成新的工程文件,可以**将输出路径设置为与输入工程路径一致**。这样,表情参数会直接写入原始工程文件中。
88+
>
89+
> 正常情况下,程序只会更新您所选音轨中的指定表情参数,不会影响其它参数,也不会修改其他音轨。
90+
>
91+
> ⚠️ **如果您需要使用此功能,请提前做好备份,以防程序出错**
92+
8693
## ✨ 功能特性
8794

8895
* [x] Windows 支持

expressions/dyn.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class DynLoader(ExpressionLoader):
2525
expression_name = "dyn"
2626
expression_info = _l("Dynamics (curve)")
2727
args = SimpleNamespace(
28-
trim_silence = Args(name="trim_silence" , type=bool , default=True, help=_l("**Trim silence** from the leading and trailing edges of the audio before extracting expression")), # noqa: E501
28+
trim_silence = Args(name="trim_silence" , type=bool , default=True, help=_l("**Trim silence** from the leading and trailing edges of the audio before extracting expression\n\n**NOTICE**: This may slightly cut into the beginning and ending of voiced segments. If the effect is too severe, consider disabling this option\n\n")), # noqa: E501
2929
align_radius = Args(name="align_radius" , type=int , default=1 , help=_l("**Radius** for the FastDTW alignment algorithm; larger values allow more flexible alignment but increase computation time")), # noqa: E501
3030
smoothness = Args(name="smoothness" , type=int , default=2 , help=_l("Controls the **smoothness** of the expression curve using Gaussian filtering. Higher values produce smoother curves but may lose fine detail")), # noqa: E501
3131
scaler = Args(name="scaler" , type=float, default=1.5 , help=_l("**Scaling factor** applied to the expression curve. Values >1 amplify the expression, =1 keeps original intensity, <1 reduces it")), # noqa: E501

expressions/pitd.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ def get_expression(
7575
utau_time, utau_pitch, utau_confidence, utau_features = get_wav_features(
7676
wav_path=self.utau_path, confidence_threshold=confidence_utau, backend=backend
7777
)
78-
with StreamToLogger(self.logger, tee=True):
7978
ref_time, ref_pitch, ref_confidence, ref_features = get_wav_features(
8079
wav_path=self.ref_path, confidence_threshold=confidence_ref, backend=backend
8180
)

expressions/tenc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class TencLoader(ExpressionLoader):
2525
expression_name = "tenc"
2626
expression_info = _l("Tension (curve)")
2727
args = SimpleNamespace(
28-
trim_silence = Args(name="trim_silence" , type=bool , default=True, help=_l("**Trim silence** from the leading and trailing edges of the audio before extracting expression")), # noqa: E501
28+
trim_silence = Args(name="trim_silence" , type=bool , default=True, help=_l("**Trim silence** from the leading and trailing edges of the audio before extracting expression\n\n**NOTICE**: This may slightly cut into the beginning and ending of voiced segments. If the effect is too severe, consider disabling this option\n\n")), # noqa: E501
2929
align_radius = Args(name="align_radius" , type=int , default=1 , help=_l("**Radius** for the FastDTW alignment algorithm; larger values allow more flexible alignment but increase computation time")), # noqa: E501
3030
smoothness = Args(name="smoothness" , type=int , default=6 , help=_l("Controls the **smoothness** of the expression curve using Gaussian filtering. Higher values produce smoother curves but may lose fine detail")), # noqa: E501
3131
scaler = Args(name="scaler" , type=float, default=1.0 , help=_l("**Scaling factor** applied to the expression curve. Values >1 amplify the expression, =1 keeps original intensity, <1 reduces it")), # noqa: E501

expressive.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import os
22
import logging
33
import argparse
4-
from shutil import copy
54
from pathlib import Path
65
from datetime import datetime
76
from contextlib import contextmanager
7+
from shutil import copy, SameFileError
88
from os.path import splitext, basename
99

1010
from utils.i18n import init_gettext, _
@@ -77,7 +77,10 @@ def process_expressions(
7777
]
7878
```
7979
"""
80-
copy(ustx_input, ustx_output)
80+
try:
81+
copy(ustx_input, ustx_output)
82+
except SameFileError:
83+
pass
8184

8285
for exp in expressions:
8386
exp_type = exp["expression"]

expressive_gui.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ async def export_config(state=state):
161161
if file and len(file) > 0:
162162
try:
163163
with open(file[0], "w+", encoding="utf-8-sig") as f: # type: ignore
164-
json.dump(state, f, indent=4)
164+
json.dump(state, f, indent=4, ensure_ascii=False)
165165
ui.notify(_("Config exported successfully!"), type="positive")
166166
except Exception as e:
167167
ui.notify(_("Failed to export config") + f": {str(e)}", type="negative")

locales/app.pot

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,11 @@ msgstr ""
290290
#: expressions/dyn.py:28 expressions/tenc.py:28
291291
msgid ""
292292
"**Trim silence** from the leading and trailing edges of the audio before "
293-
"extracting expression"
293+
"extracting expression\n"
294+
"\n"
295+
"**NOTICE**: This may slightly cut into the beginning and ending of voiced"
296+
" segments. If the effect is too severe, consider disabling this option\n"
297+
"\n"
294298
msgstr ""
295299

296300
#: expressions/dyn.py:29 expressions/pitd.py:41 expressions/tenc.py:29

locales/en/LC_MESSAGES/app.po

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,10 +301,18 @@ msgstr "Dynamics (curve)"
301301
#: expressions/dyn.py:28 expressions/tenc.py:28
302302
msgid ""
303303
"**Trim silence** from the leading and trailing edges of the audio before "
304-
"extracting expression"
304+
"extracting expression\n"
305+
"\n"
306+
"**NOTICE**: This may slightly cut into the beginning and ending of voiced"
307+
" segments. If the effect is too severe, consider disabling this option\n"
308+
"\n"
305309
msgstr ""
306310
"**Trim silence** from the leading and trailing edges of the audio before "
307-
"extracting expression"
311+
"extracting expression\n"
312+
"\n"
313+
"**NOTICE**: This may slightly cut into the beginning and ending of voiced"
314+
" segments. If the effect is too severe, consider disabling this option\n"
315+
"\n"
308316

309317
#: expressions/dyn.py:29 expressions/pitd.py:41 expressions/tenc.py:29
310318
msgid ""

locales/zh_CN/LC_MESSAGES/app.po

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,8 +291,16 @@ msgstr "动态曲线 Dynamics (curve)"
291291
#: expressions/dyn.py:28 expressions/tenc.py:28
292292
msgid ""
293293
"**Trim silence** from the leading and trailing edges of the audio before "
294-
"extracting expression"
295-
msgstr "在提取表情特征前,**剪除**音频开头与结尾的**静音部分**"
294+
"extracting expression\n"
295+
"\n"
296+
"**NOTICE**: This may slightly cut into the beginning and ending of voiced"
297+
" segments. If the effect is too severe, consider disabling this option\n"
298+
"\n"
299+
msgstr ""
300+
"在提取表情特征前,**剪除**音频开头与结尾的**静音部分**\n"
301+
"\n"
302+
"**注意**:该操作可能会轻微截断有声段的起始和结束部分;若影响较为明显,建议关闭此功能\n"
303+
"\n"
296304

297305
#: expressions/dyn.py:29 expressions/pitd.py:41 expressions/tenc.py:29
298306
msgid ""

0 commit comments

Comments
 (0)