Noob with questions about advanced stuff

I am a long term mixer/sound designer/producer with web development background but I’m a noob at Juce and I wanna make something great long term, but I’m not sure where to look.

I wanna know for example how to work with phase.

From what I can tell after a bunch of googling there isn’t really a way to tap directly into phase itself other than rotating it? How does fabfilter achieve its natural phase algorithm for example? I mean, isn’t there a way to modify a sound and then afterwards bend solely the phase somehow?

I’m also curious what math to study for all this stuff, low noise to floor oscillators in Serum for instance required a mathematician according to its creator. First of all, where in what Juce function would you apply that math formula exactly so I can at least mess with it while learning the math if I so chose?

All this type of wizardry knowledge seems hidden behind closed doors or am I googling the wrong things?

I’m obviously going to start small, but I wouldn’t make 20 base level plugins from start to finish, I’m looking to make a baseline component that does one simple thing with a boilerplate interface and take steps to make that component the best it can be, whatever it is I end up making.

Any advice would be appreciated.

EDIT: You guys are amazing!

Just take the simples demo from juce, an audioplugin, e.g. gainplugin.
Now you just hack a bit in the processor() function. A big part of starting up is to just learn to compile a plug.
then try to build simple functions, by simple doing some math on the samples, on the spot where the gain is altered. You can easily make a simple distortion/clipper with simple c++ functions.
Then learn how to use filters. At first keep it very simple, just reuse the gain knob in the demo fro adjusting your algorhythms.
This is the way I kind of learned it too.

Sure but I’ve seen tutorials of the things you’ve mentioned but nothing answered the questions I have in my post. Don’t get me wrong, I will do the basic tutorial stuff, but while I’m commuting I want to research the other things I mentioned, but I haven’t had luck finding the answers. I also looked through the documentation a bit, didn’t find an answer there either.

rotating phase: you can take a phaser, which works with allpassfilters or you can do a full FFT-inverseFFT.
Allpassfilters will not rotate the phase evenyl over the spectrum, there is a curve you can not easily compensate.
FFT synthese and resynthesis will introduce latency and is less straightahead then you might expect at first. Allthough the resynthesis is perfect, you still need to stitch overlapping windows toi get it right.

1 Like

“low noise to floor oscillators”: no idea what that means, never heard of ti and Google leads me astray.
generally oscillators can be build using
a) resonators,
b) using a sine function,
c) around another line drawing model using BLEP or other stuff to keep the bandwidth under nqyuist,
d) using wavetables, which are filled with bandlimited content
e) bandlimited pulses going straignth into a filter (very oldschool methode)

1 Like

The thing is: implementations of the fundamental stuff are often on an engineering level, meaning that people people spend months/years on achieving their goals with stuff, but dont publiciy communicate their findings, because it then is a commercial product, Intellectual Property (IP)
You allways have to reinvent an awfull lot of stuff to get there where others where long ago. I’m not talking here about simpler stuff here you can find in opensource github projects, but things like good pitchshifters, good frequency analysers, good triggers.

1 Like

in your case I think chatgpt would be the best help. Although sometimes it is erratic in implementing code, and sometimes it raves. It can give you a lot of hints on what to look for, and other times it will give you information that is very hard to find with google.

For example, to the question of: How does fabfilter achieve its natural phase algorithm ?

As of my last knowledge update in September 2021, FabFilter, a company known for its high-quality audio processing plugins, hasn’t publicly disclosed the specific details of their proprietary algorithms, including their “Natural Phase” algorithm. Therefore, I don’t have access to the exact technical details of how they achieve their natural phase algorithm.

However, I can provide you with some general information about phase algorithms and their importance in audio processing.

Phase in audio refers to the relationship in time between different frequency components of a signal. When audio signals are processed, especially through filters and equalizers, phase shifts can occur. These phase shifts can lead to undesirable effects such as phase cancellations and alterations in the perceived sound quality.

Several methods exist for maintaining natural phase characteristics during audio processing:

  1. Linear Phase Filters: Linear phase filters are designed to maintain a constant phase shift across all frequencies. This means that the phase relationships between different frequency components are preserved. Linear phase filters are often used in situations where maintaining the timing relationships between different parts of the audio is critical, such as in mastering applications.

  2. Minimum Phase Filters: Minimum phase filters prioritize preserving the shortest delay between different frequency components, even if it means introducing varying phase shifts. While these filters may not maintain constant phase relationships, they can often sound more “natural” due to their similarity to how sound waves naturally behave.

  3. Hybrid Phase Algorithms: Some algorithms aim to strike a balance between linear and minimum phase characteristics. These algorithms attempt to minimize phase distortion while also avoiding excessive pre-ringing (a phenomenon where a signal precedes the attack of a sound source).

  4. Proprietary Algorithms: Companies like FabFilter may develop their own unique algorithms that they believe provide a more natural phase response. These algorithms could involve a combination of techniques to achieve the desired phase behavior while minimizing unwanted artifacts.

It’s worth noting that FabFilter is known for its emphasis on user interface design and providing a balance between advanced features and user-friendly interaction. They might incorporate various techniques and ideas to achieve their “Natural Phase” algorithm, but the specific details are not publicly available.

For the most accurate and up-to-date information, I recommend checking FabFilter’s official documentation, whitepapers, or directly contacting their support or technical team.

show me a C++ example of Phase algorithm

Certainly! Below is a simple example of a phase-shifting algorithm implemented in C++. This example demonstrates a basic phase shift of a sinusoidal signal.

#include <iostream>
#include <cmath>

const double PI = 3.14159265358979323846;

// Function to apply a phase shift to a signal
void applyPhaseShift(double* signal, int length, double phaseShift) {
    for (int i = 0; i < length; ++i) {
        double angle = 2.0 * PI * i / length;
        signal[i] *= std::cos(angle + phaseShift);
    }
}

int main() {
    const int signalLength = 100;  // Length of the signal
    double signal[signalLength];   // Input signal (initially a sinusoidal signal)

    // Generate a sinusoidal signal
    for (int i = 0; i < signalLength; ++i) {
        double angle = 2.0 * PI * i / signalLength;
        signal[i] = std::sin(angle);
    }

    double phaseShift = PI / 4.0;  // Phase shift in radians

    // Apply the phase shift
    applyPhaseShift(signal, signalLength, phaseShift);

    // Print the original and phase-shifted signals
    std::cout << "Original Signal:\n";
    for (int i = 0; i < signalLength; ++i) {
        std::cout << signal[i] << " ";
    }
    std::cout << "\n";

    return 0;
}

In this example, we start with a simple sinusoidal signal and apply a phase shift to it using the applyPhaseShift function. The phase shift is specified in radians. The function modifies the input signal by multiplying each sample by a cosine function that includes the phase shift. This effectively shifts the phase of the signal.

Keep in mind that this is a basic example to demonstrate the concept of phase shifting. Real-world audio processing algorithms are much more complex and involve considerations like windowing, filtering, and handling different types of input signals.

Or when looking at the generated code, worst :smiley:
Nothing really to learn from it, e.g apply a “phase shift” of pi/2 and you get all negative values, generating negative DC. That’s not really phase shifting a signal
In my opinion, the best advice is to learn DSP, and not trust what an AI thinks you might want.

5 Likes

I’ve found there’s a bit of a gap between what you can learn from books (and you should, there are many great books on audio DSP) and what commercial plug-ins do in practice. And this “secret sauce” is, well, secret.

One way to decipher what the pros do, is to look at the source code of older plug-ins that have been released as open source. Some developers, such as Airwindows, even open source all their stuff. It can be tricky to read other people’s code, but whenever I do, I learn a lot.

You can get started here with some repos I made as a “plug-in archeology” project:

As for the Serum oscillators, the problem with a naive wavetable oscillator is that it aliases. To solve this you can apply interpolation and a few other tricks. Steve Duda didn’t feel like he was up to doing this himself so he hired someone. Fortunately, we can learn these tricks for free from an excellent ADC talk by Matt Tytel, creator of Vital.

That’s really the other main source of info: ADC talks. Plus these forums, the old music-dsp mailing list archives, the KVR developer forums, and a few other places.

4 Likes

Thank you so much!

I’ll look into DSP, thanks!

I actually tried once and it gave me code with variables that were totally unused, but I guess it’s one way to find out about certain C++ functions.

chatgpt is currently the best help a programmer can get.

Although it is true that the old free version fails in coding. In the current version chatgpt tests the code by itself.

that’s a lot of stuff, like whole different directions of dsp. focus on just one thing first. there will be enough problems, trust me

1 Like

I believe you!