mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
fix: set audio channels
This commit is contained in:
parent
dd6eee6e26
commit
0724fde7da
|
|
@ -150,6 +150,7 @@ def any_to_amr(any_path, amr_path):
|
|||
raise NotImplementedError("Not support file type: {}".format(any_path))
|
||||
audio = AudioSegment.from_file(any_path)
|
||||
audio = audio.set_frame_rate(8000) # only support 8000
|
||||
audio = audio.set_channels(1)
|
||||
audio.export(amr_path, format="amr")
|
||||
return audio.duration_seconds * 1000
|
||||
|
||||
|
|
@ -165,6 +166,7 @@ def any_to_mp3(any_path, mp3_path):
|
|||
sil_to_wav(any_path, any_path)
|
||||
any_path = mp3_path
|
||||
audio = AudioSegment.from_file(any_path)
|
||||
audio = audio.set_channels(1)
|
||||
audio.export(mp3_path, format="mp3")
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue