Developer World
Spresense Arduino Library v3.2.0-77d75a4
SignalProcessing Library API

API for using SignalProcessing. More...

Classes

class  IIRClass
 Biquad IIR filter class. More...
 

Macros

#define ARM_MATH_CM4
 
#define __FPU_PRESENT   1U
 

Typedefs

typedef enum e_filterType filterType_t
 
typedef enum IIRClass::e_format IIRClass::format_t
 
typedef enum IIRClass::e_error IIRClass::error_t
 

Enumerations

enum  e_filterType { TYPE_LPF , TYPE_HPF , TYPE_BPF , TYPE_BEF }
 
enum  IIRClass::e_format { IIRClass::Interleave , IIRClass::Planar }
 
enum  IIRClass::e_error {
  IIRClass::ERR_OK = 0 , IIRClass::ERR_CH_NUM = -1 , IIRClass::ERR_FORMAT = -2 , IIRClass::ERR_MEMORY = -3 ,
  IIRClass::ERR_FILTER_TYPE = -4 , IIRClass::ERR_FRAME_SIZE = -5 , IIRClass::ERR_BUF_FULL = -6 , IIRClass::ERR_FS = -7
}
 

Functions

bool IIRClass::begin (filterType_t type, int channel, int cutoff, float q, int sample=DEFAULT_FRAMESIZE, format_t output=Planar, int fs=48000)
 Initialize the IIR library. More...
 
bool IIRClass::put (q15_t *pSrc, int size)
 Put input data into the IIR library. More...
 
int IIRClass::get (q15_t *pDst, int channel)
 Get the execution data of each channel. More...
 
int IIRClass::get (q15_t *pDsts)
 Get the execution data of all channels. More...
 
void IIRClass::end ()
 Finalize the IIR library. More...
 
bool IIRClass::empty (int channel)
 Is the buffer empty or not of each channel. More...
 
error_t IIRClass::getErrorCause ()
 Get error information. More...
 

Variables

static const int IIRClass::BITLEN = 16
 
static const int IIRClass::DEFAULT_FRAMESIZE = 768
 
static const int IIRClass::MIN_FRAMESIZE = 240
 
static const int IIRClass::MAX_CHANNEL_NUM = 8
 
static const int IIRClass::INPUT_BUFFER_SIZE = 4
 

Detailed Description

API for using SignalProcessing.

Enumeration Type Documentation

◆ e_filterType

Enumerator
TYPE_LPF 

Low Pass Filter.

TYPE_HPF 

High Pass Filter.

TYPE_BPF 

Band Pass Filter.

TYPE_BEF 

Band Elimination Filter.

◆ e_format

Enumerator
Interleave 

the channel interleave format

Planar 

the channel planar format

◆ e_error

Enumerator
ERR_OK 

No error.

ERR_CH_NUM 

Wrong channel setting.

ERR_FORMAT 

Wrong output format setting.

ERR_MEMORY 

Lack of memory area.

ERR_FILTER_TYPE 

Wrong filter type setting.

ERR_FRAME_SIZE 

Wrong number of samples.

ERR_BUF_FULL 

Failture of write as buffer is full.

ERR_FS 

Wrong sampling rate.

Function Documentation

◆ begin()

bool IIRClass::begin ( filterType_t  type,
int  channel,
int  cutoff,
float  q,
int  sample = DEFAULT_FRAMESIZE,
format_t  output = Planar,
int  fs = 48000 
)

Initialize the IIR library.

Returns
OK(true) or Failure(false)

This function is called only once when using the IIR library.

Parameters
typeThe execution filter type
channelThe number of channels
cutoffThe cutoff frequency(BPF/HPF) or the center frequency(BPF/BEF)
qThe Q value(BPF/HPF) or the bandwidthoctave
sampleThe number of samples in an execution filter(default size is DEFAULT_FRAMESIZE)
outputThe output format(default is Planar)
fsThe Sampling rate

◆ put()

bool IIRClass::put ( q15_t *  pSrc,
int  size 
)

Put input data into the IIR library.

Returns
OK(true) or Failure(false)

Put input data into the IIR library. Multi-channel input data support interleave format.

Parameters
pSrcThe pointer of input data address
sizeThe number of input data sample

◆ get() [1/2]

int IIRClass::get ( q15_t *  pDst,
int  channel 
)

Get the execution data of each channel.

Returns
The size of an execution data sample(Error code when negative numbers)

Get the execution data of each channel. This API can be called only for Planar format.

Parameters
pDstThe pointer of area that output data is written
channelThe each channel number of the execution data

◆ get() [2/2]

int IIRClass::get ( q15_t *  pDsts)

Get the execution data of all channels.

Returns
The size of execution data sample(Error code when negative numbers)

Get the execution data of all channels. This API can be called only for Interleave format.

Parameters
pDstsThe pointer of area that output data is written

◆ end()

void IIRClass::end ( )

Finalize the IIR library.

This function is called when you want to exit the IIR library.

◆ empty()

bool IIRClass::empty ( int  channel)

Is the buffer empty or not of each channel.

Returns
Empty(true) or Not empty(false)

Is the buffer empty or not of each channel.

Parameters
channelThe channel number that you want to check

◆ getErrorCause()

error_t IIRClass::getErrorCause ( )
inline

Get error information.

Returns
Error code[IIRClass::error_t]

When an error occurs, you call this function and get error cause information.

Variable Documentation

◆ BITLEN

const int IIRClass::BITLEN = 16
static

The bit length definition (Only Support 16bit)

◆ DEFAULT_FRAMESIZE

const int IIRClass::DEFAULT_FRAMESIZE = 768
static

The default number of samples in an execution frame

◆ MIN_FRAMESIZE

const int IIRClass::MIN_FRAMESIZE = 240
static

The minimum number of samples in an execution frame

◆ MAX_CHANNEL_NUM

const int IIRClass::MAX_CHANNEL_NUM = 8
static

The Maximum number of channels

◆ INPUT_BUFFER_SIZE

const int IIRClass::INPUT_BUFFER_SIZE = 4
static

The size of input buffer (Multiple of frame size)