1.1
This commit is contained in:
1 parent
122c47dd20
commit
bf68444629
11 files changed
+316
-1707
No files matched your search
@@ -7,7 +7,7 @@ class FileHandler:
|
||||
def __init__(self, directory: str):
|
||||
self.dir_path = Path(directory)
|
||||
|
||||
def combine_waves(self, output_file: str):
|
||||
def combine_waves(self, output_file: str, add_silence: float = 0.5):
|
||||
wav_files = sorted(
|
||||
[f for f in self.dir_path.glob("*.wav")], key=lambda f: f.stat().st_mtime
|
||||
)
|
||||
@@ -15,6 +15,8 @@ class FileHandler:
|
||||
for f in wav_files:
|
||||
audio = pydub.AudioSegment.from_wav(str(f))
|
||||
combined += audio
|
||||
if add_silence > 0:
|
||||
combined += pydub.AudioSegment.silent(duration=int(add_silence * 1000))
|
||||
combined.export(output_file, format="wav")
|
||||
|
||||
def wavs_to_mp3(self, wav_file: str, output_file: str):
|
||||
|
||||
Reference in new issue
Block a user