Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cut segments with sox and ignore files #333

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion analyze.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,8 @@ def analyzeFile(item):
print(f"Analyzing {fpath}", flush=True)

try:
fileLengthSeconds = int(audio.getAudioFileLength(fpath, cfg.SAMPLE_RATE))
fileLengthSeconds = (audio.getAudioFileLength(fpath, cfg.SAMPLE_RATE))
print(f"File length: {fileLengthSeconds} seconds", flush=True)
except Exception as ex:
# Write error log
print(f"Error: Cannot analyze audio file {fpath}. File corrupt?\n", flush=True)
Expand Down
2 changes: 1 addition & 1 deletion config.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

# Define minimum length of audio chunk for prediction,
# chunks shorter than 3 seconds will be padded with zeros
SIG_MINLEN: float = 1.0
SIG_MINLEN: float = 0.001

# Frequency range. This is model specific and should not be changed.
SIG_FMIN: int = 0
Expand Down
2 changes: 1 addition & 1 deletion segments.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,4 +425,4 @@ def extractSegments(item: tuple[tuple[str, list[dict]], float, dict[str]]):

# A few examples to test
# python3 segments.py --audio example/ --results example/ --o example/segments/
# python3 segments.py --audio example/ --results example/ --o example/segments/ --seg_length 5.0 --min_conf 0.1 --max_segments 100 --threads 4
# python3 segments.py --audio example/ --results example/ --o example/segments/ --seg_length 5.0 --min_conf 0.1 --max_segments 100 --threads 4