Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::signal::PhaseDistortionOscT< SampleType > Class Template Reference

Phase distortion: a cosine read at a warped phase. More...

#include <phase_distortion.hpp>

Public Member Functions

void set_sample_rate (double sr)
void set_frequency (double hz)
void set_shape (PhaseDistortionShape shape)
void set_amount (double amount)
 How far the phase is warped, 0 (an undistorted cosine) to 1.
void set_resonant_depth (double multiples)
 Highest carrier multiple the resonant shapes reach at full amount.
void reset ()
double phase () const
SampleType process ()

Detailed Description

template<typename SampleType = float>
class pulp::signal::PhaseDistortionOscT< SampleType >

Phase distortion: a cosine read at a warped phase.

The oscillator is always a cosine. What changes is how fast the phase moves through it — slowly through one part of the cycle and quickly through another — and that alone turns a sine into a saw, a pulse, or a resonant sweep. Nothing is filtered and nothing is added, so the output is exactly as band-limited as a cosine is, which is why the technique produced clean bright tones on hardware that could not afford a filter.

The resonant shapes are the distinctive ones and they work differently: the cosine is read at a multiple of the phase, and the result is multiplied by a window that falls once per cycle. The multiple is what sets the apparent resonant peak and the window is what makes it a formant rather than a tone, so sweeping the amount sounds like opening a resonant filter even though no filter exists. That illusion is the reason the technique is worth having alongside a real filter rather than instead of one.

Lineage: Casio's phase-distortion patent, US 4,658,691 (1987, expired). Implemented from the published description of the technique.

RT contract: every member allocates nothing and takes no locks.

Member Function Documentation

◆ phase()

template<typename SampleType = float>
double pulp::signal::PhaseDistortionOscT< SampleType >::phase ( ) const
inline

◆ process()

template<typename SampleType = float>
SampleType pulp::signal::PhaseDistortionOscT< SampleType >::process ( )
inline

◆ reset()

template<typename SampleType = float>
void pulp::signal::PhaseDistortionOscT< SampleType >::reset ( )
inline

◆ set_amount()

template<typename SampleType = float>
void pulp::signal::PhaseDistortionOscT< SampleType >::set_amount ( double amount)
inline

How far the phase is warped, 0 (an undistorted cosine) to 1.

◆ set_frequency()

template<typename SampleType = float>
void pulp::signal::PhaseDistortionOscT< SampleType >::set_frequency ( double hz)
inline

◆ set_resonant_depth()

template<typename SampleType = float>
void pulp::signal::PhaseDistortionOscT< SampleType >::set_resonant_depth ( double multiples)
inline

Highest carrier multiple the resonant shapes reach at full amount.

◆ set_sample_rate()

template<typename SampleType = float>
void pulp::signal::PhaseDistortionOscT< SampleType >::set_sample_rate ( double sr)
inline

◆ set_shape()

template<typename SampleType = float>
void pulp::signal::PhaseDistortionOscT< SampleType >::set_shape ( PhaseDistortionShape shape)
inline

The documentation for this class was generated from the following file: