Update app.py
Browse files
app.py
CHANGED
@@ -16,7 +16,7 @@ from pydub import AudioSegment
|
|
16 |
default_voice_short= ""
|
17 |
check1 = False # set global variable to check to see if process_text is begin of transcript line or not.
|
18 |
|
19 |
-
def strip_silence(audio: AudioSegment, silence_thresh=-40, min_silence_len=100, silence_padding_ms=
|
20 |
from pydub.silence import detect_nonsilent
|
21 |
# Detect non-silent regions
|
22 |
nonsilent = detect_nonsilent(audio, min_silence_len=min_silence_len, silence_thresh=silence_thresh)
|
@@ -30,7 +30,7 @@ def strip_silence(audio: AudioSegment, silence_thresh=-40, min_silence_len=100,
|
|
30 |
# Ensure the padding doesn't exceed the trimmed boundaries
|
31 |
start_trim = max(0, start_trim - silence_padding_ms) # Ensure no negative start
|
32 |
if not check1:
|
33 |
-
silence_padding_ms=
|
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 |
return audio[start_trim:end_trim]
|
|
|
16 |
default_voice_short= ""
|
17 |
check1 = False # set global variable to check to see if process_text is begin of transcript line or not.
|
18 |
|
19 |
+
def strip_silence(audio: AudioSegment, silence_thresh=-40, min_silence_len=100, silence_padding_ms=50):
|
20 |
from pydub.silence import detect_nonsilent
|
21 |
# Detect non-silent regions
|
22 |
nonsilent = detect_nonsilent(audio, min_silence_len=min_silence_len, silence_thresh=silence_thresh)
|
|
|
30 |
# Ensure the padding doesn't exceed the trimmed boundaries
|
31 |
start_trim = max(0, start_trim - silence_padding_ms) # Ensure no negative start
|
32 |
if not check1:
|
33 |
+
silence_padding_ms=30
|
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 |
return audio[start_trim:end_trim]
|