Spaces:
Runtime error
Runtime error
adding the mixing.py file
#9
by Banuka - opened
mixing.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
from pydub import AudioSegment
|
| 3 |
+
|
| 4 |
+
# Using raw strings to avoid issues with backslashes
|
| 5 |
+
sound1 = AudioSegment.from_wav(r"audio\mixkit-distant-explosion-1690.wav")
|
| 6 |
+
sound2 = AudioSegment.from_wav(r"audio\videoplayback_mastered (1).wav")
|
| 7 |
+
|
| 8 |
+
# mix sound2 with sound1, starting at 1000ms into sound1)
|
| 9 |
+
output = sound1.overlay(sound2, position=1000)
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
# save the result
|
| 13 |
+
output.export(r"mixedAudio\mixed_haptic_audioFile.wav", format="wav")
|
| 14 |
+
|