Skip to content

Commit

Permalink
labの仕様をトークと合わせた
Browse files Browse the repository at this point in the history
  • Loading branch information
sigprogramming committed Dec 5, 2024
1 parent 61b9333 commit 6bac508
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/sing/domain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,8 @@ export const DEPRECATED_DEFAULT_EDITOR_FRAME_RATE = 93.75;

export const VALUE_INDICATING_NO_DATA = -1;

export const VOWELS = ["N", "a", "e", "i", "o", "u", "A", "E", "I", "O", "U"];

export const UNVOICED_PHONEMES = [
"pau",
"cl",
Expand All @@ -353,6 +355,10 @@ export const UNVOICED_PHONEMES = [
"ts",
];

export function isVowel(phoneme: string) {
return VOWELS.includes(phoneme);
}

export function createDefaultTempo(position: number): Tempo {
return { position, bpm: DEFAULT_BPM };
}
Expand Down
8 changes: 6 additions & 2 deletions src/sing/fileDataGenerator.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Encoding from "encoding-japanese";
import { isVowel } from "./domain";
import { Encoding as EncodingType } from "@/type/preload";
import { FramePhoneme } from "@/openapi";

Expand Down Expand Up @@ -101,8 +102,11 @@ export async function generateLabelFileData(
};

for (const phoneme of phonemes) {
// REVIEW: vowel != "N" のときに vowel.toLowerCase() する必要がある…?
writeLine(phoneme.frameLength / frameRate, phoneme.phoneme);
if (isVowel(phoneme.phoneme) && phoneme.phoneme !== "N") {
writeLine(phoneme.frameLength / frameRate, phoneme.phoneme.toLowerCase());
} else {
writeLine(phoneme.frameLength / frameRate, phoneme.phoneme);
}
}

return await generateTextFileData({ text: labString });
Expand Down

0 comments on commit 6bac508

Please sign in to comment.