INNER CODE UNIT · Python

duration_ms

flashlight/wav2letter · data/mls/prepare.py:53

                duration_ms = (float(cols[3]) - float(cols[2])) * 1000
                durations[cols[0]] = "{:.2f}".format(duration_ms)

        with open(list_out_path, "w") as fo:
            with open(transcripts_path) as fi:
                for line in fi:
                    handle, transcript = line.split("\t")
                    speaker, book, idx = handle.split("_")
                    audio_file = os.path.join(
                        audio_path, speaker, book, f"{handle}.flac"
                    )
                    assert os.path.exists(audio_file)
                    fo.write(
                        handle
                        + "\t"
                        + audio_file
                        + "\t"
                        + durations[handle]

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…