mirror of
https://github.com/shinyobjectz/raea.git
synced 2026-12-06 05:33:38 -10:00
Check: a cut past a pause after a whole word isn't the word's tail cut (#358)
The sound pack called any sound at a clip edge within 0.6 s of a word that word's tail or first sound cut, an error. In Dutch run 38 an out point at 8.37 s came 70 ms after "$149." ended: the take fell to its floor for 50 ms, then a sound the transcript missed started, and the cut took 20 ms of it. The word was whole. A clip edge with 30 ms of quiet between it and the word inside the clip is now a warning that names what's cut (a breath, a noise or a missed word), with the same gap to move to. A sound that runs on from the word to the cut is still the word's, an error. Co-authored-by: shinyobjectz <[email protected]>
This commit is contained in:
1 parent
e6d739b16b
commit
f75335d6d1
2 files changed
+35
-1
No files matched your search
@@ -31,6 +31,8 @@ const FLOOR_Q = 0.1
|
||||
const NEAR = 0.4
|
||||
/** sound this close to a word (s) at a cut is the word's, cut; further off it's another sound */
|
||||
const WORD_NEAR = 0.6
|
||||
/** a quiet this long (s) between a word and a cut means the word is whole: the sound at the cut is another one */
|
||||
const APART = 0.03
|
||||
/** lines this far apart (dB) are an error, a warning */
|
||||
const LEVEL_ERROR = 6
|
||||
const LEVEL_WARN = 4
|
||||
@@ -112,6 +114,16 @@ export function nearestGap(l: Levels, t: number, ref: number, words: Word[], ins
|
||||
return null
|
||||
}
|
||||
|
||||
/** whether the take falls quiet (under `under`) for APART in a row between a and b */
|
||||
export function quietBetween(l: Levels, a: number, b: number, under: number): boolean {
|
||||
let run = 0
|
||||
for (let t = a; t <= b + 1e-9; t += 0.01) {
|
||||
run = at(l, t) <= under ? run + 0.01 : 0
|
||||
if (run >= APART - 1e-9) return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
/** the longest a spoken word runs (s): a drawn-out "sooo" is under it */
|
||||
export const WORD_MAX = 2.5
|
||||
|
||||
@@ -191,7 +203,17 @@ export function editPoints(c: Clip, fps: number, words: Word[], l: Levels): Find
|
||||
// sound with no word near it isn't a word cut (12-05, run 12: a cut "5397 ms from" the nearest word was an
|
||||
// error): a laugh, a noise, or speech the transcript missed, for the ear: a warning
|
||||
const off = near ? Math.min(Math.abs(near.start - t), Math.abs(near.end - t)) : Infinity
|
||||
out.push({ level: off <= WORD_NEAR ? "error" : "warn", kind: "edit-on-sound", at: cutAt, says: `${where} lands on sound ${Math.max(0, ref - here).toFixed(0)} dB under the speech${near ? `, ${Math.round(Math.min(Math.abs(near.start - t), Math.abs(near.end - t)) * 1000)} ms from “${near.text}”` : ""}: the word's ${edge === "in" ? "first sound" : "tail"} is cut. ${move[0].toUpperCase()}${move.slice(1)}` })
|
||||
const under = `${where} lands on sound ${Math.max(0, ref - here).toFixed(0)} dB under the speech`
|
||||
const Move = `${move[0].toUpperCase()}${move.slice(1)}`
|
||||
// the word inside the clip is whole when the take falls quiet between it and the cut (12-05, Dutch run 38: "$149."
|
||||
// ended at 8.30 s, the street fell to its floor for 50 ms, and an out point at 8.37 s, 20 ms into a sound the
|
||||
// transcript missed, was called the word's tail cut): what's cut is another sound, for the ear
|
||||
const whole = near && (edge === "out" ? near.end <= t && quietBetween(l, near.end, t, quietUnder(l, ref)) : near.start >= t && quietBetween(l, t, near.start, quietUnder(l, ref)))
|
||||
if (near && whole) {
|
||||
out.push({ level: "warn", kind: "edit-on-sound", at: cutAt, says: `${under}, ${edge === "out" ? "past the pause after" : "ahead of the pause before"} “${near.text}”: the word is whole, and what's cut is a breath, a noise or a word the transcript missed. ${Move}` })
|
||||
continue
|
||||
}
|
||||
out.push({ level: off <= WORD_NEAR ? "error" : "warn", kind: "edit-on-sound", at: cutAt, says: `${under}${near ? `, ${Math.round(off * 1000)} ms from “${near.text}”` : ""}: the word's ${edge === "in" ? "first sound" : "tail"} is cut. ${Move}` })
|
||||
}
|
||||
}
|
||||
return out
|
||||
|
||||
@@ -47,6 +47,18 @@ test("the sound pack's measures", async () => {
|
||||
assert.ok(away.length >= 1 && away.every((x) => x.level === "warn"), JSON.stringify(away))
|
||||
ok("a cut on a sound far from any word is a warning, not a word cut")
|
||||
|
||||
// an out point 70 ms after "next" ends, past 50 ms of street, 20 ms into a sound the transcript missed: the word is
|
||||
// whole (12-05, Dutch run 38, "$149." at 8.30 s and a cut at 8.37 s); the same cut where "next" runs on to it is a tail cut
|
||||
const after: number[] = db.map((x, i) => (i >= 285 && i < 300 ? -24 : x))
|
||||
const whole = editPoints(clip(1.95, 0.92), fps, words, { start: 0, db: after })
|
||||
assert.deepEqual(whole.map((x) => x.level), ["warn"], JSON.stringify(whole))
|
||||
assert.match(whole[0].says, /past the pause after “next”: the word is whole/)
|
||||
const runsOn: number[] = db.map((x, i) => (i >= 280 && i < 300 ? -24 : x))
|
||||
const tail = editPoints(clip(1.95, 0.92), fps, words, { start: 0, db: runsOn })
|
||||
assert.deepEqual(tail.map((x) => x.level), ["error"], JSON.stringify(tail))
|
||||
assert.match(tail[0].says, /the word's tail is cut/)
|
||||
ok("a cut on a sound past a pause after a whole word is a warning; on the word's own tail, an error")
|
||||
|
||||
// "loud" and "next" run together with no pause: a cut on their boundary is tight (a warning), not a cut word
|
||||
const run = [{ text: "say", start: 1.0, end: 1.4 }, { text: "so", start: 1.42, end: 1.7 }, { text: "then", start: 1.72, end: 2.0 }]
|
||||
const runDb: number[] = []
|
||||
|
||||
Reference in new issue
Block a user