spandsp 0.0.6

dds.h File Reference

Go to the source code of this file.

## Macros
#define | DDS_PHASE_RATE(frequency)
#define | DDS_PHASE(angle)

## Functions
float | dds_phase_to_radians (uint32_t phase)
| Convert a 32 bit phase angle to an angle in radians, between 0 and 2*PI.
int32_t | dds_phase_rate (float frequency)
| Find the phase rate value to achieve a particular frequency.
float | dds_frequency (int32_t phase_rate)
| Find the frequency, in Hz, equivalent to a phase rate.
int16_t | dds_scaling_dbm0 (float level)
| Find the scaling factor needed to achieve a specified level in dBm0.
int16_t | dds_scaling_dbov (float level)
| Find the scaling factor needed to achieve a specified level in dBmov.
int16_t | dds_lookup (uint32_t phase)
| Find the amplitude for a particular phase.
int16_t | dds_offset (uint32_t phase_acc, int32_t phase_offset)
| Find the amplitude for a particular phase offset from an accumulated phase.
void | dds_advance (uint32_t *phase_acc, int32_t phase_rate)
| Advance the phase, without returning any new signal sample.
int16_t | dds (uint32_t *phase_acc, int32_t phase_rate)
| Generate an integer tone sample.
int16_t | dds_mod (uint32_t *phase_acc, int32_t phase_rate, int16_t scale, int32_t phase)
| Generate an integer tone sample, with modulation.
complexi_t | dds_lookup_complexi (uint32_t phase)
| Lookup the complex integer value of a specified phase.
complexi_t | dds_complexi (uint32_t *phase_acc, int32_t phase_rate)
| Generate a complex integer tone sample.
complexi_t | dds_complexi_mod (uint32_t *phase_acc, int32_t phase_rate, int16_t scale, int32_t phase)
| Generate a complex integer tone sample, with modulation.
complexi16_t | dds_lookup_complexi16 (uint32_t phase)
| Generate a complex 16 bit integer tone sample.
complexi16_t | dds_complexi16 (uint32_t *phase_acc, int32_t phase_rate)
| Generate a complex 16 bit integer tone sample.
complexi16_t | dds_complexi16_mod (uint32_t *phase_acc, int32_t phase_rate, int16_t scale, int32_t phase)
| Generate a complex 16bit integer tone sample, with modulation.
complexi32_t | dds_complexi32_mod (uint32_t *phase_acc, int32_t phase_rate, int16_t scale, int32_t phase)
| Generate a complex 32 bit integer tone sample, with modulation.
complexi32_t | dds_lookup_complexi32 (uint32_t phase)
| Generate a complex 32 bit integer tone sample.
complexi32_t | dds_complexi32 (uint32_t *phase_acc, int32_t phase_rate)
| Generate a complex 32 bit integer tone sample.
int32_t | dds_phase_ratef (float frequency)
| Find the phase rate equivalent to a frequency, in Hz.
float | dds_frequencyf (int32_t phase_rate)
| Find the frequency, in Hz, equivalent to a phase rate.
float | dds_scaling_dbm0f (float level)
| Find the scaling factor equivalent to a dBm0 value.
float | dds_scaling_dbovf (float level)
| Find the scaling factor equivalent to a dBmov value.
void | dds_advancef (uint32_t *phase_acc, int32_t phase_rate)
| Advance the phase, without returning any new signal sample.
float | ddsf (uint32_t *phase_acc, int32_t phase_rate)
| Generate a floating point tone sample.
float | dds_lookupf (uint32_t phase)
| Lookup the floating point value of a specified phase.
float | dds_modf (uint32_t *phase_acc, int32_t phase_rate, float scale, int32_t phase)
| Generate a floating point tone sample, with modulation.
complexf_t | dds_complexf (uint32_t *phase_acc, int32_t phase_rate)
| Generate a complex floating point tone sample.
complexf_t | dds_lookup_complexf (uint32_t phase_acc)
| Lookup the complex value of a specified phase.
complexf_t | dds_complex_modf (uint32_t *phase_acc, int32_t phase_rate, float scale, int32_t phase)
| Generate a complex floating point tone sample, with modulation.

## Macro Definition Documentation

## ◆ DDS_PHASE

#define DDS_PHASE | ( |  | angle | ) |

Value:
(int32_t) ((uint32_t) (((angle < 0.0f) ? (360.0f + angle) : angle)*65536.0f*65536.0f/360.0f))

## ◆ DDS_PHASE_RATE

#define DDS_PHASE_RATE | ( |  | frequency | ) |

Value:
(int32_t) ((frequency)*65536.0f*65536.0f/SAMPLE_RATE)

## Function Documentation

## ◆ dds()

int16_t dds | ( | uint32_t * | phase_acc,
|  | int32_t | phase_rate )

Generate an integer tone sample.

Parameters

  phase_acc | A pointer to a phase accumulator value.
  phase_rate | The phase increment to be applied.

Returns
  The signal amplitude, between -32767 and 32767.

References dds_lookup().

## ◆ dds_advance()

void dds_advance | ( | uint32_t * | phase_acc,
|  | int32_t | phase_rate )

Advance the phase, without returning any new signal sample.

Parameters

  phase_acc | A pointer to a phase accumulator value.
  phase_rate | The phase increment to be applied.

## ◆ dds_advancef()

void dds_advancef | ( | uint32_t * | phase_acc,
|  | int32_t | phase_rate )

Advance the phase, without returning any new signal sample.

Parameters

  phase_acc | A pointer to a phase accumulator value.
  phase_rate | The phase increment to be applied.

## ◆ dds_complex_modf()

complexf_t dds_complex_modf | ( | uint32_t * | phase_acc,
|  | int32_t | phase_rate,
|  | float | scale,
|  | int32_t | phase )

Generate a complex floating point tone sample, with modulation.

Parameters

  phase_acc | A pointer to a phase accumulator value.
  phase_rate | The phase increment to be applied.
  scale | The scaling factor.
  phase | The phase offset.

Returns
  The complex signal amplitude, between (-1.0, -1.0) and (1.0, 1.0).

## ◆ dds_complexf()

complexf_t dds_complexf | ( | uint32_t * | phase_acc,
|  | int32_t | phase_rate )

Generate a complex floating point tone sample.

Parameters

  phase_acc | A pointer to a phase accumulator value.
  phase_rate | The phase increment to be applied.

Returns
  The complex signal amplitude, between (-1.0, -1.0) and (1.0, 1.0).

## ◆ dds_complexi()

complexi_t dds_complexi | ( | uint32_t * | phase_acc,
|  | int32_t | phase_rate )

Generate a complex integer tone sample.

Parameters

  phase_acc | A pointer to a phase accumulator value.
  phase_rate | The phase increment to be applied.

Returns
  The complex signal amplitude, between (-32767, -32767) and (32767, 32767).

References dds_lookup().

## ◆ dds_complexi16()

complexi16_t dds_complexi16 | ( | uint32_t * | phase_acc,
|  | int32_t | phase_rate )

Generate a complex 16 bit integer tone sample.

Parameters

  phase_acc | A pointer to a phase accumulator value.
  phase_rate | The phase increment to be applied.

Returns
  The complex signal amplitude, between (-32767, -32767) and (32767, 32767).

References dds_lookup().

## ◆ dds_complexi16_mod()

complexi16_t dds_complexi16_mod | ( | uint32_t * | phase_acc,
|  | int32_t | phase_rate,
|  | int16_t | scale,
|  | int32_t | phase )

Generate a complex 16bit integer tone sample, with modulation.

Parameters

  phase_acc | A pointer to a phase accumulator value.
  phase_rate | The phase increment to be applied.
  scale | The scaling factor.
  phase | The phase offset.

Returns
  The complex signal amplitude, between (-32767, -32767) and (32767, 32767).

References dds_lookup().

## ◆ dds_complexi32()

complexi32_t dds_complexi32 | ( | uint32_t * | phase_acc,
|  | int32_t | phase_rate )

Generate a complex 32 bit integer tone sample.

Parameters

  phase_acc | A pointer to a phase accumulator value.
  phase_rate | The phase increment to be applied.

Returns
  The complex signal amplitude, between (-32767, -32767) and (32767, 32767).

References dds_lookup().

## ◆ dds_complexi32_mod()

complexi32_t dds_complexi32_mod | ( | uint32_t * | phase_acc,
|  | int32_t | phase_rate,
|  | int16_t | scale,
|  | int32_t | phase )

Generate a complex 32 bit integer tone sample, with modulation.

Parameters

  phase_acc | A pointer to a phase accumulator value.
  phase_rate | The phase increment to be applied.
  scale | The scaling factor.
  phase | The phase offset.

Returns
  The complex signal amplitude, between (-32767, -32767) and (32767, 32767).

References dds_lookup().

## ◆ dds_complexi_mod()

complexi_t dds_complexi_mod | ( | uint32_t * | phase_acc,
|  | int32_t | phase_rate,
|  | int16_t | scale,
|  | int32_t | phase )

Generate a complex integer tone sample, with modulation.

Parameters

  phase_acc | A pointer to a phase accumulator value.
  phase_rate | The phase increment to be applied.
  scale | The scaling factor.
  phase | The phase offset.

Returns
  The complex signal amplitude, between (-32767, -32767) and (32767, 32767).

References dds_lookup().

## ◆ dds_frequency()

float dds_frequency | ( | int32_t | phase_rate | ) |

Find the frequency, in Hz, equivalent to a phase rate.

Parameters

  phase_rate | The phase rate.

Returns
  The equivalent frequency, in Hz.

## ◆ dds_frequencyf()

float dds_frequencyf | ( | int32_t | phase_rate | ) |

Find the frequency, in Hz, equivalent to a phase rate.

Parameters

  phase_rate | The phase rate.

Returns
  The equivalent frequency, in Hz.

Referenced by v17_rx_carrier_frequency(), v17_rx_restart(), v22bis_rx_carrier_frequency(), v27ter_rx_carrier_frequency(), and v29_rx_carrier_frequency().

## ◆ dds_lookup()

int16_t dds_lookup | ( | uint32_t | phase | ) |

Find the amplitude for a particular phase.

Lookup the integer value of a specified phase.

Parameters

  phase | The desired phase 32 bit phase.

Returns
  The signal amplitude.

Parameters

  phase | The phase accumulator value to be looked up.

Returns
  The signal amplitude, between -32767 and 32767.

Find the amplitude for a particular phase.

Parameters

  phase | The phase accumulator value to be looked up.

Returns
  The signal amplitude, between -32767 and 32767.

Referenced by dds(), dds_complexi(), dds_complexi16(), dds_complexi16_mod(), dds_complexi32(), dds_complexi32_mod(), dds_complexi_mod(), dds_lookup_complexi(), dds_lookup_complexi16(), dds_lookup_complexi32(), dds_mod(), and dds_offset().

## ◆ dds_lookup_complexf()

complexf_t dds_lookup_complexf | ( | uint32_t | phase_acc | ) |

Lookup the complex value of a specified phase.

Parameters

  phase | The phase accumulator value to be looked up.

Returns
  The complex signal amplitude, between (-1.0, -1.0) and (1.0, 1.0).

## ◆ dds_lookup_complexi()

complexi_t dds_lookup_complexi | ( | uint32_t | phase | ) |

Lookup the complex integer value of a specified phase.

Parameters

  phase | The phase accumulator value to be looked up.

Returns
  The complex signal amplitude, between (-32767, -32767) and (32767, 32767).

References dds_lookup().

## ◆ dds_lookup_complexi16()

complexi16_t dds_lookup_complexi16 | ( | uint32_t | phase | ) |

Generate a complex 16 bit integer tone sample.

Parameters

  phase_acc | A pointer to a phase accumulator value.
  phase_rate | The phase increment to be applied.

Returns
  The complex signal amplitude, between (-32767, -32767) and (32767, 32767).

References dds_lookup().

## ◆ dds_lookup_complexi32()

complexi32_t dds_lookup_complexi32 | ( | uint32_t | phase | ) |

Generate a complex 32 bit integer tone sample.

Parameters

  phase_acc | A pointer to a phase accumulator value.
  phase_rate | The phase increment to be applied.

Returns
  The complex signal amplitude, between (-32767, -32767) and (32767, 32767).

References dds_lookup().

## ◆ dds_lookupf()

float dds_lookupf | ( | uint32_t | phase | ) |

Lookup the floating point value of a specified phase.

Parameters

  phase | The phase accumulator value to be looked up.

Returns
  The signal amplitude, between -1.0 and 1.0.

## ◆ dds_mod()

int16_t dds_mod | ( | uint32_t * | phase_acc,
|  | int32_t | phase_rate,
|  | int16_t | scale,
|  | int32_t | phase )

Generate an integer tone sample, with modulation.

Parameters

  phase_acc | A pointer to a phase accumulator value.
  phase_rate | The phase increment to be applied.
  scale | The scaling factor.
  phase | The phase offset.

Returns
  The signal amplitude, between -32767 and 32767.

References dds_lookup().

Referenced by sig_tone_tx().

## ◆ dds_modf()

float dds_modf | ( | uint32_t * | phase_acc,
|  | int32_t | phase_rate,
|  | float | scale,
|  | int32_t | phase )

Generate a floating point tone sample, with modulation.

Parameters

  phase_acc | A pointer to a phase accumulator value.
  phase_rate | The phase increment to be applied.
  scale | The scaling factor.
  phase | The phase offset.

Returns
  The signal amplitude, between -1.0 and 1.0.

Referenced by super_tone_tx().

## ◆ dds_offset()

int16_t dds_offset | ( | uint32_t | phase_acc,
|  | int32_t | phase_offset )

Find the amplitude for a particular phase offset from an accumulated phase.

Parameters

  phase_acc | The accumulated phase.
  phase_offset | The phase offset.

Returns
  The signal amplitude.

References dds_lookup().

## ◆ dds_phase_rate()

int32_t dds_phase_rate | ( | float | frequency | ) |

Find the phase rate value to achieve a particular frequency.

Parameters

  frequency | The desired frequency, in Hz.

Returns
  The phase rate which while achieve the desired frequency.

Referenced by modem_connect_tones_tx_init(), sig_tone_tx_init(), and tone_gen_descriptor_init().

## ◆ dds_phase_ratef()

int32_t dds_phase_ratef | ( | float | frequency | ) |

Find the phase rate equivalent to a frequency, in Hz.

Parameters

  frequency | The frequency, in Hz.

Returns
  The equivalent phase rate.

Referenced by tone_gen_descriptor_init(), v17_tx_init(), v22bis_init(), v22bis_rx_restart(), v22bis_tx_power(), and v27ter_tx_init().

## ◆ dds_phase_to_radians()

float dds_phase_to_radians | ( | uint32_t | phase | ) |

Convert a 32 bit phase angle to an angle in radians, between 0 and 2*PI.

Parameters

  phase | The angle to convert.

Returns
  The angle in radians.

## ◆ dds_scaling_dbm0()

int16_t dds_scaling_dbm0 | ( | float | level | ) |

Find the scaling factor needed to achieve a specified level in dBm0.

Parameters

  level | The desired signal level, in dBm0.

Returns
  The scaling factor.

Referenced by fsk_tx_power(), modem_connect_tones_tx_init(), sig_tone_tx_init(), and tone_gen_descriptor_init().

## ◆ dds_scaling_dbm0f()

float dds_scaling_dbm0f | ( | float | level | ) |

Find the scaling factor equivalent to a dBm0 value.

Parameters

  level | The signal level in dBm0.

Returns
  The equivalent scaling factor.

Referenced by dtmf_tx_set_level(), and tone_gen_descriptor_init().

## ◆ dds_scaling_dbov()

int16_t dds_scaling_dbov | ( | float | level | ) |

Find the scaling factor needed to achieve a specified level in dBmov.

Parameters

  level | The desired signal level, in dBmov.

Returns
  The scaling factor.

## ◆ dds_scaling_dbovf()

float dds_scaling_dbovf | ( | float | level | ) |

Find the scaling factor equivalent to a dBmov value.

Parameters

  level | The signal level in dBmov.

Returns
  The equivalent scaling factor.

## ◆ ddsf()

float ddsf | ( | uint32_t * | phase_acc,
|  | int32_t | phase_rate )

Generate a floating point tone sample.

Parameters

  phase_acc | A pointer to a phase accumulator value.
  phase_rate | The phase increment to be applied.

Returns
  The signal amplitude, between -1.0 and 1.0.