Skip to content

Commit

Permalink
aisp: update length calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
SoulMelody committed Jan 6, 2025
1 parent b659120 commit fd7cca6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
8 changes: 5 additions & 3 deletions libresvip/plugins/aisp/aisingers_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
],
Expand Down Expand Up @@ -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 (
Expand Down
9 changes: 8 additions & 1 deletion libresvip/plugins/svip/binsvip_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand All @@ -31,6 +32,12 @@
)
from .options import InputOptions

unsupported_symbols = CustomBoundriesBlacklist(
[",", ",", ".", "。", "?", "?", "!", "!"],
right_boundary="$",
match_substrings=True,
)


@dataclasses.dataclass
class BinarySvipParser:
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit fd7cca6

Please sign in to comment.