arduino-audio-tools
Loading...
Searching...
No Matches
Classes | Namespaces
PitchShift.h File Reference

Real-time pitch shifting audio effect implementation. More...

#include <math.h>
#include <stdio.h>
#include <string.h>
#include "AudioTools/CoreAudio/AudioOutput.h"
#include "AudioTools/CoreAudio/AudioTypes.h"
#include "AudioToolsConfig.h"

Go to the source code of this file.

Classes

struct  PitchShiftInfo
 Configuration for PitchShiftOutput. More...
 
class  PitchShiftOutput< T, BufferT >
 Real-time pitch shifting audio effect. More...
 
class  VariableSpeedRingBuffer< T >
 Optimized buffer implementation for pitch shifting with interpolation. More...
 
class  VariableSpeedRingBuffer180< T >
 Variable speed ring buffer with 180-degree phase shifting. More...
 
class  VariableSpeedRingBufferSimple< T >
 Very Simple Buffer implementation for Pitch Shift. More...
 

Namespaces

namespace  audio_tools
 Generic Implementation of sound input and output for desktop environments using portaudio.
 

Detailed Description

Real-time pitch shifting audio effect implementation.

This file contains classes for performing real-time pitch shifting on audio streams. Pitch shifting changes the frequency (pitch) of audio without affecting its duration, allowing for creative audio effects like chipmunk voices, deeper bass tones, or musical pitch correction.

The implementation provides three different buffer algorithms with varying quality and computational complexity:

  1. VariableSpeedRingBufferSimple: Basic implementation with potential artifacts
    • Fastest processing
    • Suitable for simple applications where quality is not critical
    • May produce audible artifacts during buffer overruns
  2. VariableSpeedRingBuffer180: Advanced implementation with 180° phase offset
    • Good quality with moderate complexity
    • Uses dual read pointers with cross-fading to reduce artifacts
    • Based on STM32 DSP techniques
  3. VariableSpeedRingBuffer: Premium implementation with interpolation
    • Highest quality with advanced features
    • Linear interpolation for smooth sample transitions
    • Automatic phase alignment during pointer collisions
    • Best for professional audio applications
Note
Pitch shifting introduces some latency due to buffering. Buffer size affects both quality and latency - larger buffers provide better quality but more delay.
Author
Phil Schatzmann