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, ImplicitlyDestructible, Movable

SincInterpolator Parameters

Name Type Default Description
ripples Int 4 Number of ripples in the sinc function, affecting interpolation quality.
power Int 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[num_chans: Int, bWrap: Bool = True, mask: Int = 0](self, data: Span[SIMD[DType.float64, num_chans], origin], current_index: Float64, prev_index: Float64) -> SIMD[DType.float64, num_chans]

fn sinc_interp Parameters

Name Type Default Description
num_chans Int The number of channels in the audio data.
bWrap Bool True 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 Span 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 : SIMD


Documentation generated with mojo doc from Mojo version 0.26.1.0