-
Notifications
You must be signed in to change notification settings - Fork 312
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
feat: VST版エディタをマージ #2521
base: main
Are you sure you want to change the base?
feat: VST版エディタをマージ #2521
Conversation
[update snapshots]
src/store/singing.ts
Outdated
GET_SINGING_VOICE: { | ||
action(_, { key }) { | ||
return singingVoiceCache.get(key); | ||
}, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
キャッシュから取得なので、GET_SINGING_VOICE_FROM_CACHE
が良いかも。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ちょっと一旦ひとかたまりのコメントまで!
#2521 (comment)
🚀 プレビュー用ページを作成しました 🚀 更新時点でのコミットハッシュ: |
project-vstに向けてるとproject-vstを作ってからのmainのコミットがここに出ちゃうので一旦mainに向けます。マージ直前にproject-vstに向ける感じで。 |
src/store/singing.ts
Outdated
GET_SINGING_VOICE: { | ||
action(_, { key }) { | ||
return phraseSingingVoices.get(key); | ||
}, | ||
}, | ||
|
||
LOAD_SINGING_VOICE_CACHE: { | ||
async action() { | ||
const cache = await window.backend.fetchCachedSingingVoices(); | ||
for (const [key, value] of Object.entries(cache)) { | ||
phraseSingingVoices.set(SingingVoiceKey(key), value); | ||
} | ||
}, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
phraseSingingVoices
に対してset/getするようになっていますが、phraseSingingVoices
は存在するフレーズの歌声のみを保持するもので、phraseSingingVoices
に存在するキーはフレーズが持っている必要があります。その辺りは大丈夫でしょうか?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
あ、間違えました(cachedのほうにすればいいかな)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
キャッシュをロードするactionっぽいので、たぶんsingingVoiceCache.set
で良さそう…?
GET_SINGING_VOICE
の方も、キャッシュの取得として使用されているっぽいので、FROM_CACHE
をつけてsingingVoiceCache.get
にするのが良さそう。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GET_SINGING_VOICEはどちらかといえば現存するフレーズの音声を取得するのを想定しているので、こっちはキャッシュからじゃない方がよさそう。
src/type/preload.ts
Outdated
@@ -135,6 +135,7 @@ export interface Sandbox { | |||
validateEngineDir(engineDir: string): Promise<EngineDirValidationResult>; | |||
reloadApp(obj: { isMultiEngineOffMode?: boolean }): Promise<void>; | |||
getPathForFile(file: File): string; | |||
fetchCachedSingingVoices(): Promise<Record<SingingVoiceKey, SingingVoice>>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
キャッシュについてAI君に聞いてみたら、思った以上に考慮ポイントありそうだったので共有です。
将来的に対応しないといけないかもなので、あとで無理なく実装できるよう今のうちから知っておくと良いかも。
https://chatgpt.com/share/67b9dd73-7840-8008-a794-388584af6283
src/backend/vst/sandbox.ts
Outdated
async fetchCachedSingingVoices() { | ||
// キャッシュされた歌声を読み込む。 | ||
log.info("Loading cached voices"); | ||
const encodedVoices = await getVoices(); | ||
return Object.fromEntries( | ||
await Promise.all( | ||
Object.entries(encodedVoices).map( | ||
async ([key, encodedVoice]) => | ||
[ | ||
SingingVoiceKey(key), | ||
new Blob([await toBytes(encodedVoice)]), | ||
] satisfies [SingingVoiceKey, SingingVoice], | ||
), | ||
), | ||
); | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ここ、ストレージのIOとbase64が絡んでて流石にだいぶ時間かかりそうな気がするので、現段階でなんとかしないといけない気がしています。
とりあえず2点気になってます。
- 無限にキャッシュがたまり続けてしまう
- キャッシュが最大まで溜まっているときにどれくらい時間かかるのか
後者は1秒かかるならかなりまずい、くらいの気持ちです。
僕の環境だと立ち絵が開始から3秒くらいで編集可能になるのでこれくらいの基準かなと。特にVSTだとon/offを切り替えるたびにこの秒数かかるので、結構UXにも関わってくるはず?
仮に実装するならどのように実装するのか悩みどころですが、一旦考えを聞けると 🙏
(もしやるなら・・・例えばLRUを導入して、あとファイルごとに保存して、遅延読み込みにするとか・・・?LRUはライブラリ使ってもいいけど、細かい仕様を相当把握しないといけず、そこまでドキュメント書かれてないなら結局コードを読むことになりそうで、自前実装のが楽かもな予感。)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
無限にキャッシュがたまり続けてしまう
フレーズが消えていたらキャッシュも消えます(プラグインでの再生用に保存している波形を起動時に持ってきてる感じ)
キャッシュが最大まで溜まっているときにどれくらい時間かかるのか
3分程度の曲なら差はほとんどありませんでした。
init.mp4
init2.mp4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
あーーーなるほどです!!!!セッションが切れるまで前提の設計なんですね!
現状汎用的な機能ではなく、VST専用の機能という感じになりそうですね!
エディタの場合空のプロジェクトファイルから始まるから最初にキャッシュが全部吹き飛んでしまうので。
この認識が合ってそうであれば、vst専用の関数であることをもっとわかりやすい形にしたいかもです。
理想的にはbackendがVSTのときのみfetchCachedSingingVoices
があるという状況にできると良さそうですが、どうでしょう・・・?
あるいは汎用的な機能を改めて目指すのもとても良いと個人的には思います!
セッションが閉じても大丈夫なように設計し直す感じになるかなと。
だいぶ大変だし別PRが必要そうですが、使い勝手は結構上がるかなぁと。
もしくは、他のソングエディタがプロジェクトファイルに音声を保存してそうであれば、僕達もその方向性を目指すのもありかもです。
実際に作ってみてファイル容量を見るとわかるかも・・・?
ちょっとまた一旦考え聞けると 🙏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
セッションが切れるまで前提の設計なんですね!
そういうわけでも無いですね。
フレーズの音声は全部vst内のストレージに保存しているので、セッションが切れても(dawを立ち上げ直しても)キャッシュは残ると思います。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
フレーズの音声は全部vst内のストレージに保存しているので、セッションが切れても(dawを立ち上げ直しても)キャッシュは残ると思います。
あれ、なるほど・・・?
あ、これ前提として「vst版は」という理解であってそうでしょうか?
通常エディタで使う場合は実質「セッション切れるまで」・・・?もしくは別のプロジェクトファイルを開いた状態でor空の状態でエディタを閉じるまで・・・?
まあ何にせよここの提案は変わらずです!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
通常エディタで使う場合は
LRUとか1GB制限とかをつけて全体でキャッシュを作るイメージでした。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LRUとか1GB制限とかをつけて全体でキャッシュを作るイメージでした。
この場合初期化の際のロードが遅くなるので、たぶん全部持ってくる設計だと難しい気がしてます。
(理由はストレージのIOとbase64が絡んでて流石にだいぶ時間かかりそうな気がする
)
となるとインターフェイスが変わってくる(個別読み込みが必要)のと、ファイル形式も変えないといけないので、通常エディタ用に拡張できない設計になってるかも?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
singingVoiceCacheが無い時だけ問い合わせるようにしました。
内容
自リポジトリのVST版エディタをマージします。
関連 Issue
スクリーンショット・動画など
(なし)
その他