Skip to main content

ffcine_audio/
lib.rs

1//! Audio (roadmap step 6, `docs/design.md#roadmap`; usage in `docs/audio.md`): one audio graph
2//! rendered per timeline, not per shot, with no GPU.
3//!
4//! - [`sync`]: lines up timecode-less recorder WAVs (Zoom H2essential) with the camera clips'
5//!   scratch audio by cross-correlation, with drift, and writes them as audio clips.
6//! - [`schema`]: `ffcine.audio.clean/1` (high-pass, wind, de-click, denoise, dialogue polish via
7//!   libavfilter), `ffcine.audio.level/1` (R128 levelling, gain, ducking, fades) and buses.
8//! - [`mix`]: [`render_audio`] mixes the timeline's audio tracks into dialogue, music, ambience
9//!   and SFX buses (music ducked under dialogue), then a master at -14 LUFS under a 4x
10//!   oversampled true-peak limiter. [`stream_audio`] is the same mix through scratch files, with
11//!   memory bounded however long the timeline.
12//!
13//! ```no_run
14//! use ffcine_audio::{MixOptions, render_audio};
15//! use ffcine_timeline::Timeline;
16//!
17//! let tl = Timeline::from_file("edit.otio")?;
18//! let mix = render_audio(&tl, &MixOptions::default())?;
19//! mix.master.write_wav("mix.wav".as_ref())?;
20//! # Ok::<(), ffcine_core::Error>(())
21//! ```
22
23// Sample maths converts between indices, times and gains everywhere; DSP reads best with short
24// names (a, b, k, n, x, y).
25#![allow(
26    clippy::cast_precision_loss,
27    clippy::cast_possible_truncation,
28    clippy::cast_sign_loss,
29    clippy::cast_possible_wrap,
30    clippy::many_single_char_names
31)]
32
33pub mod beats;
34pub mod buffer;
35pub mod decode;
36pub mod dsp;
37pub mod mix;
38pub mod place;
39pub mod schema;
40pub mod spool;
41pub mod sync;
42
43pub use beats::Beats;
44pub use buffer::Audio;
45pub use mix::{
46    ClipDefaults, Master, Mix, MixOptions, StreamedMix, render_audio, sources, stream_audio,
47    write_mix,
48};
49pub use schema::{Bus, Clean, Denoise, Level, LevelMode, SyncInfo};
50pub use sync::{ClipSync, Match, SyncOptions, WriteOptions, sync_files, write_timeline};