Debugging

main
Drew Bednar 12 months ago
parent 4e7cd1b366
commit f0e13acc36

3
.gitignore vendored

@ -60,3 +60,6 @@ target/
# Pycharm # Pycharm
.idea .idea
#
output/

@ -12,6 +12,9 @@ classifiers = [
] ]
dynamic = ["readme", "dependencies"] dynamic = ["readme", "dependencies"]
[tool.setuptools]
packages = ["split_it"]
[tool.setuptools.dynamic] [tool.setuptools.dynamic]
readme = {file = ["README.md"], content-type = "text/markdown"} readme = {file = ["README.md"], content-type = "text/markdown"}
dependencies = {file = ["requirements.txt"]} dependencies = {file = ["requirements.txt"]}
@ -20,6 +23,9 @@ dependencies = {file = ["requirements.txt"]}
requires = ["setuptools"] requires = ["setuptools"]
build-backend = "setuptools.build_meta" build-backend = "setuptools.build_meta"
[project.scripts]
split-it = "split_it.cli:main"
[tool.isort] [tool.isort]
profile = "black" profile = "black"
line_length = 120 line_length = 120

@ -1,2 +1,3 @@
pydub pydub
simpleaudio
tqdm tqdm

@ -6,5 +6,7 @@
# #
pydub==0.25.1 pydub==0.25.1
# via -r requirements.in # via -r requirements.in
simpleaudio==1.0.4
# via -r requirements.in
tqdm==4.66.1 tqdm==4.66.1
# via -r requirements.in # via -r requirements.in

@ -12,6 +12,7 @@ def save_chunk(chunk, start_time, output_dir, output_format):
def merge_short_chunks(chunks, min_chunk_length_ms): def merge_short_chunks(chunks, min_chunk_length_ms):
merged_chunks = [] merged_chunks = []
current_chunk = chunks[0] current_chunk = chunks[0]
@ -40,7 +41,9 @@ def split_audio(
# Split the audio file based on silence # Split the audio file based on silence
min_silence_len = silence_min_len min_silence_len = silence_min_len
silence_thresh = silence_threshold silence_thresh = silence_threshold
chunks = split_on_silence(audio, min_silence_len=min_silence_len, silence_thresh=silence_thresh) chunks = split_on_silence(
audio, min_silence_len=min_silence_len, silence_thresh=silence_thresh, keep_silence=200
)
# Merge adjacent chunks shorter than the specified length # Merge adjacent chunks shorter than the specified length
chunks = merge_short_chunks(chunks, chunk_length_ms) chunks = merge_short_chunks(chunks, chunk_length_ms)
@ -112,7 +115,7 @@ def main():
"--silence_threshold", type=int, default=-40, help="Threshold in dB for silence based splitting." "--silence_threshold", type=int, default=-40, help="Threshold in dB for silence based splitting."
) )
parser.add_argument( parser.add_argument(
"--silence_min_len", type=int, default=400, help="Minimum length of silence in milliseconds for splitting." "--silence_min_len", type=int, default=1000, help="Minimum length of silence in milliseconds for splitting."
) )
# Parse the arguments # Parse the arguments

Loading…
Cancel
Save