From 3c3754dcc7568e76fa7d4b2c4e14849f68cc6ee7 Mon Sep 17 00:00:00 2001
From: 嘉渊 <wangjiaming.wjm@alibaba-inc.com>
Date: 星期日, 28 五月 2023 23:46:01 +0800
Subject: [PATCH] update repo
---
funasr/fileio/sound_scp.py | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/funasr/fileio/sound_scp.py b/funasr/fileio/sound_scp.py
index fc2c3e3..c752fe6 100644
--- a/funasr/fileio/sound_scp.py
+++ b/funasr/fileio/sound_scp.py
@@ -52,11 +52,11 @@
if self.normalize:
# soundfile.read normalizes data to [-1,1] if dtype is not given
array, rate = librosa.load(
- wav, sr=self.dest_sample_rate, mono=not self.always_2d
+ wav, sr=self.dest_sample_rate, mono=self.always_2d
)
else:
array, rate = librosa.load(
- wav, sr=self.dest_sample_rate, mono=not self.always_2d, dtype=self.dtype
+ wav, sr=self.dest_sample_rate, mono=self.always_2d, dtype=self.dtype
)
if self.speed_perturb is not None:
@@ -65,7 +65,10 @@
array, _ = torchaudio.sox_effects.apply_effects_tensor(
torch.tensor(array).view(1, -1), rate,
[['speed', str(speed)], ['rate', str(rate)]])
- array = array.view(-1).numpy()
+ array = array.view(-1).numpy()
+
+ if array.ndim==2:
+ array=array.transpose((1, 0))
return rate, array
--
Gitblit v1.9.1