Skip to content

Sinc Interpolation

Structs

struct SincInterpolator

Sinc Interpolation of List[Float64]s.

Struct for high-quality audio resampling using sinc interpolation. This struct precomputes a sinc table and provides methods for performing sinc interpolation on audio data with adjustable ripples and table size. It is used in Osc for resampling oscillator signals.

As a user, you won't need to interact with this struct directly. Instead use the ListInterpolator struct.

Traits: AnyType, Copyable, Movable, UnknownDestructibility

SincInterpolator Parameters

Name Type Default Description
ripples Int64 4 Number of ripples in the sinc function, affecting interpolation quality.
power Int64 14 Power of two determining the size of the sinc table (table_size = 2^power).

SincInterpolator Functions

struct SincInterpolator . fn init

fn init Signature

__init__(out self)

fn init Returns : Self

Static Method

This is a static method.

struct SincInterpolator . fn sinc_interp

Perform sinc interpolation on the given data at the specified current index.

fn sinc_interp Signature

sinc_interp[bWrap: Bool = False, mask: Int = 0](self, data: List[Float64], current_index: Float64, prev_index: Float64) -> Float64

fn sinc_interp Parameters

Name Type Default Description
bWrap Bool False Whether to wrap around at the end of the buffer when an index exceeds the buffer length.
mask Int 0 Mask for wrapping indices if bWrap is True.

fn sinc_interp Arguments

Name Type Default Description
data List The audio data (Buffer channel) to interpolate.
current_index Float64 The current fractional index for interpolation.
prev_index Float64 The previous index. Needed to calculate the slope.

fn sinc_interp Returns : Float64


Documentation generated with mojo doc from Mojo version 0.25.6.1