[Refactor] Remove resampy dependency (#39524)

Signed-off-by: Isotr0py <mozf@mail2.sysu.edu.cn>
This commit is contained in:
Isotr0py
2026-04-16 08:48:17 -07:00
committed by GitHub
parent 3daca38e22
commit 82531edbfb
7 changed files with 3 additions and 37 deletions
+1 -19
View File
@@ -16,11 +16,6 @@ try:
except ImportError:
av = PlaceholderModule("av") # type: ignore[assignment]
try:
import resampy
except ImportError:
resampy = PlaceholderModule("resampy") # type: ignore[assignment]
try:
import scipy.signal as scipy_signal
except ImportError:
@@ -229,15 +224,6 @@ def resample_audio_pyav(
return result[:expected_len]
def resample_audio_resampy(
audio: npt.NDArray[np.floating],
*,
orig_sr: float,
target_sr: float,
) -> npt.NDArray[np.floating]:
return resampy.resample(audio, sr_orig=orig_sr, sr_new=target_sr)
def resample_audio_scipy(
audio: npt.NDArray[np.floating],
*,
@@ -257,7 +243,7 @@ class AudioResampler:
def __init__(
self,
target_sr: float | None = None,
method: Literal["pyav", "resampy", "scipy"] = "resampy",
method: Literal["pyav", "scipy"] = "pyav",
):
self.target_sr = target_sr
self.method = method
@@ -281,10 +267,6 @@ class AudioResampler:
return audio
if self.method == "pyav":
return resample_audio_pyav(audio, orig_sr=orig_sr, target_sr=self.target_sr)
if self.method == "resampy":
return resample_audio_resampy(
audio, orig_sr=orig_sr, target_sr=self.target_sr
)
elif self.method == "scipy":
return resample_audio_scipy(
audio, orig_sr=orig_sr, target_sr=self.target_sr