Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -28,9 +28,10 @@ def strip_silence(audio: AudioSegment, silence_thresh=-40, min_silence_len=100,
|
|
| 28 |
end_trim = nonsilent[-1][1]
|
| 29 |
# Add padding before and after the trimmed audio
|
| 30 |
# Ensure the padding doesn't exceed the trimmed boundaries
|
| 31 |
-
|
| 32 |
if not check1:
|
| 33 |
silence_padding_ms=00
|
|
|
|
| 34 |
end_trim = min(len(audio), end_trim + silence_padding_ms) # Ensure end doesn't go past audio length
|
| 35 |
# Return the trimmed and padded audio
|
| 36 |
# Debugging: print input arguments
|
|
|
|
| 28 |
end_trim = nonsilent[-1][1]
|
| 29 |
# Add padding before and after the trimmed audio
|
| 30 |
# Ensure the padding doesn't exceed the trimmed boundaries
|
| 31 |
+
|
| 32 |
if not check1:
|
| 33 |
silence_padding_ms=00
|
| 34 |
+
start_trim = max(0, start_trim - silence_padding_ms) # Ensure no negative start
|
| 35 |
end_trim = min(len(audio), end_trim + silence_padding_ms) # Ensure end doesn't go past audio length
|
| 36 |
# Return the trimmed and padded audio
|
| 37 |
# Debugging: print input arguments
|