diff --git a/libresvip/plugins/aisp/aisingers_generator.py b/libresvip/plugins/aisp/aisingers_generator.py index d310c5a7..fce8355b 100644 --- a/libresvip/plugins/aisp/aisingers_generator.py +++ b/libresvip/plugins/aisp/aisingers_generator.py @@ -134,7 +134,8 @@ def generate_tracks(self, tracks: list[Track]) -> list[AISSingVoiceTrack]: AISSingVoicePattern( uid=len(tracks) + len(ais_tracks), start=0, - length=max(note.start + note.length for note in note_list), + length=max(note.start + note.length for note in note_list) + + self.first_bar_length, notes=note_list, ) ], @@ -169,10 +170,11 @@ def generate_tracks(self, tracks: list[Track]) -> list[AISSingVoiceTrack]: def generate_notes(self, track: SingingTrack) -> list[AISNote]: ais_notes = [] for note in track.note_list: + note_start = int(note.start_pos / 15) ais_note = AISNote( midi_no=note.key_number - 12, - start=round(note.start_pos / 15), - length=round(note.length / 15), + start=note_start, + length=int(note.end_pos / 15) - note_start, lyric=note.lyric, pinyin=note.pronunciation or ( diff --git a/libresvip/plugins/svip/binsvip_parser.py b/libresvip/plugins/svip/binsvip_parser.py index 7d03f56f..e1d685fe 100644 --- a/libresvip/plugins/svip/binsvip_parser.py +++ b/libresvip/plugins/svip/binsvip_parser.py @@ -16,6 +16,7 @@ VibratoParam, ) from libresvip.model.point import Point +from libresvip.utils.text import CustomBoundriesBlacklist from .models import opensvip_singers, svip_note_head_tags, svip_reverb_presets from .msnrbf.xstudio_models import ( @@ -31,6 +32,12 @@ ) from .options import InputOptions +unsupported_symbols = CustomBoundriesBlacklist( + [",", ",", ".", "。", "?", "?", "!", "!"], + right_boundary="$", + match_substrings=True, +) + @dataclasses.dataclass class BinarySvipParser: @@ -106,7 +113,7 @@ def parse_note(self, note: XSNote) -> Note: length=note.width_pos, key_number=note.key_index - 12, head_tag=svip_note_head_tags.inverse.get(note.head_tag.value), - lyric=note.lyric, + lyric=unsupported_symbols.cleanse_text(note.lyric), ) if pronunciation := note.pronouncing: result_note.pronunciation = pronunciation