Created
December 13, 2023 11:45
-
-
Save 7m4mon/afa827d643ceee59fbfc0a3916f754fa to your computer and use it in GitHub Desktop.
フォルダ内のwavファイルを連結して保存する
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
# フォルダ内のwavファイルを連結して保存する | |
import glob | |
from pydub import AudioSegment | |
files = glob.glob("C:/tmp/*.wav") | |
sound = AudioSegment.empty() | |
for file in files: | |
print(file) | |
# 音声ファイルの読み込み | |
sound1 = AudioSegment.from_file(file, "wav") | |
# 連結 | |
sound += sound1 | |
# 保存 | |
sound.export("./output.wav", format="wav") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment