FGranularSynth

A stereo granulator.

Windows
MacOS
Linux

References

Module

SignalProcessing

Header

/Engine/Source/Runtime/SignalProcessing/Public/DSP/Granulator.h

Include

#include "DSP/Granulator.h"

Syntax

class FGranularSynth

Remarks

A stereo granulator.

Variables

Name Description

Protected variable

TArray< int32 >

 

ActiveGrains

Protected variable

FAmp

 

Amp

Protected variable

bool

 

bScrubMode

Protected variable

float

 

CurrentPlayHeadFrame

The current playhead frame.

Protected variable

int32

 

CurrentSpawnFrameCount

The current number of frames since last attempt to spawn.

Protected variable

TArray< int32 >

 

DeadGrains

Protected variable

FGrainParam

 

Duration

Protected variable

FDynamicsProces...

 

DynamicsProcessor

Protected variable

TArray< int32 >

 

FreeGrains

Protected variable

FGrainParam

 

Frequency

Protected variable

FEnvelope

 

GainEnv

Overall envelope of the granulator.

Protected variable

FGrainEnvelope

 

GrainEnvelope

The single envelope function used by all grains.

Protected variable

EGrainEnvelopeT...

 

GrainEnvelopeType

Current grain envelope type.

Protected variable

EOsc::Type

 

GrainOscType

The oscillator type to use if in synthesis mode.

Protected variable

TArray< FGrain ...

 

GrainPool

A pool of free grains. Will dynamically grow to needed grains based on grain density.

Protected variable

float

 

GrainProbability

The probability of a grain occurring when it tries to spawn (based off the GrainsPerSecond)

Protected variable

float

 

GrainsPerSecond

The rate at which grains are spawned.

Protected variable

EGranularSynthM...

 

Mode

What mode the granular synthesizer is in.

Protected variable

int32

 

NextSpawnFrame

The next frame when a grain needs to spawn.

Protected variable

int32

 

NoteDurationFrameCount

Counts for overall note duration of the granulator.

Protected variable

int32

 

NoteDurationFrameEnd

Protected variable

int32

 

NumActiveGrains

Protected variable

int32

 

NumChannels

Protected variable

FGrainParam

 

Pan

Protected variable

FGrainParam

 

Pitch

Protected variable

float

 

PlaybackSpeed

Protected variable

TSampleBuffer< ...

 

SampleBuffer

The buffer which holds the sample to be granulated.

Protected variable

int32

 

SampleRate

Protected variable

FLinearEase

 

SeekingPlayheadTimeFrame

Protected variable

FGrainParam

 

Volume

Constructors

Name Description

Public function

FGranularSynth()

Destructors

Name Description

Public function

~FGranularSynth()

Functions

Name Description

Public function

void

 

Generate

(
    float* OutAudiobuffer,
    const int32 NumFrames
)

Generate the next audio buffer.

Public function Const

float

 

GetCurrentPlayheadTime()

Get current playback time (in granular mode)

Public function Const

int32

 

GetNumActiveGrains()

Return the number of currently active grains.

Public function Const

float

 

GetSampleDuration()

Returns the duration of the internal loaded sample buffer.

Protected function

float

 

GetWrappedPlayheadPosition

(
    float PlayheadFrame
)

Return wrapped playhead position.

Public function

void

 

Init

(
    const int32 InSampleRate,
    const int32 InNumInitialGrains
)

Public function

void

 

LoadSampleBuffer

(
    const TSampleBuffer< int16 >& InSa...
)

Loads a sound wave to use for granular synth mode.

Public function

void

 

NoteOff

(
    const uint32 InMidiNote,
    const bool bKill
)

Note off, triggers release envelope.

Public function

void

 

NoteOn

(
    const uint32 InMidiNote,
    const float InVelocity,
    const float InDurationSec
)

Plays a granular synthesis "Note".

Public function

void

 

SeekTime

(
    const float InTimeSec,
    const float LerpTimeSec,
    const ESeekType::Type InSeekType
)

Seeks the loaded buffer used for granulation. Grains will spawn from this location.

Public function

void

 

SetAttackTime

(
    const float InAttackTimeMSec
)

Sets the granular synth attack time.

Public function

void

 

SetDecayTime

(
    const float InDecayTimeMSec
)

Sets the granular synth decay time.

Public function

void

 

SetGrainDuration

(
    const float InBaseDuration,
    const FVector2D InDurationRange
)

Sets the grain duration.

Public function

void

 

SetGrainDurationScale

(
    const float InDurationScale
)

Sets the grain duration modulation.

Public function

void

 

SetGrainEnvelopeType

(
    const EGrainEnvelopeType InGrainEnv...
)

Sets the envelope type to use for new grains. Will instantly switch all grains to this envelope type so may cause discontinuities if switched while playing.

Public function

void

 

SetGrainFrequency

(
    const float InFrequency,
    const FVector2D InPitchRange
)

Sets the grain frequency.

Public function

void

 

SetGrainFrequencyModulation

(
    const float InFrequencyModulation
)

Sets the grain frequency modulation.

Public function

void

 

SetGrainOscType

(
    const EOsc::Type InGrainOscType
)

Sets the grain oscillator type (for use with granular synthesis mode)

Public function

void

 

SetGrainPan

(
    const float InBasePan,
    const FVector2D InPanRange
)

Sets the grain azimuth (pan) and randomization range.

Public function

void

 

SetGrainPanModulation

(
    const float InPanModulation
)

Sets the grain azimuth modulation - allows modulating actively playing grain azimuths.

Public function

void

 

SetGrainPitch

(
    const float InBasePitch,
    const FVector2D InPitchRange
)

Sets the base grain pitch and randomization range.

Public function

void

 

SetGrainPitchModulation

(
    const float InPitchModulation
)

Sets the grain pitch modulation allows modulating actively playing grain pitches.

Public function

void

 

SetGrainProbability

(
    const float InGrainProbability
)

The probability at which a grain will occur when a grain tries to spawn. Allows for sporatic grain generation.

Public function

void

 

SetGrainsPerSecond

(
    const float InNumberOfGrainsPerSeco...
)

The rate at which new grains are attempted to be spawned.

Public function

void

 

SetGrainVolume

(
    const float InBaseVolume,
    const FVector2D InVolumeRange
)

Sets the base grain volume and randomization range.

Public function

void

 

SetGrainVolumeModulation

(
    const float InVolumeModulation
)

Sets the grain modulation allows modulating actively playing grain volumes.

Public function

void

 

SetPlaybackSpeed

(
    const float InPlaybackSpeed
)

Sets how fast the granular play head for granulation is is played (and in what direction)

Public function

void

 

SetReleaseTime

(
    const float InReleaseTimeMSec
)

Sets the granular synth releas etime.

Public function

void

 

SetScrubMode

(
    const bool bIsScrubMode
)

Sets whether or not the buffer playback advances on its own or if it just sits in one place.

Public function

void

 

SetSustainGain

(
    const float InSustainGain
)

Sets the granular synth sustain gain.

Protected function

void

 

SpawnGrain()

Spawns grains.

Classes

Name

Description

Protected struct

FGrainParam

Current grain azimuth modulation.

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss