fixed a gain
This commit is contained in:
@@ -4,7 +4,12 @@ import uuid
|
||||
from pathlib import Path
|
||||
from typing import List, Optional
|
||||
|
||||
from .audio_metrics import AudioAnalysisError, analyze_samples, decode_audio_mono
|
||||
from .audio_metrics import (
|
||||
AudioAnalysisError,
|
||||
analyze_samples,
|
||||
decode_audio_mono,
|
||||
refine_sentence_end_ms,
|
||||
)
|
||||
from .config import Settings
|
||||
from .generate_boundaries import ALGORITHM_VERSION, make_entry
|
||||
from .models import SentenceBoundary, SentenceBoundaryDocument
|
||||
@@ -112,15 +117,19 @@ def document_from_transcript(
|
||||
sentence_segments = split_sentences_at_punctuation(transcript.segments)
|
||||
for index, sentence_segment in enumerate(sentence_segments):
|
||||
start_ms = max(previous_end, int(round(sentence_segment.start_seconds * 1000)))
|
||||
raw_end_ms = int(round(sentence_segment.end_seconds * 1000))
|
||||
end_ms = min(
|
||||
duration_ms,
|
||||
int(round(sentence_segment.end_seconds * 1000)) + end_padding_ms,
|
||||
raw_end_ms + end_padding_ms,
|
||||
)
|
||||
if index + 1 < len(sentence_segments):
|
||||
next_start_ms = int(
|
||||
round(sentence_segments[index + 1].start_seconds * 1000)
|
||||
)
|
||||
end_ms = min(end_ms, next_start_ms)
|
||||
end_ms = refine_sentence_end_ms(
|
||||
samples, sample_rate, raw_end_ms=raw_end_ms, padded_end_ms=end_ms
|
||||
)
|
||||
if not sentence_segment.text.strip() or end_ms <= start_ms:
|
||||
continue
|
||||
start_sample = max(0, int(start_ms / 1000 * sample_rate))
|
||||
|
||||
Reference in New Issue
Block a user