Q: band limited difference curve
- KVRAF
- Topic Starter
- 2568 posts since 4 Sep, 2006 from 127.0.0.1
sadly i abandoned this idea, i tried things but the approximations were either poor or very complex/heavy
i still wish something like that could be done tho
so maybe not "BLDC" alone, but a combination of that plus 2x oversampling.. to hide the ugliness above nyquist
i still wish something like that could be done tho
so maybe not "BLDC" alone, but a combination of that plus 2x oversampling.. to hide the ugliness above nyquist
It doesn't matter how it sounds..
..as long as it has BASS and it's LOUD!
irc.libera.chat >>> #kvr
..as long as it has BASS and it's LOUD!
irc.libera.chat >>> #kvr
-
- KVRian
- 1275 posts since 9 Jan, 2006
Maybe I misunderstood the idea, but it seemed the residual function (difference curve) is for a fixed frequency as it covers the full cycle of the waveform? Is that right? Where as the for blep/blamp we only need the residual of the discontinuity.
So, where as for blep you can apply the same residual regardless of the frequency, but with BLDC the difference curve would be frequency dependant. Or perhaps I misunderstood the whole thing
EDIT:
So, where as for blep you can apply the same residual regardless of the frequency, but with BLDC the difference curve would be frequency dependant. Or perhaps I misunderstood the whole thing
EDIT:
I think it is a solved problem: BLEP/BLAMPantto wrote:i still wish something like that could be done tho
- KVRAF
- Topic Starter
- 2568 posts since 4 Sep, 2006 from 127.0.0.1
see the first post, the idea was that on one hand you have a naive sawtooth(phase) function, and on the other you have a bandlimited_sawtooth(phase, H) function which simply adds H sinewaves together to construct your sawtoothmatt42 wrote:Maybe I misunderstood the idea, but it seemed the residual function (difference curve) is for a fixed frequency as it covers the full cycle of the waveform? Is that right? Where as the for blep/blamp we only need the residual of the discontinuity.
So, where as for blep you can apply the same residual regardless of the frequency, but with BLDC the difference curve would be frequency dependant. Or perhaps I misunderstood the whole thing
then i subtract those two functions and call the result "BLDC" and its approximation thus has a H parameter
maybe i should've given up looking for an approximation and went the "LUT" way instead..
It doesn't matter how it sounds..
..as long as it has BASS and it's LOUD!
irc.libera.chat >>> #kvr
..as long as it has BASS and it's LOUD!
irc.libera.chat >>> #kvr
-
- KVRian
- 1275 posts since 9 Jan, 2006
OK, thanks I think I understand better now. I would say that coming up with a decent function for a single value of H isn't so easy, but coming up with an algo for arbitrary values of H will be really tough. Compare that to polyblep or something where you just need to integrate a triangular function (piecewise integration of straight lines)antto wrote:see the first post, the idea was that on one hand you have a naive sawtooth(phase) function, and on the other you have a bandlimited_sawtooth(phase, H) function which simply adds H sinewaves together to construct your sawtooth
then i subtract those two functions and call the result "BLDC" and its approximation thus has a H parameter
Perhaps, but I guess you arrive at something somewhat equivalent to wavetable synthesis?antto wrote:maybe i should've given up looking for an approximation and went the "LUT" way instead..
Last edited by matt42 on Sun Aug 05, 2018 8:54 pm, edited 1 time in total.
-
- KVRAF
- 1607 posts since 12 Apr, 2002
The BLEP function is Si(x) (called "Sine integral"). Even though the integral itself can't be taken analytically, from the point of view of computation this function is as "computable" as sin(x) or sinc(x). The thing is that typical modern CPUs can't compute sin(x) and software needs to use a special routine (e.g. from the standard library) to do that. In the same way there are routines to compute Si(x). Or it can be tabulated. The BLEP residual can be then computed by simply subtracting the step function from Si(x). However, to be practically implementable it needs to be windowed to make it time-limited.
The residual of the complete sawtooth OTOH is (as it was already noted here) frequency-dependent, which means the table will be frequency-dependent. Note that it is simply equal to the sum of BLEP residuals spaced at the sawtooth period's distance.
The residual of the complete sawtooth OTOH is (as it was already noted here) frequency-dependent, which means the table will be frequency-dependent. Note that it is simply equal to the sum of BLEP residuals spaced at the sawtooth period's distance.
- KVRAF
- 8476 posts since 12 Feb, 2006 from Helsinki, Finland
The problem with windowing analytically integrated sinc though is that windowing works best when the spectrum looks like a brickwall step with two flat regions. Every additional integration adds a 6dB/oct low-pass slope to a sharp high-pass filter that results in a "spike" in the spectrum around the cutoff point, which degrades the performance of a post-integration windowed design quite a bit for every additional integral... in my experience making the result essentially useless.Z1202 wrote:The BLEP function is Si(x) (called "Sine integral"). Even though the integral itself can't be taken analytically, from the point of view of computation this function is as "computable" as sin(x) or sinc(x). The thing is that typical modern CPUs can't compute sin(x) and software needs to use a special routine (e.g. from the standard library) to do that. In the same way there are routines to compute Si(x). Or it can be tabulated. The BLEP residual can be then computed by simply subtracting the step function from Si(x). However, to be practically implementable it needs to be windowed to make it time-limited.
That's the main reason I still personally generate all my BLEPs by numerically integrating a windowed sinc. While I also have code for doing the integration analytically, the performance after windowing just isn't there. I suppose applying a window that you can analytically integrate with the rest of it could work, but never tried that.
-
- KVRist
- 92 posts since 26 Sep, 2005 from France
Noway FSIN & FSINCOS were added to the 387 series of coprocessors...Z1202 wrote:The BLEP function is Si(x) (called "Sine integral"). Even though the integral itself can't be taken analytically, from the point of view of computation this function is as "computable" as sin(x) or sinc(x). The thing is that typical modern CPUs can't compute sin(x) and software needs to use a special routine (e.g. from the standard library) to do that.
it's a long time that is not anymore computed in software.
-
- KVRAF
- 1607 posts since 12 Apr, 2002
I fear this info may be a little outdated (along with 387 FPU). For one, IIRC, on Win64 one even can't use FPU, because it's not handled correctly by the OS during context switching anymore. Also, I'm not sure whether FPU is well maintained on the hardware level, in the sense of performance, or is it just a compatibility-ensuring inefficient implementation. At any rate it seems that sinf(x) in MSVC x64 is not 387-based anymore.Chaotikmind wrote:Noway FSIN & FSINCOS were added to the 387 series of coprocessors...Z1202 wrote:The BLEP function is Si(x) (called "Sine integral"). Even though the integral itself can't be taken analytically, from the point of view of computation this function is as "computable" as sin(x) or sinc(x). The thing is that typical modern CPUs can't compute sin(x) and software needs to use a special routine (e.g. from the standard library) to do that.
it's a long time that is not anymore computed in software.
-
- KVRAF
- 1607 posts since 12 Apr, 2002
Interesting observation. Didn't notice this in my experiments, but that was a very long time ago, so I'm not sure if I missed the poor qualities of BLAMP spectra, or whether my window choice was good enough to offset the effect you're mentioning.mystran wrote:The problem with windowing analytically integrated sinc though is that windowing works best when the spectrum looks like a brickwall step with two flat regions. Every additional integration adds a 6dB/oct low-pass slope to a sharp high-pass filter that results in a "spike" in the spectrum around the cutoff point, which degrades the performance of a post-integration windowed design quite a bit for every additional integral... in my experience making the result essentially useless.
I mean, if you're integrating a windowed BLEP residual, you're also e.g. increasing the relative amplitude of the "aliasing" in the audible range, since the integration boosts lower frequencies. So the question is, which effect is stronger and that might depend on the window size and shape.
-
- KVRist
- 92 posts since 26 Sep, 2005 from France
It is more an OS related issue, anyway you got me curious and i checked it, indeed it is compiled to a shitload of instructions...Z1202 wrote:I fear this info may be a little outdated (along with 387 FPU). For one, IIRC, on Win64 one even can't use FPU, because it's not handled correctly by the OS during context switching anymore. Also, I'm not sure whether FPU is well maintained on the hardware level, in the sense of performance, or is it just a compatibility-ensuring inefficient implementation. At any rate it seems that sinf(x) in MSVC x64 is not 387-based anymore.Chaotikmind wrote:Noway FSIN & FSINCOS were added to the 387 series of coprocessors...Z1202 wrote:The BLEP function is Si(x) (called "Sine integral"). Even though the integral itself can't be taken analytically, from the point of view of computation this function is as "computable" as sin(x) or sinc(x). The thing is that typical modern CPUs can't compute sin(x) and software needs to use a special routine (e.g. from the standard library) to do that.
it's a long time that is not anymore computed in software.
Didn't realize it was an issue until right now ...
Edit: the best case scenario seems to be when FMA3 instruction set is used.
- KVRAF
- 8476 posts since 12 Feb, 2006 from Helsinki, Finland
Not true. It works perfectly fine, it's just that compilers don't normally use it, except for extended precision. Since the instructions that save/restore SSE state also save/restore the legacy FPU state, it would actually take additional effort for the OS to explicitly NOT support the legacy FPU.Z1202 wrote:For one, IIRC, on Win64 one even can't use FPU, because it's not handled correctly by the OS during context switching anymore.
I checked Agner's charts and most modern desktop processors take 50-100 cycles or so to do FSIN. Atom takes a whole lot more... and then you add whatever overhead you get from moving your data from the SSE unit to the x87 when rest of your FPU code is on the SSE unit.. and you can't SIMD... so like... realistically for high performance algorithms you almost certainly want to use a software implementation.Also, I'm not sure whether FPU is well maintained on the hardware level, in the sense of performance, or is it just a compatibility-ensuring inefficient implementation. At any rate it seems that sinf(x) in MSVC x64 is not 387-based anymore.
-
- KVRAF
- 1607 posts since 12 Apr, 2002
Although, upon further thinking, it seems that the "low-frequency" content is always strictly harmonic, so even if it distorts the low-frequency spectrum, it won't create any inharmonic components. Not sure how large the distortion could get though.Z1202 wrote:I mean, if you're integrating a windowed BLEP residual, you're also e.g. increasing the relative amplitude of the "aliasing" in the audible range, since the integration boosts lower frequencies. So the question is, which effect is stronger and that might depend on the window size and shape.
- KVRAF
- 8476 posts since 12 Feb, 2006 from Helsinki, Finland
Since the "BLEP residue" is essentially "pure aliasing" at the base processing sampling rate, the question for numerical integration is whether the oversampling factor of the (windowed) BLEP kernel is sufficiently high that it well approximates the continuous time kernel... ie. whether the remaining aliasing from sampling the BLEP residue at some high oversampling factor is still meaningful. This aliasing will certainly be boosted during integration.Z1202 wrote:Although, upon further thinking, it seems that the "low-frequency" content is always strictly harmonic, so even if it distorts the low-frequency spectrum, it won't create any inharmonic components. Not sure how large the distortion could get though.Z1202 wrote:I mean, if you're integrating a windowed BLEP residual, you're also e.g. increasing the relative amplitude of the "aliasing" in the audible range, since the integration boosts lower frequencies. So the question is, which effect is stronger and that might depend on the window size and shape.
The big problems however tend to be either harmonic amplitude mismatch just slightly above the cutoff point (ie. aliasing doesn't cancel sufficiently well; personally I've never managed to get reasonable results with analytic approaches here) or step-discontinuities at the beginning/end of the window higher-order BLEP due to repeated numerical integration (which can be mitigated by using a window with better continuity at the end-points.. up to a point anyway).
-
- KVRAF
- 1607 posts since 12 Apr, 2002
Oh, I didn't mean that aliasing. I was assuming that integration is done offline with very high precision (I mean, the time-domain resolution)mystran wrote:Since the "BLEP residue" is essentially "pure aliasing" at the base processing sampling rate, the question for numerical integration is whether the oversampling factor of the (windowed) BLEP kernel is sufficiently high that it well approximates the continuous time kernel... ie. whether the remaining aliasing from sampling the BLEP residue at some high oversampling factor is still meaningful. This aliasing will certainly be boosted during integration.
Hmmm, to get good response at the cutoff you need a long window (just by the Heisenberg principle). However, I wonder how critical is that. E.g. if the software is running at 88kHz or above (which is reasonable to mitigate the prewarping BLT artifacts and reduce the aliasing from nonlinearities at least a bit), you have quite a lot of headroom below Nyquist.mystran wrote:The big problems however tend to be either harmonic amplitude mismatch just slightly above the cutoff point (ie. aliasing doesn't cancel sufficiently well; personally I've never managed to get reasonable results with analytic approaches here) or step-discontinuities at the beginning/end of the window higher-order BLEP due to repeated numerical integration (which can be mitigated by using a window with better continuity at the end-points.. up to a point anyway).
