babysor / babysor/MockingBird

models/synthesizer/preprocess_audio.py bug

Open
#963 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
36.9k
Forks
5.2k
PR merge metrics
No merged PRs in 30d

Description

def preprocess_general(speaker_dir, out_dir: Path, skip_existing: bool, hparams, dict_info, no_alignments: bool, encoder_model_fpath: Path):
metadata = []
extensions = ("*.wav", "*.flac", "*.mp3")
for extension in extensions:
wav_fpath_list = speaker_dir.glob(extension)
# Iterate over each wav
for wav_fpath in wav_fpath_list:
words = dict_info.get(wav_fpath.name.split(".")[0])
if not words:
words = dict_info.get(wav_fpath.name) # try with extension
if not words:
print(f"No word found in dict_info for {wav_fpath.name}, skip it")
continue
sub_basename = "%s_%02d" % (wav_fpath.name, 0)

mel_fpath = out_dir.joinpath("mels", f"mel-{sub_basename}.npy")
wav_fpath = out_dir.joinpath("audio", f"audio-{sub_basename}.npy")

if skip_existing and mel_fpath.exists() and wav_fpath.exists():
continue
wav, text = _split_on_silences(wav_fpath, words, hparams)
result = _process_utterance(wav, text, out_dir, sub_basename,
False, hparams, encoder_model_fpath) # accelarate
if result is None:
continue
wav_fpath_name, mel_fpath_name, embed_fpath_name, wav, mel_frames, text = result
metadata.append ((wav_fpath_name, mel_fpath_name, embed_fpath_name, len(wav), mel_frames, text))

return metadata

发现该函数中的这段代码有些不对,运行报错
FileNotFoundError: [Errno 2] No such file or directory: '/MockingBird/SV2TTS/synthesizer/audio/audio-001242.wav_00.npy'

mel_fpath = out_dir.joinpath("mels", f"mel-{sub_basename}.npy")
wav_fpath = out_dir.joinpath("audio", f"audio-{sub_basename}.npy")
wav, text = _split_on_silences(wav_fpath, words, hparams)

应该是wav_fpath没保存.npy的数据,我猜这里应该是先load代码for wav_fpath in wav_fpath_list:中的wav_fpath吧,读出来wav数据,再转换成npy吧

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in models/synthesizer/preprocess_audio.py at preprocess_general and compare the source path from speaker_dir.glob with the reassigned wav_fpath passed to _split_on_silences. Reproduce the FileNotFoundError and trace which path the helper expects. Done means preprocessing no longer tries to read the generated .npy path as the source audio and completes without this error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
audio-video-rtc, machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.