#frequency #effect #signal #shift #sound #music #signal-processing


surge synthesizer -- frequency shift effect

13 releases

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

#17 in #shift

Download history 2/week @ 2024-02-12 4/week @ 2024-02-19 19/week @ 2024-02-26 7/week @ 2024-03-04 13/week @ 2024-03-11 4/week @ 2024-03-18 80/week @ 2024-03-25

105 downloads per month
Used in 3 crates (2 directly)

GPL-3.0 license

13K SLoC


A frequency-shifting effect for the Surge synthesizer system.

SurgeFX-FreqShift is a Rust crate providing a frequency-shifting effect, designed as a subcomponent of the Surge synthesizer system. This effect enables users to shift the frequency content of an input signal, creating unique and interesting sound transformations.

In-depth Description and Mathematical Analysis:

The frequency-shifting effect is achieved through a process called single-sideband modulation. It involves modulating the input signal with a complex exponential signal, producing upper and lower sidebands. The desired sideband is then isolated to obtain the frequency-shifted output.

Mathematically, the process can be described as follows:

  1. Modulation: Multiply the input signal x(t) with a complex exponential signal e^(j * 2 * pi * f_shift * t), where f_shift is the desired frequency shift and t is time.
y(t) = x(t) * e^(j * 2 * pi * f_shift * t)
  1. Isolation of the desired sideband: Apply a filter (usually a Hilbert transform or a similar method) to isolate the upper or lower sideband, resulting in the frequency-shifted output z(t).

Tokens and associated mathematical ideas:

  • control_group, control_type, default_value, max_value, min_value, modulateable, moverate, value_type: These tokens are related to defining and configuring the parameters of the frequency-shifting effect, such as the frequency shift amount, the sideband selection, and the mix between the dry and wet signals.

  • maybe_do_commented_c_process, update, pre_block, FreqShift, freqshift_smoke, init, suspend, post_block, process: These tokens correspond to functions and structures responsible for implementing the frequency-shifting effect. They handle tasks such as initializing the effect, processing the input signal, applying the modulation and filtering operations, and managing the effect's state.

By understanding the mathematical properties and functions associated with the SurgeFX-FreqShift crate, users can effectively integrate this powerful frequency-shifting effect into their Surge synthesizer system and create new and interesting sound transformations.

14> lets go back to the frequency shifter -- could you describe a dozen ways we can use this effect in the context of electronic music? please describe the effect we are trying to achieve, the parameters that get us there, and how it works

Frequency shifters can be utilized in various ways to achieve unique and interesting effects in electronic music. Here are twelve examples of how a frequency shifter can be used, along with the desired effect, parameters, and an explanation of how it works:

  1. Subtle detuning: Add a touch of detuning to thicken and enhance the sound of synth leads or pads. Set the frequency shift to a low value (e.g., 1-10 Hz) and mix with the dry signal. This creates a subtle beating effect due to phase differences, enriching the overall sound.

  2. Beat frequency oscillation: Apply a frequency shift to a drum loop or percussive sound to create rhythmic patterns or emphasize specific elements. Adjust the frequency shift to match the desired beat frequency and set the mix to blend the effect.

  3. Stereo widening: Apply a frequency shifter to create a stereo widening effect. Use a small frequency shift value on one channel (e.g., left) and a slightly different value on the other channel (e.g., right). This creates phase differences between the channels, enhancing the stereo image.

  4. Alien-like vocal transformations: Apply a frequency shifter to vocals to create otherworldly, alien-like effects. Set the frequency shift to a moderate value (e.g., 100-500 Hz) and adjust the mix to taste. This changes the harmonic structure of the vocals, producing an unusual and unique effect.

  5. Bass enhancement: Use a frequency shifter to add upper harmonics to bass sounds, making them more perceptible on smaller speakers. Set a moderate frequency shift value (e.g., 50-100 Hz) and blend it with the dry signal to create additional harmonics without drastically altering the original bass sound.

  6. Psychedelic effects: Apply a frequency shifter with a high frequency shift value (e.g., 500-2000 Hz) to create psychedelic, otherworldly soundscapes. Experiment with various modulation rates and depths to achieve different textures and movement in the sound.

  7. Ringing modulator: Use a frequency shifter as a ringing modulator by setting the frequency shift to a musically relevant interval (e.g., 100, 200, or 300 Hz). This creates a metallic, bell-like effect that can be used to add character to synth sounds, pads, or percussion.

  8. Formant shifting: Apply a frequency shifter to vocal samples or synthesized vowels to alter the formant structure without changing the pitch. Adjust the frequency shift and mix parameters to achieve the desired formant shift while maintaining the original pitch.

  9. Creating dissonance: Use a frequency shifter to create dissonance in harmonic or melodic material. Apply a small, non-musical frequency shift (e.g., 5-20 Hz) to introduce subtle beating and phase cancellation, creating a sense of tension and unease.

  10. Sound design for SFX: Apply a frequency shifter to create unique sound effects for electronic music productions. Experiment with various frequency shift values, modulation rates, and depths to generate interesting and evolving textures.

  11. Layering with reverb: Combine a frequency shifter with a reverb effect to create lush, evolving soundscapes. Apply the frequency shifter before or after the reverb in the signal chain to explore different textures and harmonic interactions.

  12. Resonance emphasis: Use a frequency shifter to emphasize specific resonant frequencies in a sound. Set the frequency shift to match the resonant frequency and adjust the mix to enhance the resonance.

These are just a few examples of how a frequency shifter can be used creatively in electronic music. Experiment with different frequency shift values, modulation rates, and

15> which input material is the most fruitfully frequency shifted? what can come downstream from this effect in the pipeline? what can come in parallel?

Frequency shifters can produce interesting effects with a variety of input materials, but some sources tend to yield more fruitful results:

  1. Harmonic-rich sounds: Synth leads, pads, and complex waveforms with rich harmonic content tend to produce more noticeable and interesting effects when frequency shifted, as the process alters the harmonic structure of the sound.

  2. Percussive sounds and drum loops: Frequency shifting can create interesting rhythmic patterns, emphasize specific elements, or add texture to drum loops and percussive sounds.

  3. Vocals and speech: Vocal samples, spoken word, or synthesized vowels can produce unique and otherworldly effects when frequency shifted, altering the formant structure or creating alien-like transformations.

In the processing pipeline, various effects can be used downstream from a frequency shifter to further shape the sound:

  1. Filters: Low-pass, high-pass, or band-pass filters can be used to control the frequency content of the shifted signal or emphasize specific frequencies.

  2. Distortion/Saturation: Applying distortion or saturation after frequency shifting can add warmth, harmonics, and character to the shifted sound.

  3. Delay and Reverb: Adding delay or reverb can create depth and space in the frequency-shifted sound, resulting in lush, evolving soundscapes or psychedelic effects.

  4. Chorus, Phaser, or Flanger: Modulation effects can be applied after frequency shifting to introduce additional movement and stereo width to the sound.

  5. Dynamics processing: Compressors, limiters, or transient shapers can be used to control the dynamics of the frequency-shifted signal and help it sit better in the mix.

In parallel processing, you can combine the frequency-shifted signal with other effects or a dry version of the input signal:

  1. Parallel compression: Apply compression to the frequency-shifted signal and blend it with the dry signal to maintain the original dynamics while adding the shifted effect.

  2. Parallel distortion: Distort the frequency-shifted signal and mix it with the dry signal to add harmonic richness without drastically changing the original sound.

  3. Parallel filtering: Apply different filters to the frequency-shifted and dry signals, and then mix them together to create complex spectral shapes or emphasize specific frequency ranges.

  4. Parallel modulation effects: Apply chorus, phaser, or flanger effects to the frequency-shifted signal and blend with the dry signal to create a more complex, evolving texture.

By combining a frequency shifter with various downstream or parallel effects, you can create a wide range of unique and expressive sounds that can be used in electronic music production.

16> could you teach me how the subcomponents of this effect work from a mathematical perspective? what about from the perspective of physics and engineering?

Sure! A frequency shifter works by altering the frequencies of the input signal, creating unique sound transformations. It operates using a process called single-sideband modulation. Let's break down the subcomponents of the effect from mathematical, physics, and engineering perspectives.

Mathematical Perspective

  1. Modulation: Frequency shifting is achieved by multiplying the input signal x(t) with a complex exponential signal `e^(j * 2 * pi
    • f_shift * t), where f_shiftis the desired frequency shift,jis the imaginary unit, andt` is time. This multiplication results in the sum and difference of the input frequencies, generating upper and lower sidebands.
y(t) = x(t) * e^(j * 2 * pi * f_shift * t)
  1. Isolation of the desired sideband: To obtain the frequency-shifted output, a filter (usually a Hilbert transform or a similar method) is applied to isolate either the upper or lower sideband. The filtered signal is then mixed back with the original signal or used on its own as the frequency-shifted output z(t).

Physics and Engineering Perspective

  1. Complex exponential signal generation: To generate the complex exponential signal, a local oscillator is used, which produces a sinusoidal signal with a frequency equal to the desired frequency shift. The sine and cosine components of this signal represent the real and imaginary parts of the complex exponential signal.

  2. Hilbert transform: The Hilbert transform is a linear, time-invariant operation that shifts the phase of each frequency component of the input signal by +90 degrees for the upper sideband or -90 degrees for the lower sideband. In digital systems, this is usually accomplished using a Fast Fourier Transform (FFT), phase manipulation, and an inverse Fast Fourier Transform (iFFT).

  3. Sideband filtering: To isolate the desired sideband, the modulated signal is passed through a filter that removes the unwanted sideband. In the case of the Hilbert transform, this filtering is inherently accomplished by the phase manipulation.

  4. Mixing or demodulation: The isolated sideband is then mixed back with the original signal or used independently as the frequency-shifted output. This can be done using various techniques, such as ring modulation, vector rotation, or phase vocoding.

By understanding the mathematics, physics, and engineering principles underlying the frequency shifter effect, you can better appreciate how it works and manipulate its subcomponents to create a wide range of unique sound transformations in electronic music.


~310K SLoC