Skip to content

Wrong timestamp information in segment #366

Description

@yujonglee

Problem

@ealmloff I think the timestamps are currently relative to the voice audio detection chunk instead of the source audio

duration: 30.0, elapsed_time: 17.0649725s, remaining_time: 60s, sample_range: 0..480000, text:  maybe thi

duration: 30.0, elapsed_time: 34.5724935s, remaining_time: 45s, sample_range: 480000..960000, text:  like one,

duration: 30.0, elapsed_time: 51.340608208s, remaining_time: 30s, sample_range: 960000..1440000, text:  going on

duration: 30.0, elapsed_time: 60.117103167s, remaining_time: 15s, sample_range: 1440000..1920000, text:  years of

duration: 30.0, elapsed_time: 66.8509345s, remaining_time: 0ns, sample_range: 1920000..1936384, text:  Thank you

duration: 30.0, elapsed_time: 8.688271917s, remaining_time: 6s, sample_range: 0..480000, text:  like that

duration: 30.0, elapsed_time: 15.420485042s, remaining_time: 0ns, sample_range: 480000..502272, text:  Thank you

Steps To Reproduce

let mut stream = audio_source.transcribe(model).timestamped();

while let Some(segment) = stream.next().await {
    let duration = segment.duration();
    let elapsed_time = segment.elapsed_time();
    let remaining_time = segment.remaining_time();
    let sample_range = segment.sample_range();
    let text = segment.text()[..10].to_string();

    println!("duration: {:?}, elapsed_time: {:?}, remaining_time: {:?}, sample_range: {:?}, text: {}\n", duration, elapsed_time, remaining_time, sample_range, text);
}

Expected behavior

Timestmap information should be continuous.

Environment:

  • Crate version: [Kalosm main]
  • Rust version: [e.g. 1.43.0, nightly]
  • OS info: [e.g. Windows, Linux, macOS]

Questionnaire

  • I'm interested in fixing this myself but don't know where to start
  • I would like to fix and I have a solution
  • I don't have time to fix this right now, but maybe later

Metadata

Metadata

Assignees

No one assigned

    Labels

    KalosmRelated to the Kalosm librarybugSomething isn't workingsound

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions