Audio Effects Library
OwnAudioSharp includes a comprehensive collection of professional audio effects. Each effect is optimized for real-time processing and provides studio-quality results.
Reverb Spatial
Delay Temporal
Compressor Dynamic
Equalizer Spectral
Reverb Effect
Professional quality reverb effect based on the renowned Freeverb algorithm. Creates natural-sounding spatial ambience from small rooms to large halls.
using Ownaudio.Processors;
// Create hall reverb
var hallReverb = new Reverb(
roomSize: 0.8f, // Large space
damping: 0.2f, // Minimal high-frequency damping
wetLevel: 0.4f, // 40% reverb signal
dryLevel: 0.7f // 70% original signal
);
sourceManager.CustomSampleProcessor = hallReverb;
Parameters
Parameter | Range | Description |
---|---|---|
roomSize |
0.0 - 1.0 | Size of the reverberant space. 0.1 = small room, 0.9 = cathedral |
damping |
0.0 - 1.0 | High frequency absorption. 0.0 = bright, 1.0 = very damped |
wetLevel |
0.0 - 1.0 | Level of the reverb effect in the output mix |
dryLevel |
0.0 - 1.0 | Level of the original (dry) signal in the output mix |
// Small room reverb
var roomReverb = new Reverb(0.3f, 0.7f, 0.25f, 0.8f);
// Concert hall reverb
var concertHall = new Reverb(0.9f, 0.1f, 0.5f, 0.6f);
// Plate reverb (bright and smooth)
var plateReverb = new Reverb(0.5f, 0.3f, 0.4f, 0.7f);
// Vocal booth (tight, controlled)
var vocalBooth = new Reverb(0.2f, 0.8f, 0.15f, 0.9f);
Delay Effect
High-quality digital delay with feedback control. Perfect for creating echoes, ping-pong effects, and rhythmic delays.
using Ownaudio.Processors;
// Create echo delay
var echoDelay = new Delay(
delayMs: 500, // 500ms delay time
feedback: 0.4f, // 40% feedback for natural echoes
wetLevel: 0.3f, // 30% effect level
sampleRate: 44100 // Audio sample rate
);
sourceManager.CustomSampleProcessor = echoDelay;
Parameters
Parameter | Range | Description |
---|---|---|
delayMs |
1 - 2000 | Delay time in milliseconds. Lower values for doubling, higher for echoes |
feedback |
0.0 - 0.95 | Amount of delayed signal fed back. Higher values create more repeats |
wetLevel |
0.0 - 1.0 | Level of the delayed signal in the mix |
sampleRate |
22050 - 96000 | Audio sample rate for accurate timing calculations |
// Short slap-back delay
var slapback = new Delay(120, 0.2f, 0.2f, 44100);
// Ping-pong delay
var pingPong = new Delay(250, 0.6f, 0.4f, 44100);
// Long atmospheric delay
var atmosphere = new Delay(800, 0.5f, 0.3f, 44100);
// Rhythmic delay (1/8 note at 120 BPM)
var rhythmic = new Delay(250, 0.4f, 0.25f, 44100);
Compressor Effect
Professional dynamic range compressor with configurable attack, release, ratio, and makeup gain. Essential for controlling dynamics and adding punch to audio.
using Ownaudio.Processors;
// Create vocal compressor
var vocalComp = new Compressor(
threshold: 0.6f, // Start compressing at 60% level
ratio: 3.0f, // 3:1 compression ratio
attackMs: 5f, // Fast 5ms attack
releaseMs: 50f, // Medium 50ms release
makeupGain: 1.3f, // Compensate for level reduction
sampleRate: 44100f
);
sourceManager.CustomSampleProcessor = vocalComp;
Parameters
Parameter | Range | Description |
---|---|---|
threshold |
0.0 - 1.0 | Level above which compression begins. Lower = more compression |
ratio |
1.0 - 20.0 | Compression ratio. 2:1 = gentle, 10:1 = heavy limiting |
attackMs |
0.1 - 100 | Time to reach full compression. Fast for transients, slow for smooth |
releaseMs |
1 - 1000 | Time to return to normal. Fast for punch, slow for smoothness |
makeupGain |
0.1 - 5.0 | Compensate for level reduction caused by compression |
// Gentle bus compressor
var busComp = new Compressor(0.7f, 2.0f, 30f, 100f, 1.1f, 44100f);
// Drum compressor (punchy)
var drumComp = new Compressor(0.5f, 4.0f, 1f, 30f, 1.5f, 44100f);
// Vocal compressor (smooth)
var vocalComp = new Compressor(0.6f, 3.0f, 5f, 50f, 1.3f, 44100f);
// Limiter (brick wall)
var limiter = new Compressor(0.95f, 20.0f, 0.1f, 5f, 1.0f, 44100f);
Equalizer Effect
Advanced 30-band parametric equalizer with dynamic Q-factor optimization. Features precise frequency control and psychoacoustic modeling.
using Ownaudio.Processors;
// Create 30-band equalizer
var equalizer = new Equalizer(44100);
// Boost bass frequencies
equalizer.SetBandGain(0, 60f, 3.0f, 1.0f); // 60Hz +3dB
equalizer.SetBandGain(1, 100f, 2.5f, 1.2f); // 100Hz +2.5dB
// Cut muddy mids
equalizer.SetBandGain(8, 400f, -2.0f, 2.0f); // 400Hz -2dB
// Enhance presence
equalizer.SetBandGain(15, 3000f, 2.5f, 1.5f); // 3kHz +2.5dB
// Smooth highs
equalizer.SetBandGain(25, 10000f, 1.5f, 0.8f); // 10kHz +1.5dB
sourceManager.CustomSampleProcessor = equalizer;
30-Band Frequency Distribution
Low Frequencies (20Hz - 200Hz)
- Bands 0-9: Sub-bass and bass fundamentals
- Critical for kick drums, bass guitar, and low-end warmth
Mid Frequencies (250Hz - 2.5kHz)
- Bands 10-19: Vocal fundamentals and body
- Important for clarity and presence of most instruments
High Frequencies (3.15kHz - 16kHz)
- Bands 20-29: Presence, air, and harmonics
- Controls brightness, detail, and spatial perception
SetBandGain Method
Parameter | Description |
---|---|
band |
Band index (0-29) corresponding to frequency ranges |
frequency |
Center frequency in Hz for the band |
gain |
Gain adjustment in dB (-20 to +20) |
q |
Q-factor (bandwidth). Lower = wider, higher = narrower |
// Rock/Pop master EQ
var rockEQ = new Equalizer(44100);
rockEQ.SetBandGain(2, 80f, 2.0f, 1.0f); // Kick punch
rockEQ.SetBandGain(7, 200f, -1.5f, 2.0f); // Reduce muddiness
rockEQ.SetBandGain(12, 1000f, 1.0f, 1.2f); // Vocal presence
rockEQ.SetBandGain(20, 5000f, 2.5f, 1.5f); // Brightness
rockEQ.SetBandGain(27, 12000f, 1.5f, 0.8f); // Air
// Vocal enhancement EQ
var vocalEQ = new Equalizer(44100);
vocalEQ.SetBandGain(3, 100f, -3.0f, 0.8f); // Remove rumble
vocalEQ.SetBandGain(9, 300f, -1.0f, 2.0f); // Reduce boxiness
vocalEQ.SetBandGain(14, 2500f, 2.0f, 1.5f); // Presence boost
vocalEQ.SetBandGain(18, 5000f, 1.5f, 2.0f); // Clarity
vocalEQ.SetBandGain(22, 8000f, -0.5f, 1.0f); // Reduce harshness
Chorus Effect
Multi-voice modulation effect that creates the illusion of multiple performers. Adds richness and depth to audio signals.
using Ownaudio.Processors;
// Create lush chorus effect
var chorus = new Chorus(
rate: 0.5f, // Slow modulation rate (0.5 Hz)
depth: 0.3f, // Moderate depth
voices: 3, // 3 chorus voices
feedback: 0.2f, // Light feedback
wetLevel: 0.4f // 40% effect level
);
sourceManager.CustomSampleProcessor = chorus;
Flanger Effect
Variable delay modulation creating characteristic "whoosh" sweeping sounds. Perfect for guitars and creative sound design.
using Ownaudio.Processors;
// Create classic flanger
var flanger = new Flanger(
rate: 0.3f, // Slow sweep rate
depth: 0.8f, // Deep modulation
feedback: 0.6f, // Strong feedback for jet-like sound
wetLevel: 0.5f // 50% effect level
);
sourceManager.CustomSampleProcessor = flanger;
Phaser Effect
All-pass filter stages create sweeping notches in the frequency spectrum. Classic effect for keyboards and guitars.
using Ownaudio.Processors;
// Create 6-stage phaser
var phaser = new Phaser(
rate: 0.4f, // Moderate sweep rate
depth: 0.7f, // Strong effect
stages: 6, // 6 all-pass stages
feedback: 0.5f, // Moderate feedback
wetLevel: 0.6f // 60% effect level
);
sourceManager.CustomSampleProcessor = phaser;
Distortion Effect
Harmonic distortion with soft clipping and overdrive characteristics. Adds warmth and character to audio signals.
using Ownaudio.Processors;
// Create warm overdrive
var overdrive = new Distortion(
drive: 0.6f, // Moderate drive amount
tone: 0.7f, // Bright tone
level: 0.8f, // Output level
type: DistortionType.SoftClipping
);
sourceManager.CustomSampleProcessor = overdrive;
Limiter Effect
Transparent peak limiting with look-ahead and smooth gain reduction. Essential for preventing digital clipping.
using Ownaudio.Processors;
// Create transparent limiter
var limiter = new Limiter(
threshold: 0.95f, // Limit at -0.5dB
release: 50f, // Fast release
lookahead: 5f, // 5ms lookahead
ceiling: 0.99f // Absolute ceiling
);
sourceManager.CustomSampleProcessor = limiter;
Rotary Speaker Effect
Simulation of classic Leslie rotary speaker cabinets with separate rotor and horn modeling.
using Ownaudio.Processors;
// Create Leslie-style rotary
var rotary = new RotarySpeaker(
rotorSpeed: 0.8f, // Rotor speed (slow/fast)
hornSpeed: 1.2f, // Horn speed
separation: 0.6f, // Stereo separation
wetLevel: 0.7f // Effect level
);
sourceManager.CustomSampleProcessor = rotary;
🔗 Effect Chaining and Custom Processors
Create complex effect chains by implementing custom processors that combine multiple effects.
public class GuitarEffectChain : SampleProcessorBase
{
private readonly Overdrive overdrive;
private readonly Equalizer eq;
private readonly Delay delay;
private readonly Reverb reverb;
public GuitarEffectChain()
{
// Build effect chain
overdrive = new Overdrive(0.5f, 0.7f, 0.8f);
eq = new Equalizer(44100);
delay = new Delay(300, 0.4f, 0.3f, 44100);
reverb = new Reverb(0.4f, 0.6f, 0.25f, 0.8f);
// Configure EQ for guitar
eq.SetBandGain(5, 150f, -2.0f, 1.5f); // Cut mud
eq.SetBandGain(12, 1200f, 2.0f, 1.2f); // Presence
eq.SetBandGain(18, 4000f, 1.5f, 2.0f); // Brightness
}
public override void Process(Span samples)
{
// Process through effect chain
overdrive.Process(samples);
eq.Process(samples);
delay.Process(samples);
reverb.Process(samples);
}
public override void Reset()
{
overdrive.Reset();
eq.Reset();
delay.Reset();
reverb.Reset();
}
}
// Apply custom effect chain
var guitarChain = new GuitarEffectChain();
sourceManager.CustomSampleProcessor = guitarChain;
Creating Custom Effects
Implement your own audio effects by extending the SampleProcessorBase class.
using Ownaudio.Processors;
using System;
public class BitCrusher : SampleProcessorBase
{
private readonly float bitDepth;
private readonly float sampleRateReduction;
private float lastSample = 0f;
private int sampleCounter = 0;
public BitCrusher(float bitDepth = 8f, float sampleRateReduction = 4f)
{
this.bitDepth = bitDepth;
this.sampleRateReduction = sampleRateReduction;
}
public override void Process(Span samples)
{
float quantizationStep = 1f / (float)Math.Pow(2, bitDepth - 1);
for (int i = 0; i < samples.Length; i++)
{
// Sample rate reduction
if (sampleCounter % (int)sampleRateReduction == 0)
{
// Bit depth reduction (quantization)
float quantized = (float)Math.Round(samples[i] / quantizationStep) * quantizationStep;
lastSample = Math.Clamp(quantized, -1f, 1f);
}
samples[i] = lastSample;
sampleCounter++;
}
}
public override void Reset()
{
lastSample = 0f;
sampleCounter = 0;
}
}
// Use custom effect
var bitCrusher = new BitCrusher(6f, 3f); // 6-bit, 1/3 sample rate
sourceManager.CustomSampleProcessor = bitCrusher;
Best Practices for Audio Effects
- Order Matters: Place EQ before compression, and modulation effects before reverb
- Gain Staging: Monitor levels between effects to prevent clipping
- CPU Usage: Use fewer effect instances for better performance on mobile devices
- Parameter Automation: Create smooth parameter changes to avoid audio artifacts
- Bypass Switching: Implement bypass functionality for A/B comparisons