I want to merge two audio files (wav format) together, but can't seem to get it right.
def wav_2x():
for _ in range(2):
print(files[np.random.randint(20000)])
When run, I get, for example:
/content/drive/MyDrive/Data/MLEnd/training/Training/0006606.wav
/content/drive/MyDrive/Data/MLEnd/training/Training/0007514.wav
Is there a way I can merge these two together into one audio file?
Thanks in advance :)
You can try pydub.
Install
pip3 install pydub
Example
# pydub example
from pydub import AudioSegment
audio_one = AudioSegment.from_file("0006606.wav")
audio_two = AudioSegment.from_file("0007514.wav")
merged = audio_one + audio_two
Original Example: http://pydub.com/