Skip to content

Commit 0724fde

Browse files
committed
fix: set audio channels
1 parent dd6eee6 commit 0724fde

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

apps/common/util/common.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ def any_to_amr(any_path, amr_path):
150150
raise NotImplementedError("Not support file type: {}".format(any_path))
151151
audio = AudioSegment.from_file(any_path)
152152
audio = audio.set_frame_rate(8000) # only support 8000
153+
audio = audio.set_channels(1)
153154
audio.export(amr_path, format="amr")
154155
return audio.duration_seconds * 1000
155156

@@ -165,6 +166,7 @@ def any_to_mp3(any_path, mp3_path):
165166
sil_to_wav(any_path, any_path)
166167
any_path = mp3_path
167168
audio = AudioSegment.from_file(any_path)
169+
audio = audio.set_channels(1)
168170
audio.export(mp3_path, format="mp3")
169171

170172

0 commit comments

Comments
 (0)