source_ohr

Generation of a sinusoidal signal through a harmonic oscillator.

Namespace: dsp

Prototype

sptr<Source<float, OHConfig>> source_ohr(float freq)

Parameters

freqNormalized frequency of the exponential (between -0.5 et 0.5).

Returns

Ream data source.

Description

This function returns a data source, which can be called several times (generation of a continuous flow of samples, contrary to sigsin(), which can only generate a fixed number of samples).

The oscillator is based on a standard quadrature one (see source_ohc()), from which we use only the real part (cosinus).

Example

  // Set oscillator frequency = one 40th of the sampling frequency
  soit ol = source_ohr(0.025);
  // Generate 200 samples
  soit x = ol->step(200);
  Figure f;
  f.plot(x);

See also

source_ohc(), sigcos()