Hey, I discovered something interesting and I'd like to discuss it. I haven't tested any of this, so let me know if I'm completely utterly wrong.
Bandlimited synthesis produces something called the Gibbs Phenomenon. Basically, each transition is surrounded by a bunch of oscillations that get bigger and bigger until the actual transition, and then they get smaller and smaller. This adds a high-pitched "ringing" around every transition, which ends up exaggerating the treble of the sound, making it sound tinny. Most of you probably don't care, but if you're a programmer, there's a good reason to care:
The most common way I've seen to implement bandlimited transitions (called BLEPs for some reason) is to have a circular buffer, and then have a 2-dimensional table of BLEPs at various different offsets. Whenever a transition needs to occur, you paste the appropriate BLEP into the circular buffer.
The BLEP table (and the subsequent circular buffer) needs to be somewhat big because the oscillations take a while to stabilize to a point where they're too small to represent, and you need to represent all of them until that point.
If you were to somehow reduce the Gibbs phenomenon, not only would you bring the shape of the transition closer to its ideal shape (a square wave), you also reduce the oscillating artifact that you need the big tables for.
The method I've discovered for attenuating the Gibbs phenomenon is called sigma approximation.
The common way to generate a square wave via its harmonics is like this:
Let N be the number of odd harmonics you want
For n = 1 to N
Let P = (2n - 1)
output += sin(P * x) / P
Using sigma approximation (which I don't actually know how to do, I just looked this up), you can produce a Gibbs-attenuated version of this square wave, like this:
N, n, and P are the same as before.
Let Q = (PI / (2*N))
output += ((sin(P*Q)/(P*Q)) * sin(P * x)) / P
(Stuff is highlighted so it's less like a jungle of parentheses)
This produces a square wave, but the oscillations that surround each transition are greatly reduced, and stabilize much more quickly.
If you compare the two methods, the Gibbs-attenuated version neither adds nor subtracts harmonics, it only adjusts the amplitude of the existing ones. That means that the Gibbs-attenuated square wave is still bandlimited, even though it looks slightly different, so no aliasing. In addition, the reduction in those oscillations means they stabilize much more quickly, so you can use a much smaller buffer and a smaller table. Finally, the lack of Gibbs means the sound itself no longer has the ringing artifacts that surround each transition, and the waveform looks much closer to what the ideal output would be.
So why doesn't anyone use this? Is it completely wrong?
Bandlimited synthesis produces something called the Gibbs Phenomenon. Basically, each transition is surrounded by a bunch of oscillations that get bigger and bigger until the actual transition, and then they get smaller and smaller. This adds a high-pitched "ringing" around every transition, which ends up exaggerating the treble of the sound, making it sound tinny. Most of you probably don't care, but if you're a programmer, there's a good reason to care:
The most common way I've seen to implement bandlimited transitions (called BLEPs for some reason) is to have a circular buffer, and then have a 2-dimensional table of BLEPs at various different offsets. Whenever a transition needs to occur, you paste the appropriate BLEP into the circular buffer.
The BLEP table (and the subsequent circular buffer) needs to be somewhat big because the oscillations take a while to stabilize to a point where they're too small to represent, and you need to represent all of them until that point.
If you were to somehow reduce the Gibbs phenomenon, not only would you bring the shape of the transition closer to its ideal shape (a square wave), you also reduce the oscillating artifact that you need the big tables for.
The method I've discovered for attenuating the Gibbs phenomenon is called sigma approximation.
The common way to generate a square wave via its harmonics is like this:
Let N be the number of odd harmonics you want
For n = 1 to N
Let P = (2n - 1)
output += sin(P * x) / P
Using sigma approximation (which I don't actually know how to do, I just looked this up), you can produce a Gibbs-attenuated version of this square wave, like this:
N, n, and P are the same as before.
Let Q = (PI / (2*N))
output += ((sin(P*Q)/(P*Q)) * sin(P * x)) / P
(Stuff is highlighted so it's less like a jungle of parentheses)
This produces a square wave, but the oscillations that surround each transition are greatly reduced, and stabilize much more quickly.
If you compare the two methods, the Gibbs-attenuated version neither adds nor subtracts harmonics, it only adjusts the amplitude of the existing ones. That means that the Gibbs-attenuated square wave is still bandlimited, even though it looks slightly different, so no aliasing. In addition, the reduction in those oscillations means they stabilize much more quickly, so you can use a much smaller buffer and a smaller table. Finally, the lack of Gibbs means the sound itself no longer has the ringing artifacts that surround each transition, and the waveform looks much closer to what the ideal output would be.
So why doesn't anyone use this? Is it completely wrong?