HephAudio v3.0.6
A cross-platform C++ library for recording, playing, and processing audio on Windows, Android, Linux, iOS, and macOS.
Loading...
Searching...
No Matches
HephAudio::Vibrato Class Reference

changes the pitch of the audio data periodically and mixes the result with the input signal. More...

#include <Vibrato.h>

Inheritance diagram for HephAudio::Vibrato:
HephAudio::ModulationEffect HephAudio::DoubleBufferedAudioEffect HephAudio::AudioEffect

Public Member Functions

 Vibrato ()
 
 Vibrato (double depth, double extent, const Oscillator &lfo)
 
virtual ~Vibrato ()=default
 
virtual std::string Name () const override
 
virtual size_t CalculateRequiredFrameCount (size_t outputFrameCount, const AudioFormatInfo &formatInfo) const override
 
virtual void Process (AudioBuffer &buffer, size_t startIndex, size_t frameCount) override
 
virtual double GetExtent () const
 
virtual void SetExtent (double extent)
 
virtual void Process (AudioBuffer &buffer)
 
virtual void Process (AudioBuffer &buffer, size_t startIndex)
 
- Public Member Functions inherited from HephAudio::ModulationEffect
virtual ~ModulationEffect ()=default
 
virtual void SetOscillator (const Oscillator &lfo)
 
virtual double GetDepth () const
 
virtual void SetDepth (double depth)
 
- Public Member Functions inherited from HephAudio::DoubleBufferedAudioEffect
virtual ~DoubleBufferedAudioEffect ()=default
 
- Public Member Functions inherited from HephAudio::AudioEffect
virtual ~AudioEffect ()=default
 
virtual bool HasMTSupport () const
 
virtual bool HasRTSupport () const
 
virtual size_t GetThreadCount () const
 
virtual void SetThreadCount (size_t threadCount)
 
virtual size_t CalculateOutputFrameCount (const AudioBuffer &buffer) const
 

Protected Member Functions

virtual void ProcessST (const AudioBuffer &inputBuffer, AudioBuffer &outputBuffer, size_t startIndex, size_t frameCount) override
 
virtual size_t CalculatePastSamplesSize (const AudioBuffer &inputBuffer) const
 
- Protected Member Functions inherited from HephAudio::ModulationEffect
 ModulationEffect ()
 
 ModulationEffect (double depth, const Oscillator &lfo)
 
- Protected Member Functions inherited from HephAudio::DoubleBufferedAudioEffect
 DoubleBufferedAudioEffect ()
 
- Protected Member Functions inherited from HephAudio::AudioEffect
 AudioEffect ()
 
virtual void ProcessMT (const AudioBuffer &inputBuffer, AudioBuffer &outputBuffer, size_t startIndex, size_t frameCount)
 

Protected Attributes

AudioBuffer pastSamples
 
double extent
 
- Protected Attributes inherited from HephAudio::ModulationEffect
Heph::DoubleBuffer lfoBuffer
 
size_t lfoIndex
 
double depth
 
- Protected Attributes inherited from HephAudio::AudioEffect
size_t threadCount
 

Detailed Description

changes the pitch of the audio data periodically and mixes the result with the input signal.

Note
this is a non-causal effect.

Constructor & Destructor Documentation

◆ Vibrato() [1/2]

HephAudio::Vibrato::Vibrato ( )

creates a new instance and initializes it with default values.

◆ Vibrato() [2/2]

HephAudio::Vibrato::Vibrato ( double depth,
double extent,
const Oscillator & lfo )

creates a new instance and initializes it with the provided values.

Parameters
depthcontrols the dry/wet mix ratio. Ranges between 0 and 1.
lfolow-frequency oscillator.
extentmaximum pitch change in terms of semitones.

◆ ~Vibrato()

virtual HephAudio::Vibrato::~Vibrato ( )
virtualdefault

releases the resources and destroys the instance.

Member Function Documentation

◆ Name()

virtual std::string HephAudio::Vibrato::Name ( ) const
overridevirtual

gets the name of the audio effect.

Implements HephAudio::AudioEffect.

◆ CalculateRequiredFrameCount()

virtual size_t HephAudio::Vibrato::CalculateRequiredFrameCount ( size_t outputFrameCount,
const AudioFormatInfo & formatInfo ) const
overridevirtual

calculates the number of frames required to obtain the number of frames desired for the output buffer. Useful for applying effects that depend on past and/or future samples in real-time.

Parameters
outputFrameCountthe number of frames desired for the output buffer.
formatInfothe format info of the input buffer.

Reimplemented from HephAudio::AudioEffect.

◆ Process() [1/3]

virtual void HephAudio::Vibrato::Process ( AudioBuffer & buffer,
size_t startIndex,
size_t frameCount )
overridevirtual

Applies the effect.

Parameters
buffercontains the audio data which will be processed.
startIndexindex of the first audio frame to process.
frameCountnumber of frames to process.

Reimplemented from HephAudio::ModulationEffect.

◆ GetExtent()

virtual double HephAudio::Vibrato::GetExtent ( ) const
virtual

gets the maximum pitch change in terms of semitones.

◆ SetExtent()

virtual void HephAudio::Vibrato::SetExtent ( double extent)
virtual

sets extent.

Parameters
extentmaximum pitch change in terms of semitones.

◆ ProcessST()

virtual void HephAudio::Vibrato::ProcessST ( const AudioBuffer & inputBuffer,
AudioBuffer & outputBuffer,
size_t startIndex,
size_t frameCount )
overrideprotectedvirtual

applies the effect using single thread.

Parameters
inputBuffercontains the dry data.
outputBuffercontains the wet data.
startIndexindex of the first sample to process.
frameCountnumber of frames to process.

Implements HephAudio::AudioEffect.

◆ CalculatePastSamplesSize()

virtual size_t HephAudio::Vibrato::CalculatePastSamplesSize ( const AudioBuffer & inputBuffer) const
protectedvirtual

calculates the number of past samples required.

Parameters
inputBuffercontains the dry data.

◆ Process() [2/3]

virtual void HephAudio::AudioEffect::Process ( AudioBuffer & buffer)
virtual

Applies the effect.

Parameters
buffercontains the audio data which will be processed.

Reimplemented from HephAudio::ModulationEffect.

◆ Process() [3/3]

virtual void HephAudio::AudioEffect::Process ( AudioBuffer & buffer,
size_t startIndex )
virtual

Applies the effect.

Parameters
buffercontains the audio data which will be processed.
startIndexindex of the first audio frame to process.

Reimplemented from HephAudio::ModulationEffect.

Member Data Documentation

◆ pastSamples

AudioBuffer HephAudio::Vibrato::pastSamples
protected

past samples required for real-time processing.

◆ extent

double HephAudio::Vibrato::extent
protected

maximum pitch change in terms of semitones.