-
Notifications
You must be signed in to change notification settings - Fork 350
feat: 音声の長さ表示機能の追加 #2868
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
feat: 音声の長さ表示機能の追加 #2868
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
b6a7d7a
commit
akikukeo 64621b9
fix: 秒数が0にならない、秒数が表示されない
akikukeo 65c900b
lint
akikukeo 296a787
Merge branch 'main' into dev1
akikukeo f6ee4b2
スクリーンショット枚数を追加
akikukeo 9ee6f3e
不要な変更を削除
akikukeo 68312a6
test: オーディオアイテムの時間計算にテストを追加
akikukeo 6553f36
fmt
akikukeo 3d45ce2
Update tests/unit/store/audioGenerate.spec.ts
akikukeo 9565f18
Update audioGenerate.spec.ts
akikukeo f76dd83
Update audioGenerate.spec.ts
akikukeo b83ee32
Update audioGenerate.spec.ts
akikukeo 74bbf7a
Merge branch 'main' into dev1
akikukeo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
-549 Bytes
(99%)
tests/e2e/browser/設定ダイアログ/設定ダイアログ.spec.ts-snapshots/スクリーンショット-0-browser-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-1.14 KB
(98%)
tests/e2e/browser/設定ダイアログ/設定ダイアログ.spec.ts-snapshots/スクリーンショット-1-browser-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-1.55 KB
(98%)
tests/e2e/browser/設定ダイアログ/設定ダイアログ.spec.ts-snapshots/スクリーンショット-2-browser-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+288 Bytes
(100%)
tests/e2e/browser/設定ダイアログ/設定ダイアログ.spec.ts-snapshots/スクリーンショット-3-browser-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-7.3 KB
(91%)
tests/e2e/browser/設定ダイアログ/設定ダイアログ.spec.ts-snapshots/スクリーンショット-4-browser-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+83.5 KB
tests/e2e/browser/設定ダイアログ/設定ダイアログ.spec.ts-snapshots/スクリーンショット-5-browser-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions
1
tests/unit/backend/common/__snapshots__/configManager.spec.ts.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,171 @@ | ||
| import { describe, test, expect } from "vitest"; | ||
| import { calculateAudioLength } from "@/store/audioGenerate"; | ||
| import { EditorAudioQuery } from "@/store/type"; | ||
|
|
||
| const baseEditorAudioQuery: EditorAudioQuery = { | ||
| accentPhrases: [], | ||
| speedScale: 1, | ||
| pitchScale: 0, | ||
| intonationScale: 1, | ||
| volumeScale: 1, | ||
| prePhonemeLength: 0.1, | ||
| postPhonemeLength: 0.1, | ||
| pauseLengthScale: 1, | ||
| outputSamplingRate: 24000, | ||
| outputStereo: false, | ||
| kana: "", | ||
| }; | ||
|
|
||
| describe("audioGenerate", () => { | ||
| describe("calculateAudioLength", () => { | ||
| test("アクセント句がない場合は0を返すこと", () => { | ||
| const audioQuery: EditorAudioQuery = { | ||
| ...baseEditorAudioQuery, | ||
| accentPhrases: [], | ||
| }; | ||
|
|
||
| expect(calculateAudioLength(audioQuery)).toBe(0); | ||
| }); | ||
|
|
||
| test("アクセント句がある場合の計算が正しいこと", () => { | ||
| const audioQuery: EditorAudioQuery = { | ||
| ...baseEditorAudioQuery, | ||
| accentPhrases: [ | ||
| { | ||
| moras: [ | ||
| { | ||
| text: "あ", | ||
| vowel: "a", | ||
| vowelLength: 0.2, | ||
| pitch: 0, | ||
| consonant: "a", | ||
| consonantLength: 0.1, | ||
| }, // 0.3 | ||
| { | ||
| text: "い", | ||
| vowel: "i", | ||
| vowelLength: 0.2, | ||
| pitch: 0, | ||
| consonant: undefined, | ||
| consonantLength: undefined, | ||
| }, // 0.2 | ||
| ], | ||
| accent: 1, | ||
| pauseMora: undefined, | ||
| }, | ||
| ], | ||
| }; | ||
|
|
||
| // 0.1(pre) + 0.3 + 0.2 + 0.1(post) = 0.7 | ||
| expect(calculateAudioLength(audioQuery)).toBeCloseTo(0.7); | ||
| }); | ||
|
|
||
| test("speedScaleが反映されること", () => { | ||
| const audioQuery: EditorAudioQuery = { | ||
| ...baseEditorAudioQuery, | ||
| accentPhrases: [ | ||
| { | ||
| moras: [ | ||
| { | ||
| text: "あ", | ||
| vowel: "a", | ||
| vowelLength: 0.2, | ||
| pitch: 0, | ||
| consonant: "a", | ||
| consonantLength: 0.1, | ||
| }, | ||
| ], | ||
| accent: 1, | ||
| pauseMora: undefined, | ||
| }, | ||
| ], | ||
| speedScale: 2, // 2倍速 | ||
| }; | ||
|
|
||
| // (0.1(pre) + 0.3 + 0.1(post)) / 2 = 0.25 | ||
| expect(calculateAudioLength(audioQuery)).toBeCloseTo(0.25); | ||
| }); | ||
|
|
||
| test("ポーズがある場合の計算が正しいこと", () => { | ||
| const audioQuery: EditorAudioQuery = { | ||
| ...baseEditorAudioQuery, | ||
| accentPhrases: [ | ||
| { | ||
| moras: [ | ||
| { | ||
| text: "あ", | ||
| vowel: "a", | ||
| vowelLength: 0.2, | ||
| pitch: 0, | ||
| consonant: "a", | ||
| consonantLength: 0.1, | ||
| }, | ||
| ], | ||
| accent: 1, | ||
| pauseMora: { | ||
| text: "、", | ||
| vowel: "pau", | ||
| vowelLength: 0.5, | ||
| pitch: 0, | ||
| }, // 0.5 * 1.5 = 0.75 | ||
| }, | ||
| ], | ||
| pauseLengthScale: 1.5, | ||
| }; | ||
|
|
||
| // 0.1 + 0.3 + 0.75 + 0.1 = 1.25 | ||
| expect(calculateAudioLength(audioQuery)).toBeCloseTo(1.25); | ||
| }); | ||
| test("prePhonemeLengthが反映されること", () => { | ||
| const audioQuery: EditorAudioQuery = { | ||
| ...baseEditorAudioQuery, | ||
| accentPhrases: [ | ||
| { | ||
| moras: [ | ||
| { | ||
| text: "あ", | ||
| vowel: "a", | ||
| vowelLength: 0.2, | ||
| pitch: 0, | ||
| consonant: "a", | ||
| consonantLength: 0.1, | ||
| }, | ||
| ], | ||
| accent: 1, | ||
| pauseMora: undefined, | ||
| }, | ||
| ], | ||
| prePhonemeLength: 0.5, | ||
| }; | ||
|
|
||
| // 0.5(pre) + 0.3 + 0.1(post) = 0.9 | ||
| expect(calculateAudioLength(audioQuery)).toBeCloseTo(0.9); | ||
| }); | ||
|
|
||
| test("postPhonemeLengthが反映されること", () => { | ||
| const audioQuery: EditorAudioQuery = { | ||
| ...baseEditorAudioQuery, | ||
| accentPhrases: [ | ||
| { | ||
| moras: [ | ||
| { | ||
| text: "あ", | ||
| vowel: "a", | ||
| vowelLength: 0.2, | ||
| pitch: 0, | ||
| consonant: "a", | ||
| consonantLength: 0.1, | ||
| }, | ||
| ], | ||
| accent: 1, | ||
| pauseMora: undefined, | ||
| }, | ||
| ], | ||
| postPhonemeLength: 0.5, | ||
| }; | ||
|
|
||
| // 0.1(pre) + 0.3 + 0.5(post) = 0.9 | ||
| expect(calculateAudioLength(audioQuery)).toBeCloseTo(0.9); | ||
| }); | ||
| }); | ||
| }); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.