update: complete the doc for alignment pipeline
This commit is contained in:
parent
2358229ca8
commit
0b31288754
@ -1,3 +1,4 @@
|
||||
1. prepare `1.mp3`, `1.txt`, `1.group` in `./data`
|
||||
2. `whisperAlignment/alignWithGroup`
|
||||
3. `mmsAlignment
|
||||
2. Run `whisperAlignment/alignWithGroup.py`
|
||||
3. Run `mmsAlignment/splitSong.py`
|
||||
4. Run `mmsAlignment/alignWithMMS.py`
|
||||
@ -164,4 +164,4 @@ def align(audio_file: str, lrc_file: str, output_ttml: str, segments_dir: str =
|
||||
ttml_generator.save(output_ttml)
|
||||
|
||||
if __name__ == "__main__":
|
||||
align("./data/1.flac", "./data/1.lrc", "./data/output.ttml", "./temp/lines")
|
||||
align("./data/1.mp3", "./data/1.lrc", "./data/output.ttml", "./temp/lines")
|
||||
@ -52,7 +52,7 @@ def split_audio_by_lrc(audio_file, lrc_data):
|
||||
|
||||
if __name__ == "__main__":
|
||||
lrc_file = "./data/1.lrc" # LRC文件路径
|
||||
audio_file = "./data/1.flac" # 音频文件路径
|
||||
audio_file = "./data/1.mp3" # 音频文件路径
|
||||
|
||||
lrc_data = parse_lrc(lrc_file)
|
||||
split_audio_by_lrc(audio_file, lrc_data)
|
||||
@ -3,4 +3,13 @@ import stable_whisper
|
||||
def align2srt(lyrics, audio_path, output_path):
|
||||
model = stable_whisper.load_model('large-v3')
|
||||
result = model.align(audio_path, lyrics, language="Chinese", regroup=False)
|
||||
result.to_srt_vtt(output_path, segment_level=False)
|
||||
result.to_srt_vtt(output_path, segment_level=False)
|
||||
|
||||
AUDIO_FILE = './data/1.mp3'
|
||||
LYRICS_FILE = './data/1.txt'
|
||||
OUTPUT_FILE = './data/1.srt'
|
||||
|
||||
if __name__ == "__main__":
|
||||
with open(LYRICS_FILE, 'r') as f:
|
||||
lyrics_content = f.read()
|
||||
align2srt(lyrics_content, AUDIO_FILE, OUTPUT_FILE)
|
||||
Loading…
Reference in New Issue
Block a user