UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
TapDelayPitchShifter.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
6#include "DSP/Dsp.h"
7#include "DSP/Delay.h"
8
9namespace Audio
10{
11 // Class which reads doppler-shifted tap from a delay buffer
13 {
14 public:
15 static constexpr float MinDelayLength = 10.0f;
16 static constexpr float MaxDelayLength = 100.0f;
17 static constexpr float MaxAbsPitchShiftInOctaves = 6.0f;
18
19 // Constructor
21
22 // Virtual Destructor
24
25 // Initialization of the internal delay with given sample rate, pitch shift in semitones, and delay length in milliseconds
26 SIGNALPROCESSING_API void Init(const float InSampleRate, const float InPitchShift, const float InDelayLength);
27
28 // Sets the internal delay line length.
30
31 // Sets the pitch shift in semitones
33
34 // Sets the pitch shift in terms of a sample rate ratio
36
37 // Reads the next sample tap from the input delay buffer
39
40 // Process whole block of audio reading to and writing from delay line from input buffer
42
43 private:
44 SIGNALPROCESSING_API void UpdatePhasorPhaseIncrement();
45
46 float SampleRate = 0.0f;
47 Audio::FExponentialEase CurrentDelayLength;
48 float CurrentTargetDelayLength = 0.0f;
49 float CurrentPitchShift = 0.0f;
50 float CurrentPitchShiftRatio = 1.0f;
51 float PhasorPhase = 0.0f;
52 float PhasorPhaseIncrement = 0.0f;
53 };
54
55}
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
void Init()
Definition LockFreeList.h:4
Definition Delay.h:13
Definition Dsp.h:505
Definition TapDelayPitchShifter.h:13
SIGNALPROCESSING_API void SetPitchShiftRatio(const float InPitchShiftRatio)
Definition TapDelayPitchShifter.cpp:69
static constexpr float MaxDelayLength
Definition TapDelayPitchShifter.h:16
SIGNALPROCESSING_API float ReadDopplerShiftedTapFromDelay(const Audio::FDelay &InDelayBuffer, const float ReadOffsetMilliseconds=0.0f)
Definition TapDelayPitchShifter.cpp:78
static constexpr float MinDelayLength
Definition TapDelayPitchShifter.h:15
virtual SIGNALPROCESSING_API ~FTapDelayPitchShifter()
Definition TapDelayPitchShifter.cpp:24
SIGNALPROCESSING_API void ProcessAudio(Audio::FDelay &InDelayBuffer, const float *InAudioBuffer, const int32 InNumFrames, float *OutAudioBuffer)
Definition TapDelayPitchShifter.cpp:108
SIGNALPROCESSING_API void SetDelayLength(const float InDelayLength)
Definition TapDelayPitchShifter.cpp:47
static constexpr float MaxAbsPitchShiftInOctaves
Definition TapDelayPitchShifter.h:17
SIGNALPROCESSING_API FTapDelayPitchShifter()
Definition TapDelayPitchShifter.cpp:20
SIGNALPROCESSING_API void SetPitchShift(const float InPitchScaleSemitones)
Definition TapDelayPitchShifter.cpp:58
NO_LOGGING.
Definition AudioMixerPlatformAndroid.cpp:53