Skip to main content

Crate ffcine_audio

Crate ffcine_audio 

Source
Expand description

Audio (roadmap step 6, docs/design.md#roadmap; usage in docs/audio.md): one audio graph rendered per timeline, not per shot, with no GPU.

  • sync: lines up timecode-less recorder WAVs (Zoom H2essential) with the camera clips’ scratch audio by cross-correlation, with drift, and writes them as audio clips.
  • schema: ffcine.audio.clean/1 (high-pass, wind, de-click, denoise, dialogue polish via libavfilter), ffcine.audio.level/1 (R128 levelling, gain, ducking, fades) and buses.
  • mix: render_audio mixes the timeline’s audio tracks into dialogue, music, ambience and SFX buses (music ducked under dialogue), then a master at -14 LUFS under a 4x oversampled true-peak limiter. stream_audio is the same mix through scratch files, with memory bounded however long the timeline.
use ffcine_audio::{MixOptions, render_audio};
use ffcine_timeline::Timeline;

let tl = Timeline::from_file("edit.otio")?;
let mix = render_audio(&tl, &MixOptions::default())?;
mix.master.write_wav("mix.wav".as_ref())?;

Re-exports§

pub use beats::Beats;
pub use buffer::Audio;
pub use mix::ClipDefaults;
pub use mix::Master;
pub use mix::Mix;
pub use mix::MixOptions;
pub use mix::StreamedMix;
pub use mix::render_audio;
pub use mix::sources;
pub use mix::stream_audio;
pub use mix::write_mix;
pub use schema::Bus;
pub use schema::Clean;
pub use schema::Denoise;
pub use schema::Level;
pub use schema::LevelMode;
pub use schema::SyncInfo;
pub use sync::ClipSync;
pub use sync::Match;
pub use sync::SyncOptions;
pub use sync::WriteOptions;
pub use sync::sync_files;
pub use sync::write_timeline;

Modules§

beats
Music beats for cut snapping (docs/audio.md#beats): librosa’s beat_track as the prototype ran it (pipeline/audio.py beats()), on mono 22.05 kHz.
buffer
Planar f32 sample buffers and WAV I/O.
decode
Loading media audio: a time range of any file, resampled to the mix rate, optionally through a libavfilter chain (the clean chain). With the ffmpeg feature everything goes through libav*; without it only WAV loads, and filter chains are refused.
dsp
Small DSP kit: windowed-sinc resampling, FFT cross-correlation, biquads, the 4x true-peak estimate, a lookahead limiter and a reverb.
mix
The per-timeline mix, after the prototype’s build_mix: every audio clip loaded (clean chain applied), drift-corrected, R128-levelled, faded and summed into its bus; music ducked under dialogue and punchline SFX, ambience a little under dialogue; buses summed to the master, brought to the target loudness under a 4x-oversampled true-peak limiter.
place
Where each clip of a track lands on the timeline, in seconds, with transitions turned into overlaps (OTIO: the outgoing clip runs out_offset past the cut, the incoming one starts in_offset before it).
schema
The audio metadata schemas (docs/audio.md): ffcine.audio.clean/1, ffcine.audio.level/1 (clip effects), ffcine.audio.sync/1 (clip metadata written by ffcine sync) and the track bus.
spool
Scratch sample files: what keeps the mix out of RAM. Buses, the sum and the master are sparse files (a bus with few clips stays small), read and written in CHUNKs.
sync
Recorder sync: lines up long, timecode-less recorder WAVs (Zoom H2essential) with the camera clips’ scratch audio by cross-correlation.