Skip to main content

Module tf_surface_edit

Module tf_surface_edit 

Source
Expand description

P7.6 — Audio edits as geometric surface operations. P7.6 — Audio edits as geometric surface operations on the time-frequency surface.

Each edit is a geometric transformation of the TfSurface raster:

  • Gain: scale magnitude in a rectangular region (affine scale in z).
  • Cut/paste: copy a rectangular patch of the surface to another location (translation in the time-frequency plane).
  • Time-stretch: resample the surface along the time axis (affine scale in u).
  • Pitch-shift: resample along the frequency axis (affine scale in v).
  • Crossfade: blend two surfaces with a weight ramp (linear blend of two height fields).
  • Spectral gate: zero out bins below a threshold (clipping plane in z).

All operations write to caller-supplied buffers. Deterministic.

Structs§

Region
A rectangular region in the time-frequency plane.

Enums§

SurfaceEditError

Functions§

apply_gain
Apply a gain (scalar multiplication) to a region of the surface. out must be at least frame_count * bin_count.
copy_patch
Copy a rectangular patch from src to a destination offset in out. out must be at least frame_count * bin_count.
crossfade
Crossfade: blend two surfaces with weight t (0 = surface_a, 1 = surface_b). Both surfaces must have the same dimensions.
fade_in
Fade in: ramp gain from 0 to 1 over the first fade_frames frames.
fade_out
Fade out: ramp gain from 1 to 0 over the last fade_frames frames.
pitch_shift
Pitch-shift by resampling along the frequency axis. factor > 1.0 shifts up, factor < 1.0 shifts down. out must be at least frame_count * bin_count.
spectral_gate
Spectral gate: zero out all bins below threshold in the region.
time_stretch
Time-stretch by resampling along the time axis. factor > 1.0 stretches, factor < 1.0 compresses. out must be at least new_frame_count * bin_count where new_frame_count = round(frame_count * factor).