Document toolboxDocument toolbox

TwoPieceInterpV2

Overview

Two piece interpolation module

Discussion

This module performs interpolation using two line segments with a knee between the two pieces. The parameter threshold specifies the point of intersection of the two lines. The kneeDepth specifies the curvature of the smooth region connecting the two line segments. If kneeDepth is zero, then there is no knee, simply two lines connected to each other at the threshold point. If kneeDepth is nonzero, then the curved region will begin at threshold-kneeDepth and ends at threshold+kneeDepth. The slopeL and slopeH are the slopes of the left hand side line and right hand side line respectively.

Optionally, the slopes of the lines can be specified by their ratio where ratio is defined as 1/slope To use ratios set the constructor argument USERATIOS to 1 and then set the .ratioL and .ratioR fields of the module. When ratios are used the set function converts from ratio to slope. When USERATIOS = 0 then the .ratioL and .ratioR parameters of the module are ignored. In all cases, the processing function uses the slope parameters for calculations. The ratio is useful when using this module within a dynamics processor.

When ratios are used and a ratio equals 0 then the corresponding slope is set to 1e6 (prevent divide by zero).

Type Definition

typedef struct _ModuleTwoPieceInterpV2 { ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure FLOAT32 threshold; // The point at which two line segments meet INT32 useRatios; // Specifies whether the line segments are specified using their slopes (=0) or ratios (=1) FLOAT32 slopeL; // The slope of the line segment on the left hand side FLOAT32 slopeH; // The slope of the line segment on the right hand side FLOAT32 ratioL; // 1/slope of the line segment on the left hand side FLOAT32 ratioH; // 1/slope of the line segment on the right hand side FLOAT32 kneeDepth; // Specifies the curvature of the smooth region connecting the two line segments FLOAT32* polyCoeffs; // Interpolation coefficients returned by the grid control. } ModuleTwoPieceInterpV2Class;

Variables

Properties

Name

Type

Usage

isHidden

Default value

Range

Units

threshold

float

parameter

0

-20

-100:0.1:100

 

useRatios

int

parameter

0

0

0:1

 

slopeL

float

parameter

0

1

-100:100

 

slopeH

float

parameter

0

1

-100:100

 

ratioL

float

parameter

0

1

-100:100

 

ratioH

float

parameter

0

1

-100:100

 

kneeDepth

float

parameter

0

2

0:100

 

polyCoeffs

float*

derived

1

[4 x 1]

Unrestricted

 

Pins

Input Pins

Name: in

Description: audio input

Data type: float

Channel range: Unrestricted

Block size range: Unrestricted

Sample rate range: Unrestricted

Complex support: Real

Output Pins

Name: out

Description: audio output

Data type: float

MATLAB Usage

File Name: two_piece_interp_v2_module.m

M=two_piece_interp_v2_module(NAME, USERATIOS) This Audio Weaver module performs interpolation using two line segments with a knee between the two pieces. This version builds upon the two_piece_interp_module.m and allows lines to be specified either as slopes or ratios (1/slope). Arguments: NAME - name of the module. USERATIOS - Optional boolean allows you to specify the ratio of each line segment rather than the slope. The ratio is defined as 1/slope. Default = 0, which means the slope of the line segments is specified directly.

Â