INNER CODE UNIT · Python

idx

flashlight/wav2letter · data/ami/utils.py:25

    idx = hset[-1]
    fn = f"{meetid}.Headset-{idx}.wav"
    infile = os.path.join(apath, meetid, fn)
    assert os.path.exists(infile), f"{infile} doesn't exist"
    new_path = os.path.join(apath, "segments", meetid, key + ".flac")
    sox_tfm = sox.Transformer()
    sox_tfm.set_output_format(
        file_type="flac", encoding="signed-integer", bits=16, rate=16000
    )
    start = float(start)
    end = float(end)
    sox_tfm.trim(start, end)
    sox_tfm.build(infile, new_path)
    sx_dur = sox.file_info.duration(new_path)
    if sx_dur is not None and abs(sx_dur - end + start) < 0.5:
        return [meetid, key, new_path, str(round(sx_dur * 1000, 2)), transcript.lower()]

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…