aubio 0.4.9

Loading...
Searching...
No Matches
Data Structures | Functions
cvec.h File Reference

Vector of complex-valued data, stored in polar coordinates. More...

Go to the source code of this file.

## Data Structures
struct | cvec_t
| Vector of real-valued phase and spectrum data. More...

## Functions
cvec_t * | new_cvec (uint_t length)
| cvec_t buffer creation function
void | del_cvec (cvec_t *s)
| cvec_t buffer deletion function
void | cvec_norm_set_sample (cvec_t *s, smpl_t val, uint_t position)
| write norm value in a complex buffer
void | cvec_phas_set_sample (cvec_t *s, smpl_t val, uint_t position)
| write phase value in a complex buffer
smpl_t | cvec_norm_get_sample (cvec_t *s, uint_t position)
| read norm value from a complex buffer
smpl_t | cvec_phas_get_sample (cvec_t *s, uint_t position)
| read phase value from a complex buffer
smpl_t * | cvec_norm_get_data (const cvec_t *s)
| read norm data from a complex buffer
smpl_t * | cvec_phas_get_data (const cvec_t *s)
| read phase data from a complex buffer
void | cvec_print (const cvec_t *s)
| print out cvec data
void | cvec_copy (const cvec_t *s, cvec_t *t)
| make a copy of a vector
void | cvec_norm_set_all (cvec_t *s, smpl_t val)
| set all norm elements to a given value
void | cvec_norm_zeros (cvec_t *s)
| set all norm elements to zero
void | cvec_norm_ones (cvec_t *s)
| set all norm elements to one
void | cvec_phas_set_all (cvec_t *s, smpl_t val)
| set all phase elements to a given value
void | cvec_phas_zeros (cvec_t *s)
| set all phase elements to zero
void | cvec_phas_ones (cvec_t *s)
| set all phase elements to one
void | cvec_zeros (cvec_t *s)
| set all norm and phas elements to zero
void | cvec_logmag (cvec_t *s, smpl_t lambda)
| take logarithmic magnitude

## Detailed Description

Vector of complex-valued data, stored in polar coordinates.

This file specifies the cvec_t buffer type, which is used throughout aubio to store complex data. Complex values are stored in terms of cvec_t.phas and norm, within 2 vectors of smpl_t of size (size/2+1) each.

Definition in file cvec.h.

## Function Documentation

## ◆ cvec_copy()

void cvec_copy | ( | const cvec_t * | s,
|  | cvec_t * | t )

make a copy of a vector

Parameters

  s | source vector
  t | vector to copy to

Examples
  test-cvec.c.

## ◆ cvec_logmag()

void cvec_logmag | ( | cvec_t * | s,
|  | smpl_t | lambda )

take logarithmic magnitude

Parameters

  s | input cvec to compress
  lambda | value to use for normalisation

\( S_k = log( \lambda * S_k + 1 ) \)

## ◆ cvec_norm_get_data()

smpl_t * cvec_norm_get_data | ( | const cvec_t * | s | ) |

read norm data from a complex buffer

smpl_t *data = s->norm;
smpl_t
float smpl_t
short sample format (32 or 64 bits)
Definition types.h:41

Parameters

  s | vector to read from

Examples
  test-cvec.c.

## ◆ cvec_norm_get_sample()

smpl_t cvec_norm_get_sample | ( | cvec_t * | s,
|  | uint_t | position )

read norm value from a complex buffer

This is equivalent to:

smpl_t foo = s->norm[position];

Parameters

  s | vector to read from
  position | sample position to read from

Examples
  test-cvec.c.

## ◆ cvec_norm_ones()

void cvec_norm_ones | ( | cvec_t * | s | ) |

set all norm elements to one

Parameters

  s | vector to modify

Examples
  test-cvec.c.

## ◆ cvec_norm_set_all()

void cvec_norm_set_all | ( | cvec_t * | s,
|  | smpl_t | val )

set all norm elements to a given value

Parameters

  s | vector to modify
  val | value to set elements to

## ◆ cvec_norm_set_sample()

void cvec_norm_set_sample | ( | cvec_t * | s,
|  | smpl_t | val,
|  | uint_t | position )

write norm value in a complex buffer

This is equivalent to:

s->norm[position] = val;

Parameters

  s | vector to write to
  val | norm value to write in s->norm[position]
  position | sample position to write to

Examples
  test-cvec.c.

## ◆ cvec_norm_zeros()

void cvec_norm_zeros | ( | cvec_t * | s | ) |

set all norm elements to zero

Parameters

  s | vector to modify

Examples
  test-cvec.c.

## ◆ cvec_phas_get_data()

smpl_t * cvec_phas_get_data | ( | const cvec_t * | s | ) |

read phase data from a complex buffer

This is equivalent to:

smpl_t *data = s->phas;

Parameters

  s | vector to read from

Examples
  test-cvec.c.

## ◆ cvec_phas_get_sample()

smpl_t cvec_phas_get_sample | ( | cvec_t * | s,
|  | uint_t | position )

read phase value from a complex buffer

This is equivalent to:

smpl_t foo = s->phas[position];

Parameters

  s | vector to read from
  position | sample position to read from

Returns
  the value of the sample at position

Examples
  test-cvec.c.

## ◆ cvec_phas_ones()

void cvec_phas_ones | ( | cvec_t * | s | ) |

set all phase elements to one

Parameters

  s | vector to modify

Examples
  test-cvec.c.

## ◆ cvec_phas_set_all()

void cvec_phas_set_all | ( | cvec_t * | s,
|  | smpl_t | val )

set all phase elements to a given value

Parameters

  s | vector to modify
  val | value to set elements to

## ◆ cvec_phas_set_sample()

void cvec_phas_set_sample | ( | cvec_t * | s,
|  | smpl_t | val,
|  | uint_t | position )

write phase value in a complex buffer

This is equivalent to:

s->phas[position] = val;

Parameters

  s | vector to write to
  val | phase value to write in s->phas[position]
  position | sample position to write to

Examples
  test-cvec.c.

## ◆ cvec_phas_zeros()

void cvec_phas_zeros | ( | cvec_t * | s | ) |

set all phase elements to zero

Parameters

  s | vector to modify

Examples
  test-cvec.c.

## ◆ cvec_print()

void cvec_print | ( | const cvec_t * | s | ) |

print out cvec data

Parameters

  s | vector to print out

Examples
  spectral/test-fft.c, spectral/test-phasevoc.c, and test-cvec.c.

## ◆ cvec_zeros()

void cvec_zeros | ( | cvec_t * | s | ) |

set all norm and phas elements to zero

Parameters

  s | vector to modify

Examples
  test-cvec.c.

## ◆ del_cvec()

void del_cvec | ( | cvec_t * | s | ) |

cvec_t buffer deletion function

Parameters

  s | buffer to delete as returned by new_cvec()

Examples
  spectral/test-fft.c, spectral/test-filterbank.c, spectral/test-filterbank_mel.c, spectral/test-mfcc.c, spectral/test-phasevoc.c, spectral/test-specdesc.c, spectral/test-tss.c, and test-cvec.c.

## ◆ new_cvec()

cvec_t * new_cvec | ( | uint_t | length | ) |

cvec_t buffer creation function

This function creates a cvec_t structure holding two arrays of size [length/2+1], corresponding to the norm and phase values of the spectral frame. The length stored in the structure is the actual size of both arrays, not the length of the complex and symmetrical vector, specified as creation argument.

Parameters

  length | the length of the buffer to create

Examples
  spectral/test-fft.c, spectral/test-filterbank.c, spectral/test-filterbank_mel.c, spectral/test-mfcc.c, spectral/test-phasevoc.c, spectral/test-specdesc.c, spectral/test-tss.c, and test-cvec.c.