Improve: 分割ファイル名の連番桁数を最大分割数に応じて自動調整#212
Open
TwQXfJKA wants to merge 1 commit into
Open
Conversation
…sed on max split count ・Added a preview phase to calculate the maximum number of slices per audio file before processing. ・Dynamically determine the number of digits needed for zero-padding slice indices to ensure consistent and properly sortable filenames. ・Updated split_wav to accept a num_digits parameter for zero-padding the file index. ・Combined preview and processing steps into the same worker threads with phase control to optimize resource usage. ・Maintained existing parallel VAD model loading per worker to avoid concurrency issues. ・No functional changes to audio splitting logic; this is purely an improvement for output filename consistency and usability.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
お世話になります。
機能改善のPRになります。ご確認よろしくお願いいたします。
概要
音声分割時のファイル名の連番桁数を音声ファイルごとの分割数の最大値に合わせて動的に調整する機能を追加しました。
→ これによりファイル名の桁数が不足してファイル順序が狂う問題を防止しています。
分割処理前に「プレビュー」フェーズを設け、各ファイルの分割数をワーカースレッドで事前計算し、最大分割数を求めています。
→ その最大桁数を用いて分割時の連番ファイル名のフォーマット幅(
num_digits)を決定しています。split_wav関数にnum_digits引数を追加し、ゼロ埋め桁数を柔軟に指定可能にしました。並列処理用のワーカー関数
process_queueを改修し、「プレビュー」と「分割処理」の2フェーズをQueueで切り替えながら実行する仕組みを導入しました。
既存の並列処理・エラーハンドリングは維持しつつ、Queueでフェーズ制御を行うことで1回のワーカー起動で2段階処理を行うようにしました。
これに伴い、変数やQueueの管理を見直し、
num_digits_holder辞書で動的桁数をスレッド間共有しています。背景・目的
影響範囲
動作確認
ファイル名の連番桁数が最大分割数に合わせて適切にゼロ埋めされていることを確認済みです。