Skip to content

Commit

Permalink
fix: fix audio resampled to 22kHz (#130)
Browse files Browse the repository at this point in the history
  • Loading branch information
34j authored Mar 26, 2023
1 parent 38d9744 commit 4203f37
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/so_vits_svc_fork/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
from logging import getLogger
from pathlib import Path

import librosa
import PySimpleGUI as sg
import sounddevice as sd
import soundfile as sf
import torch
from pebble import ProcessFuture, ProcessPool
from tqdm.tk import tqdm_tk
Expand All @@ -24,7 +24,7 @@
def play_audio(path: Path | str):
if isinstance(path, Path):
path = path.as_posix()
data, sr = librosa.load(path)
data, sr = sf.read(path)
sd.play(data, sr)


Expand Down
3 changes: 2 additions & 1 deletion src/so_vits_svc_fork/preprocess_resample.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import librosa
import numpy as np
import soundfile
import soundfile as sf
from joblib import Parallel, delayed
from tqdm_joblib import tqdm_joblib

Expand Down Expand Up @@ -58,7 +59,7 @@ def preprocess_one(input_path: Path, output_path: Path) -> None:
"""Preprocess one audio file."""

try:
audio, sr = librosa.load(input_path)
audio, sr = sf.read(input_path)

# Audioread is the last backend it will attempt, so this is the exception thrown on failure
except audioread.exceptions.NoBackendError as e:
Expand Down
3 changes: 2 additions & 1 deletion src/so_vits_svc_fork/preprocess_split.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from pathlib import Path

import librosa
import soundfile
import soundfile as sf
from joblib import Parallel, delayed
from tqdm import tqdm
Expand All @@ -19,7 +20,7 @@ def _process_one(
hop_seconds: float = 0.1,
):
try:
audio, sr = librosa.load(input_path)
audio, sr = sf.read(input_path)
except Exception as e:
LOG.warning(f"Failed to read {input_path}: {e}")
return
Expand Down

0 comments on commit 4203f37

Please sign in to comment.