RVC-Project / RVC-Project/Retrieval-based-Voice-Conversion-WebUI

[Proposed fix] A fix for double file extensions

Open
#2,758 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
38.4k
Forks
5.3k
PR merge metrics
No merged PRs in 30d

Description

Hello, I am new to GitHub so I apologize if this isn't formatted perfectly, But, I have found that by default, the WebUI will name the output files "song.wav.wav" if the input file is already a wav. This can potentially cause huge issues for certain softwares that need filenames to be exact and completely unaltered. The added extra "wav" essentially renders the files completely unreadable for those softwares. Therefore, I propose a fix that I have discovered, and it is in the "infer/modules/vc" directory, inside the "modules.py" file.

Essentially, if the end of the file has this code:

            if "Success" in info:
                try:
                    tgt_sr, audio_opt = opt
                    clean_name = os.path.splitext(os.path.basename(path))[0]
                    
                    if format1 in ["wav", "flac"]:
                        sf.write(
                            "%s/%s.%s" % (opt_root, clean_name, format1),
                            audio_opt,
                            tgt_sr,
                        )
                    else: 
                        save_path = "%s/%s.%s" % (
                            opt_root,
                            clean_name,
                            format1,
                        )
                        with BytesIO() as wavf:
                            sf.write(wavf, audio_opt, tgt_sr, format="wav")
                            wavf.seek(0, 0)
                            with open(save_path, "wb") as outf:
                                wav2(wavf, outf, format1)
                except:
                    info += traceback.format_exc()
            infos.append("%s->%s" % (os.path.basename(path), info))
            yield "\n".join(infos)
        yield "\n".join(infos)
    except:
        yield traceback.format_exc()

instead of the current version's original code, then the WebUI RVC will successfully only produce single file extensions instead of duplicating them. This fix took me many hours to figure out and I've found it to be very useful.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in infer/modules/vc/modules.py and inspect the output-file naming path described in the issue. Reproduce the WebUI conversion with an input filename that already ends in .wav, then verify that generated WAV and FLAC outputs contain only one extension.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
audio-video-rtc
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.