Skip to main content

# SbDerivative

## Overview

Subband derivative

## Discussion

Computes the derivative of frequency domain data individually within each subband. The derivative is defined as:

\$y[n] = K/T * (x[n] - x[n-1])\$ where T is the sample period and K is the optional gain parameter. The module sets the default starting value to x[-1] = 0.

The discrete derivative is similar to the continuous time derivative. For example, if the input is a sine wave at 1 kHz, then the output will be a cosine at 1 kHz scaled by 2*pi*1000.

The hidden internal array .lastValue stores the previous value x[n-1] between blocks. The length of the array is set by the prebuild function to the number of subbands.

## Type Definition

CODE
``````typedef struct _ModuleSbDerivative
{
ModuleInstanceDescriptor instance;            // Common Audio Weaver module instance structure
FLOAT32 gain;                                 // Additional gain.
FLOAT32* lastValue;                           // Previous value x[n-1].
} ModuleSbDerivativeClass;``````

## Variables

### Properties

 Name Type Usage isHidden Default value Range Units gain float parameter 0 1 -10:10 linear lastValue float* state 1 [32 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: sb_derivative_module.m

CODE
`````` M=sb_derivative_module(NAME)
Subband derivative module in which the derivative value of each
subband is separately computed.  The module only operates on real
data and mathematically computes:
y[n] = 1/dt * (x[n] - x[n-1])
where dt is the time step, dt = 1/SR.  The module has a multichannel
input and computes the derivative per channel.  Arguments:
NAME - name of the module.``````

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.