View Raw SPL
/*****************************************************************************
* *
* MODPM.SPL Copyright (C) 2019 DSP Development Corporation *
* All Rights Reserved *
* *
* Author: Randy Race *
* *
* Synopsis: Phase modulation of an input series *
* *
* Revisions: 10 Jan 2019 RRR Creation *
* *
*****************************************************************************/
#if @HELP_MODPM
MODPM
Purpose: Performs phase modulation of a series.
Syntax: MODPM(s, fc, pdev, p0)
s - the input series
fc - Optional, a real. The center frequency of the phase
modulated result. Defaults to rate(s) / 10.
pdev - Optional, a real. The phase deviation. Defaults to
pi / 2;
p0 - Optional, a real. The initial phase. Defaults to 0.0.
Returns: A series, the phase modulated output.
Example:
W1: gtriwave(1000,.001, 4)
W2: modpm(w1)
W3: demodpm(w2)
The triangle series of W1 is phase modulated between
0 and pi/2 radians in W2. W3 recovers the modulated
series.
Example:
W1: gtriwave(1000,.001, 4)
W2: modpm(w1, 200, pi/3, pi/20)
W3: demodpm(w2, 200, pi/3, pi/20)
Same as above except the series is phase modulated at a center
frequency of 200 Hz between 0 and pi/3 radians with an initial
phase of pi/20 radians.
Remarks:
The center frequency, fc, should be less than rate(s) / 2.
See DEMODPM to demodulate a phase modulated series.
See Also:
Modam
Modfm
Demodam
Demodfm
Demodpm
Gsweep
Specgram
#endif
/* phase modulate a series */
ITERATE modpm(s, fc, pdev, p0)
{
local pm;
if (argc < 4)
{
if (argc < 3)
{
if (argc < 2)
{
if (argc < 1) error("modpm - input series required");
fc = rate(s) / 10;
}
pdev = pi / 2;
}
p0 = 0;
}
pm = cos(2 * pi * fc * xvals(s) + s * pdev + p0);
return(pm);
}