conversation.rs

crates/veilvoice-cli/src/conversation.rs

veilvoice-cli · 1090 lines · read the source here · or on GitHub

veilvoice conversation -- several speakers, a voice each, and subtitles.

The command-line front end to veilvoice_conversation. That crate holds the plan, the renderer and the honest account of what a conversation keeps; this file reads the audio, writes the results and prints what happened.

What comes out

Three files beside the output you name:

out.veiled.wav   the audio, one destination voice per speaker
out.veiled.vtt   subtitles for a browser
out.veiled.srt   subtitles for everything else
out.veiled.html  with `--page`: a player that needs nothing installed

The page, and why it is not a video

--page writes a self-contained HTML player: the waveform, a circle per speaker that lights when they speak, and the subtitles. It references the audio and the WebVTT track by relative name rather than embedding them, so the files move together and the page does not double the size of a recording already sitting beside it.

A video file needs an encoder, and this project ships no codec. preview prints the ffmpeg command that would make one, and says whether ffmpeg is on this machine -- it never runs it. Nothing here silently depends on a program the user did not know they were running.

The subtitles are written whether or not anybody wrote down the words. With every voice replaced, a caption track saying who is talking is often the only way to follow a recording at all.

The one warning this command will not let you miss

Audio no turn claims is silenced, never passed through. A gap in the plan is a span nobody assigned to a speaker, so it has not been veiled, and putting it into the result would place a real voice inside a file whose whole purpose is that it contains none. The amount is printed, loudly, because a plan with a hole in it is something to fix rather than something to discover later.

This does not encrypt what it writes

Unlike anonymise, which seals its output at rest by default. A conversation render produces a set of files -- audio and two subtitle tracks -- and the container this project uses seals one thing. Rather than invent a half-answer, the files are written in the clear and the command says so: veilvoice encrypt seals the audio afterwards, and the subtitles hold whatever names were typed and are not veiled by anything.

In plain words

The command line for recordings with several people in them: a voice each, subtitles, a picture, and the command that would turn it into a video.

All the actual work lives in the shared crate; this is the part that reads what you typed, prints what it is about to do, and reports what it wrote.

WHAT THIS FILE CONTAINS

1090 lines defining 10 functions (5 public), 1 type and 1 constant. Everything below is read out of the source, so it cannot disagree with the code.

The types it owns.

  • enum Fix line 85 · One correction to make to a plan.

What happens when it runs. These are the ways in: public, and nothing else in this file calls them, so they are what an outside caller reaches first.

  • fix line 115 · Correct a plan in place, and say exactly what changed.
    reaches describe, load_plan
  • look_from line 254 · Turn the picture flags into a Look, or explain why they do not describe a picture that can be drawn.
  • inspect line 302 · Show a plan without rendering anything.
    reaches load_plan
  • run line 365 · Render a recording according to a plan.
    reaches file_name, load_plan, with_extension, write_private
  • preview line 558 · A still of what the page will look like, and the command that would make a video of it.
    reaches load_plan, with_extension, write_private

WHAT CALLS WHAT

fix line 115 describe line 231 look_from line 254 inspect line 302 run line 365 preview line 558 file_name line 702 load_plan line 709 write_private line 725 with_extension line 730 entry: a way in: public, and nothing in this file calls it helper: private to this file dashed: a call that goes back up, or across a wrapped rank The functions this file defines, and the calls between them. An edge means the callee's name appears, called, inside the caller's body. This is a syntactic reading, not a type-resolved one.

The functions this file defines, and the calls between them. An edge means the callee's name appears, called, inside the caller's body. This is a syntactic reading, not a type-resolved one.

The same graph as Mermaid source
%%{init: {"theme":"base","themeVariables":{"background":"#1a1b26","primaryColor":"#1f2335","primaryTextColor":"#c0caf5","primaryBorderColor":"#7aa2f7","secondaryColor":"#16161e","tertiaryColor":"#16161e","lineColor":"#737aa2","textColor":"#c0caf5","mainBkg":"#1f2335","nodeBorder":"#7aa2f7","clusterBkg":"#16161e","clusterBorder":"#2f3549","fontFamily":"ui-monospace, SFMono-Regular, Consolas, monospace","fontSize":"14px"}}}%%
flowchart TD
    n_fix(["fix<br/>line 115"])
    n_describe["describe<br/>line 231"]
    n_look_from(["look_from<br/>line 254"])
    n_inspect(["inspect<br/>line 302"])
    n_run(["run<br/>line 365"])
    n_preview(["preview<br/>line 558"])
    n_file_name["file_name<br/>line 702"]
    n_load_plan["load_plan<br/>line 709"]
    n_write_private["write_private<br/>line 725"]
    n_with_extension["with_extension<br/>line 730"]
    n_fix --> n_describe
    n_fix --> n_load_plan
    n_inspect --> n_load_plan
    n_preview --> n_load_plan
    n_preview --> n_with_extension
    n_preview --> n_write_private
    n_run --> n_file_name
    n_run --> n_load_plan
    n_run --> n_with_extension
    n_run --> n_write_private
    click n_fix href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/conversation.rs#L115" "open the source"
    click n_describe href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/conversation.rs#L231" "open the source"
    click n_look_from href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/conversation.rs#L254" "open the source"
    click n_inspect href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/conversation.rs#L302" "open the source"
    click n_run href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/conversation.rs#L365" "open the source"
    click n_preview href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/conversation.rs#L558" "open the source"
    click n_file_name href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/conversation.rs#L702" "open the source"
    click n_load_plan href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/conversation.rs#L709" "open the source"
    click n_write_private href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/conversation.rs#L725" "open the source"
    click n_with_extension href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/conversation.rs#L730" "open the source"
    classDef entry fill:#1f2335,stroke:#7aa2f7,color:#c0caf5
    class n_fix,n_look_from,n_inspect,n_run,n_preview entry
    classDef helper fill:#1f2335,stroke:#bb9af7,color:#c0caf5
    class n_describe,n_file_name,n_load_plan,n_write_private,n_with_extension helper

This site loads no third-party script, so it cannot run Mermaid; the diagram above is the same nodes and edges drawn by the generator instead. GitHub renders the source below directly.

ITEMS

ItemLineDocumentation
WAVE_COLUMNS const78How many columns of waveform to reduce a recording to.
Fix pub enum85One correction to make to a plan.
fix pub fn115Correct a plan in place, and say exactly what changed.
describe fn231Every span as speaker, start to end, for reporting what a change replaced.
look_from pub fn254Turn the picture flags into a Look, or explain why they do not describe a picture that can be drawn.
inspect pub fn302Show a plan without rendering anything.
run pub fn365Render a recording according to a plan.
preview pub fn558A still of what the page will look like, and the command that would make a video of it.
file_name fn702The last component of a path, for writing into a page as a relative link.
load_plan fn709Read a plan, and say where it went wrong rather than only that it did.
write_private fn725Replace the last extension, keeping any .veiled before it.
with_extension fn730