|0.2.12-alpha.0||Apr 7, 2023|
|0.2.11-alpha.0||Dec 19, 2022|
|0.2.5-alpha.0||Jun 21, 2022|
|0.2.4-alpha.0||Mar 14, 2022|
|0.1.42-alpha.0||Oct 27, 2021|
#729 in Audio
50 downloads per month
Used in 3 crates (2 directly)
surgefx-flanger: A flexible and efficient flanger module for the Surge synthesizer system
A modular flanger effect crate for the Surge synthesizer system, providing a high-quality and customizable flanging experience with a variety of control parameters.
surgefx-flanger is a powerful and efficient
flanger module for the Surge synthesizer system,
offering a wide range of control parameters and
options for customization. It is designed to be
easily integrated into other components of the
Surge ecosystem, allowing for seamless
incorporation into your music production projects.
The flanger effect is achieved through the combination of a dry signal with a delayed and modulated version of itself. This results in a unique and characteristic "swooshing" sound, which can be adjusted and fine-tuned through various parameters.
The following tokens are utilized in this crate, each with their specific purposes and mathematical relationships:
control_group: Groups related control parameters.
control_type: Specifies the type of control (e.g., continuous, discrete).
default_value: Sets the default value for a control parameter.
max_value: Specifies the maximum allowed value for a control parameter.
min_value: Specifies the minimum allowed value for a control parameter.
modulateable: Determines if a control parameter can be modulated by an external source.
moverate: Adjusts the rate at which the delay line moves through the modulation range.
value_type: Defines the type of value for a control parameter (e.g., float, integer).
The core of the flanger effect is the
struct, which contains methods such as
init_comb: Initializes the internal state of the comb filter.
process_lfos_and_delays_for_each_comb: Processes the Low-Frequency Oscillators (LFOs) and delay lines for each comb filter, creating the modulated delayed signal.
do_flanger_block: Executes the core flanger processing block, generating the final flanger output.
softclip_the_feedback_to_avoid_explosions: Applies a soft clipping function to the feedback signal, preventing unwanted distortion or "explosions".
Interpolation and Filtering
To ensure smooth transitions and high-quality
audio output, the
OnePoleLPFilterState structs are utilized:
InterpDelay: Implements interpolation for the delay line, ensuring smooth transitions between delay values.k Linear interpolation is commonly used: `output = x1 * (1 - fraction) + x2
are adjacent samples andfraction` is the fractional part of the delay value.
OnePoleLPFilterState: Represents a one-pole low-pass filter state, used for smoothing the modulated delayed signal. The equation for a one-pole low-pass filter is
y[n] = (1 - α) * x[n] + α * y[n-1], where
y[n]is the output,
x[n]is the input,
y[n-1]is the previous output, and
αis the filter coefficient.
FlangerMode enum defines different flanger
operation modes, providing further customization
options for the user.
category methods offer
additional metadata about the flanger module,
aiding in organization and discoverability within
the larger Surge synthesizer system.
With its efficient design, rich feature set, and
surgefx-flanger is an
2> thanks -- could you teach me a dozen places where flangers can be applied to create a certain effect in electronic music? please describe which parameters lead to each configuration, what the sound is like, what it does, and how it can be used in the context of a real-world song -- flangers to me sometimes sound like an interesting effect, but not actually desirable in practice. i would like you to help me steel man the argument that flangers are actually a quite useful effect that sound great in real-world music
Flangers can be a versatile and unique effect when used creatively in electronic music. Here are twelve examples of how flangers can be applied to create a specific sound or enhance certain elements of a track:
Psychedelic leads: Apply a flanger to a synth lead with a slow rate and moderate depth, creating a swirling, psychedelic effect. This can add depth and movement to the lead sound, making it stand out in a mix.
Guitar enhancement: Use a flanger on a clean or slightly overdriven guitar to create a lush, dreamy texture. Set the rate and depth to taste and adjust the feedback to control the intensity of the effect.
Percussive accents: Apply a flanger to percussive elements like hi-hats or snares with a high feedback and fast rate. This can create a metallic, resonant effect, adding a unique character to the percussion in your track.
Bass enhancement: Flange a bass synth with a slow rate and low depth to add subtle movement and stereo width. This can help make the bassline more engaging and present in the mix without overpowering other elements.
Atmospheric pads: Apply a flanger to pad sounds with a slow rate and high depth, creating a rich, evolving texture. This can be particularly effective in ambient or drone music to add depth and interest to sustained chords or textures.
Vocal treatment: Use a flanger on a vocal track with a slow rate and low depth to add subtle movement and a sense of space. This can make the vocal feel more organic and less static in the mix.
Breakdowns and build-ups: Automate the flanger rate, depth, and feedback during a breakdown or build-up in a dance track to create tension and anticipation. This can add excitement and energy to the transition between sections.
Drum loops: Apply a flanger to a drum loop with a fast rate and moderate depth to create a unique, otherworldly rhythm. This can add a fresh and interesting twist to familiar drum patterns.
Rhythmic flanging: Sync the flanger rate to the tempo of your track to create rhythmic flanging effects. This can add a pulsating, rhythmic element to synths, guitars, or other melodic elements.
Dub-style effects: Use a flanger in combination with a delay effect to create spacious, dub-style echoes. Experiment with different delay times and feedback settings to achieve the desired effect.
Stereo widening: Apply a flanger to a mono sound source with a slow rate and moderate depth to create a sense of stereo width. This can help to fill out the stereo image and make the sound more engaging.
Sound design: Use a flanger with extreme settings (e.g., high depth, high feedback) to create unique sound effects and textures for use in electronic music or sound design projects.
In summary, flangers can be a valuable tool in electronic music production, adding depth, movement, and character to various elements of a track. By carefully adjusting the rate, depth, and feedback parameters, and by using automation and tempo sync, you can create a wide range of interesting effects and sounds that enhance your music in both subtle and dramatic ways.
3> okay, i am sold. thanks. now, could you teach me how they work? could you show me a detailed block diagram of how their subcomponents fit together and help me understand how it all fits together?
Certainly! A flanger is essentially a time-based audio effect that creates its characteristic sound by mixing an input signal with a delayed and modulated version of itself. Let's break down the primary components of a flanger and how they fit together in a block diagram.
Input Signal │ ├─────────────────────┐ │ │ Delay Line with Modulation ─┤ │ │ Feedback Loop │ │ │ Comb Filter ─────────────┤ │ │ Output Signal ─┘ │
Input Signal: The input signal is the sound source you want to process with the flanger effect, such as a guitar, synth, or drum loop.
Delay Line with Modulation: The input signal is fed into a delay line, which delays the signal by a varying amount of time. This time delay is modulated by a Low-Frequency Oscillator (LFO), causing the delay time to continuously change within a specific range. The LFO typically oscillates between a minimum and maximum delay value, creating a sweeping effect.
Feedback Loop: A portion of the output from the delay line is fed back into its input, creating a feedback loop. This loop creates a series of notches in the frequency spectrum, which can be adjusted by controlling the feedback amount. Increasing the feedback amount results in a more pronounced effect, while lower feedback settings produce a subtler sound.
Comb Filter: The original input signal and the modulated delayed signal are combined using a comb filter. This filter creates the characteristic "swooshing" sound of the flanger by reinforcing certain frequencies and canceling out others, depending on the delay time and the phase relationship between the input and delayed signals.
Output Signal: The resulting processed signal is then sent to the output, where it can be combined with other audio signals or further processed using additional effects.
The key to the flanger effect lies in the continuous modulation of the delay time and the interaction between the input signal and the modulated delayed signal. By adjusting the rate and depth of the LFO, the feedback amount, and the mix between the dry (input) and wet (processed) signals, you can create a wide range of flanging effects, from subtle swirling sounds to dramatic, whooshing textures.
In practice, many flangers also include additional controls for fine-tuning the effect, such as different LFO waveform shapes, stereo widening options, or tempo sync features. However, the basic components and signal flow remain the same.
4> are there alternative topologies, similar to a flanger, that can lead to other useful effects? also, how is the flanger parametrized and configured by the user at compile time? how is it configured at run time? how can the topology be streamlined or augmented? can it be improved?
Yes, there are alternative topologies similar to a flanger that can lead to other useful effects. Some of these topologies include:
Phaser: A phaser is another time-based effect that creates a sweeping sound by filtering the input signal through a series of all-pass filters, which shift the phase of the frequencies. The output is then mixed with the original signal, creating notches in the frequency spectrum. The position of these notches is modulated by an LFO, similar to a flanger. Although phasers and flangers share similarities in their sweeping effect, phasers have a more subtle, "whooshing" sound compared to the more metallic and pronounced effect of a flanger.
Chorus: A chorus effect is created by mixing the input signal with one or more delayed, modulated copies of itself. The delay times are usually shorter than those used in a flanger, and the LFO modulation is often slower. This creates a lush, "thickening" effect that can make a sound appear as though multiple sources are playing simultaneously. Choruses are often used to add depth and width to guitars, synths, and vocals.
In terms of parameterization and configuration, a flanger can be adjusted in several ways, both at compile time and run time.
Default values for parameters such as rate, depth, feedback, and delay time can be set.
The range for each parameter can be defined.
LFO waveform shapes can be specified, such as sine, triangle, or square waves.
The option for tempo sync can be included or excluded.
Rate: The user can adjust the speed of the LFO modulation, controlling how quickly the flanging effect sweeps through the frequency spectrum.
Depth: The user can control the intensity of the modulation by adjusting the range of the delay time.
Feedback: The user can control the amount of delayed signal that is fed back into the delay line, affecting the prominence of the notches and peaks in the frequency response.
Mix: The user can blend the dry (unprocessed) and wet (processed) signals to control the overall intensity of the effect.
LFO Waveform: The user can select different LFO waveforms to change the character of the modulation.
Tempo Sync: If available, the user can sync the flanger rate to the tempo of the track for rhythmically coherent effects.
To streamline or augment the topology, you can consider the following improvements:
Streamlining: Simplify the LFO section by using a single waveform or fixed modulation rate to reduce complexity and computational resources.
Augmenting: Add additional LFOs, each with their modulation rate and depth, to create more complex and evolving flanging effects.
Improving: Introduce a stereo widening feature by applying different LFO phases or delay times to the left and right channels. This can create a more immersive, spacious sound.
Ultimately, the choice to streamline or augment the topology depends on the specific needs of your project and the desired level of control and complexity for the effect.
5> okay thanks -- when engineering this architecture, how do we prevent unwanted audio artifacts?
When engineering a flanger effect, there are several considerations to prevent unwanted audio artifacts. Here are some key aspects to pay attention to:
Interpolation: To prevent artifacts caused by abrupt changes in delay time, use interpolation techniques when reading from the delay line. Linear interpolation is the most common method, but higher-order interpolation techniques, such as cubic or Lagrange interpolation, can provide even better results at the expense of higher computational complexity.
Smooth modulation: Ensure that the Low-Frequency Oscillator (LFO) used for modulating the delay time generates a smooth waveform without abrupt jumps or discontinuities. This will help prevent unwanted clicking or popping noises in the output signal.
Anti-aliasing: When using feedback, the delayed signal can introduce high-frequency content due to the repetitive nature of the feedback loop. To prevent aliasing artifacts, apply a low-pass filter to the delayed signal before feeding it back into the delay line. The filter's cutoff frequency should be set below the Nyquist frequency to effectively remove unwanted high-frequency content.
Soft clipping: To avoid distortion or "explosions" in
6> thanks -- your last answer cut off, you were on #4. could you finish your list and elaborate as much as you can?
Apologies for the confusion. Here's the continuation of the list with elaborations on each aspect:
Parameter smoothing: When adjusting parameters like rate, depth, and feedback during runtime, it's essential to smooth any sudden changes to prevent clicks and pops in the output signal. This can be achieved by using simple linear ramps or more sophisticated techniques like exponential smoothing. To implement this, you can use a low-pass filter on the parameter control signal, or compute a moving average of the recent parameter values.
Avoiding DC offsets: Ensure that your input signal and LFO do not introduce a DC offset into the flanger's processing chain. A DC offset can cause unwanted low-frequency artifacts and an unbalanced stereo image. If necessary, apply a high-pass filter with a very low cutoff frequency to remove any DC offset from the input signal. This can be particularly important when using unconventional LFO waveforms or when processing audio signals with a significant DC bias.
Phase cancellation awareness: Be mindful of phase cancellation issues that can arise when mixing the dry and wet signals, especially if the effect is used on a mono signal or if the flanger is part of a more complex processing chain. To mitigate this issue, you can experiment with different phase relationships between the dry and wet signals (e.g., inverting the phase of the wet signal) or by adjusting the balance between the dry and wet signals.
Stereo coherence: To maintain a consistent stereo image when processing stereo signals, ensure that the delay modulation is coherent between the left and right channels. This can be achieved by using the same LFO waveform for both channels or by applying a phase offset between the channels. Alternatively, you can experiment with independent LFOs for each channel to create a more spacious and immersive effect.
Optimized processing: To avoid introducing latency or causing buffer underruns, optimize your flanger's processing code for efficiency. This can involve minimizing the use of memory, reducing the number of calculations per sample, and leveraging SIMD instructions or parallel processing when available. Additionally, consider using a smaller buffer size and a lower modulation rate to reduce the risk of audio artifacts caused by buffer underruns.
By considering these aspects during the engineering and design process of a flanger effect, you can ensure that the resulting sound is free of unwanted audio artifacts and provides a pleasant and professional-quality result.
7> how do we detect and measure phase cancellation in a processing pipeline such as this? how do we ensure stereo coherence in depth?
Detecting and measuring phase cancellation and ensuring stereo coherence are important aspects of audio processing. Here's how you can approach these tasks:
Detecting and measuring phase cancellation:
Phase cancellation occurs when two signals with similar frequencies are combined, and their phase relationship causes them to partially or completely cancel each other out. In a flanger, this can happen when the dry signal and the delayed wet signal are mixed. To detect and measure phase cancellation, you can follow these steps:
Visual inspection: Use a spectrogram or a real-time frequency analyzer to visualize the frequency content of the audio signals before and after processing. Phase cancellation will typically manifest as a reduction in amplitude at specific frequencies or a series of notches in the frequency spectrum.
Correlation meter: Use a correlation meter to measure the similarity between the left and right channels of a stereo signal. A correlation meter displays a value between -1 and 1. If the value is close to 1, the channels are highly correlated, which means they have a similar phase relationship. If the value is close to -1, the channels are out of phase, which could indicate phase cancellation.
Phase inversion test: Apply a phase inversion to one of the signals (e.g., the wet signal) and listen to the result. If the overall level or frequency content changes significantly, it indicates that phase cancellation is occurring.
Ensuring stereo coherence in depth:
Stereo coherence refers to the consistent and balanced relationship between the left and right channels in a stereo signal. To ensure stereo coherence in a flanger, follow these guidelines:
Consistent modulation: Use the same LFO waveform and modulation rate for both the left and right channels to ensure that the delay modulation is consistent across both channels. This will help maintain a coherent and balanced stereo image.
Phase offset: Apply a small phase offset between the left and right channels' LFOs. This can create a sense of depth and spaciousness without causing significant phase cancellation. Experiment with different phase offsets to find the optimal balance between spaciousness and coherence.
Linking parameters: When adjusting parameters like rate, depth, and feedback, ensure that the changes are applied consistently to both channels. This will maintain the balance and coherence between the left and right channels as the effect is adjusted.
Mono compatibility: To ensure that your processed signal remains coherent when collapsed to mono, periodically check the mix in mono while adjusting parameters. This can help you identify any phase cancellation issues or imbalances that may be introduced during processing.
By carefully monitoring phase relationships and maintaining a consistent balance between the left and right channels, you can ensure that your flanger effect maintains stereo coherence and depth while minimizing the risk of phase cancellation.
8> which parameters do we have and what are their ranges?
In a typical flanger effect, the most common parameters and their ranges are as follows:
Rate: This parameter controls the speed of the Low-Frequency Oscillator (LFO) that modulates the delay time. The range for this parameter can vary, but a common range is from 0.01 Hz to 10 Hz. Lower values result in a slower, more gradual sweep, while higher values create a faster, more dramatic effect.
Depth: This parameter controls the intensity of the modulation by adjusting the range of the delay time. The range for depth can vary depending on the desired effect, but a common range is from 0 ms (no modulation) to 20 ms (maximum modulation). Higher depth values result in a more pronounced flanging effect, while lower values produce a subtler sound.
Feedback: This parameter controls the amount of the delayed signal that is fed back into the delay line, affecting the prominence of the notches and peaks in the frequency response. Feedback is usually expressed as a percentage, with a common range of -100% (inverted feedback) to 100% (positive feedback). Higher feedback values create a more resonant, metallic sound, while lower values result in a more subtle effect.
Mix: This parameter controls the balance between the dry (unprocessed) and wet (processed) signals. It is often expressed as a percentage, with a range of 0% (100% dry) to 100% (100% wet). Adjusting the mix allows you to control the overall intensity of the flanger effect, with higher values producing a more pronounced sound and lower values resulting in a more subtle effect.
LFO Waveform: This parameter allows you to select different LFO waveforms, such as sine, triangle, or square waves, which can change the character of the modulation. While not always provided as a user-adjustable parameter, some flangers offer this option for added flexibility and control over the effect's sound.
Stereo Phase Offset: In stereo flangers, this parameter adjusts the phase offset between the left and right channels' LFOs. This can create a sense of depth and spaciousness without causing significant phase cancellation. The range for this parameter is typically from 0° (no offset) to 360° (full phase offset).
These parameters and ranges can vary depending on the specific flanger implementation, but the above list represents a common set of controls found in most flanger effects. By adjusting these parameters, you can create a wide range of flanging effects, from subtle swirling sounds to dramatic, whooshing textures.
9> could you give me a history of this effect? who created it? how has it evolved? what is its hardware lineage? what were the key observations and innovations that led to its development? are there future investigations into how this technology can be improved? how can the sound quality be improved/deepened?
The flanger effect has a rich history, dating back to the early days of recording technology. Here is a brief overview of its origins, evolution, and future possibilities:
Origins and early development:
The flanger effect was originally created in the 1940s and 1950s by using tape machines in a technique known as "flanging." This involved playing back two identical recordings on separate tape machines and manually varying the speed of one of them using a finger on the tape reel's flange. This created a variable delay between the two signals, resulting in the characteristic comb-filtering effect that we now associate with flanging.
Les Paul, the legendary guitarist and inventor, was one of the early pioneers of the flanger effect. He used the technique in his recordings, which helped popularize the effect and inspire other engineers and musicians.
Following the tape-based experiments, the first dedicated flanger hardware units were developed in the late 1960s and early 1970s. These analog devices used electronic circuits, such as bucket-brigade devices (BBDs), to create the delay and modulation required for the effect. Examples of early hardware flangers include the Electro-Harmonix Electric Mistress, the MXR Flanger, and the A/DA Flanger.
As digital technology advanced, digital flangers emerged in the 1980s and 1990s. These devices used digital signal processing (DSP) techniques to create the effect, offering more control and precision compared to their analog counterparts. Today, flangers are available in various formats, including hardware units, software plugins, and even built-in effects in digital audio workstations (DAWs).
Key observations and innovations:
The key observation that led to the development of the flanger effect was the discovery that by delaying a signal and mixing it with the original, a series of notches and peaks would form in the frequency spectrum, creating the distinctive "swooshing" sound. The introduction of LFOs to modulate the delay time further enhanced the effect, adding a dynamic, sweeping quality to the sound.
Over the years, innovations in flanger design have included the transition from tape-based techniques to analog and digital circuitry, the introduction of various LFO waveforms, and the addition of stereo processing capabilities. These developments have allowed for more precise control and a wider range of sonic possibilities.
Future investigations and improvements:
As audio technology continues to evolve, there is always room for improvement and exploration in the realm of flanging effects. Some potential areas of investigation include:
Developing new algorithms and DSP techniques to achieve more natural-sounding or unique flanging effects.
Incorporating machine learning or artificial intelligence to automatically adapt the effect to the input signal, creating a more responsive and dynamic flanging experience.
Exploring alternative methods for modulating the delay time, such as using granular synthesis or other time-based processing techniques.
Combining the flanger effect with other audio effects, such as reverbs, filters, or distortion, to create new and innovative soundscapes.
By continually pushing the boundaries of technology and creative experimentation, the flanger effect can continue to evolve and offer new and exciting possibilities for musicians and producers alike.
10> how can we achieve a more natural-sounding and unique flanging effect? how can artificial intelligence be used to create a more responsive and dynamic flanger? how can granular synthesis be integrated into this effect? how can ideas from these other audio effects be integrated into the flanger?
Achieving a more natural-sounding and unique flanging effect, as well as creating a more responsive and dynamic flanger, can be accomplished through innovative approaches and the incorporation of ideas from other audio effects. Here are some suggestions:
More natural-sounding and unique flanging effect:
Use non-linear or multi-segment modulation curves for the LFO to create a more organic and less predictable modulation.
Implement random or noise-based modulation sources, such as sample-and-hold or Perlin noise, to introduce subtle variations in the modulation rate and depth.
Introduce subtle variations in the feedback amount or delay time based on the input signal's characteristics (e.g., amplitude, frequency content) to create a more dynamic and context-sensitive effect.
Combine multiple flangers with different settings, modulation sources, or LFO waveforms to create more complex and rich textures.
Artificial intelligence for a responsive and dynamic flanger:
Use machine learning algorithms to analyze the input signal and automatically adjust the flanger's parameters, such as rate, depth, and feedback, based on the signal's characteristics.
Implement real-time feature extraction (e.g., pitch, amplitude, spectral content) and use these features to drive the flanger's modulation or other parameters.
Train a neural network to emulate the characteristics of classic analog flangers or to create entirely new flanging effects based on a dataset of examples.
Integrating granular synthesis:
Replace the traditional delay line with a granular synthesis engine that modulates the grain size and position based on the flanger's LFO.
Use granular synthesis to create a more complex delay line by modulating the grain density, pitch, or amplitude.
Combine granular synthesis with the flanger's feedback loop to create evolving, shimmering textures.
Incorporating ideas from other audio effects:
Integrate a filter, such as a low-pass, high-pass, or band-pass filter, into the flanger's feedback loop or delay line to shape the spectral content of the wet signal.
Apply a subtle amount of distortion or saturation to the wet signal or feedback loop, adding warmth and character to the flanging effect.
Combine the flanger with a reverb effect, either in parallel or by processing the wet signal with reverb, to create a sense of space and depth.
Use the flanger in conjunction with a pitch shifter or harmonizer to create more complex and harmonically rich flanging effects.
By exploring these approaches and experimenting with the integration of ideas from other audio effects, you can create more natural-sounding, unique, and dynamic flanger effects that push the boundaries of what is traditionally possible with this classic audio effect.
11> what are the mathematical properties of a flanger? what are the mathematical properties of its subcomponents?
A flanger is essentially a time-based audio effect that relies on a combination of delay, modulation, and feedback to produce its characteristic sound. The key mathematical properties of a flanger and its subcomponents are as follows:
The delay line is the core component of a flanger. It creates a time-delayed version of the input signal, which is then combined with the original (dry) signal. Mathematically, the delay line can be represented as a circular buffer with a variable read pointer, which determines the delay time (in samples or milliseconds).
The modulation in a flanger is typically achieved using a Low-Frequency Oscillator (LFO) to vary the delay time. The LFO generates a periodic waveform, such as a sine or triangle wave, which is used to modulate the delay time. The mathematical equation for the modulated delay time is:
delay_time_modulated = delay_time_base + depth * LFO(t, rate)
delay_time_base is the base delay time,
depth is the modulation depth,
LFO(t, rate) is
the LFO waveform function with time
t and rate
When the delayed signal (wet) is combined with the original signal (dry), a comb filter effect occurs due to phase interference between the two signals. The frequency response of the comb filter can be represented as:
H(f) = 1 + k * e^(-j * 2 * pi * f * delay_time_modulated)
H(f) is the frequency response,
k is the feedback gain, and
delay_time_modulated is the modulated delay
The feedback loop in a flanger takes a portion of the output signal and feeds it back into the input of the delay line. The feedback gain determines the intensity of the effect, and its mathematical representation is:
feedback_signal = output_signal * feedback_gain
feedback_signal is the signal fed back
into the delay line,
output_signal is the
combined wet and dry signal, and
is the feedback amount.
The mix component in a flanger is responsible for blending the dry and wet signals. The mathematical representation for the mix operation is:
output_signal = dry_signal * (1 - mix) + wet_signal * mix
output_signal is the final output,
dry_signal is the original input signal,
wet_signal is the delayed and modulated signal,
mix is the mix factor between 0 and 1.
These mathematical properties and equations define the essential behavior of a flanger effect and its subcomponents. By understanding these properties, it is possible to analyze the effect, design new variations, and optimize the performance of a flanger implementation.