Intel® Integrated Performance Primitives Developer Guide and Reference

ID 790148
Date 11/07/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

Tone

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

Syntax

IppStatus ippsTone_16s(Ipp16s* pDst, int len, Ipp16s magn, Ipp32f rFreq, Ipp32f* pPhase, IppHintAlgorithm hint);

IppStatus ippsTone_16sc(Ipp16sc* pDst, int len, Ipp16s magn, Ipp32f rFreq, Ipp32f* pPhase, IppHintAlgorithm hint);

IppStatus ippsTone_32f(Ipp32f* pDst, int len, Ipp32f magn, Ipp32f rFreq, Ipp32f* pPhase, IppHintAlgorithm hint);

IppStatus ippsTone_32fc(Ipp32fc* pDst, int len, Ipp32f magn, float rFreq, Ipp32f* pPhase, IppHintAlgorithm hint);

IppStatus ippsTone_64f(Ipp64f* pDst, int len, Ipp64f magn, Ipp64f rFreq, Ipp64f* pPhase, IppHintAlgorithm hint);

IppStatus ippsTone_64fc(Ipp64fc* pDst, int len, Ipp64f magn, Ipp64f rFreq, Ipp64f* pPhase, IppHintAlgorithm hint);

Include Files

ipps.h

Domain Dependencies

Headers: ippcore.h, ippvm.h

Libraries: ippcore.lib, ippvm.lib

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π). You can use the returned value 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 that 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

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.