Tone_Direct

Generates a tone with a given frequency, phase, and magnitude.

Syntax

IppStatus ippsTone_Direct_16s(Ipp16s* pDst, int len, Ipp16s magn, float rFreq, float* pPhase, IppHintAlgorithmhint);

IppStatus ippsTone_Direct_16sc(Ipp16sc* pDst, int len, Ipp16s magn, float rFreq, float* pPhase, IppHintAlgorithmhint);

IppStatus ippsTone_Direct_32f(Ipp32f* pDst, int len, float magn, float rFreq, float* pPhase, IppHintAlgorithmhint);

IppStatus ippsTone_Direct_32fc(Ipp32fc* pDst, int len, float magn, float rFreq, float* pPhase, IppHintAlgorithmhint);

IppStatus ippsTone_Direct_64f(Ipp64f* pDst, int len, double magn, double rFreq, double* pPhase, IppHintAlgorithmhint);

IppStatus ippsTone_Direct_64fc(Ipp64fc* pDst, int len, double magn, double rFreq, double* pPhase, IppHintAlgorithmhint);

Parameters

magn

Magnitude of the tone, that is, the maximum value attained by the wave.

pPhase

Pointer to the phase of the tone relative to a cosine wave. It must be in range [0.0, 2π). The returned value may be used to compute the next continuous data block.

rFreq

Frequency of the tone relative to the sampling frequency. It must be in the interval [0.0, 0.5) for real tone and in [0.0, 1.0) for complex tone.

pDst

Pointer to the array which stores the samples.

len

Number of samples to be computed.

hint

Suggests using specific code. The possible values for the hint argument are described in Hint Arguments.

Description

The function ippsTone_Direct is declared in the ipps.h file. This function generates the tone with the specified frequency rFreq, phase pPhase, and magnitude magn. The function computes len samples of the tone, and stores them in the array pDst. For real tones, each generated value x[n] is defined as:

x[n] = magn * cos(2πn*rFreq + phase)

For complex tones, x[n] is defined as:

x[n] = magn * (cos(2πn*rFreq + phase)+j* sin(2πn*rFreq + phase))

The parameter hint suggests using specific code, which provides for either fast but less accurate calculation, or more accurate but slower execution.

Return Values

ippStsNoErr

Indicates no error.

ippStsNullPtrErr

Indicates an error when the pDst or pPhase pointer is NULL.

ippStsSizeErr

Indicates an error when len is less than or equal to zero.

ippStsToneMagnErr

Indicates an error when magn is less than or equal to zero.

ippStsToneFreqErr

Indicates an error when rFreq is negative, or greater than or equal to 0.5 for real tone and to 1.0 for complex tone.

ippStsTonePhaseErr

Indicates an error when the pPhase value is negative, or greater than or equal to IPP_2PI.

Submit feedback on this help topic

Copyright © 2000 - 2011, Intel Corporation. All rights reserved.