Re: Audio Compression & Limiting - low CPU%
Posted: Wed Feb 19, 2020 5:20 pm
Firstly, thanks for the detailed explanation of your project. I'm always fascinated by projects which are not the usual synthesisers/effects, and I also have a personal interest in atypical hearing (I have difficulties of my own resolving sound sources from background noise - perceptual rather than physiological in my case).
Much of the maths required for your project is beyond me - I shall defer to Martin there - but I can answer a couple of the simpler questions!
- In practical terms, "ducking" usually refers to connecting the compressor side-chain to a different audio source than the one for which gain is controlled. The usual example is the announcements on radio shows, where the announcer's voice is sent to the side-chain of a compressor on the music channel, so that the music reduces in level whenever they are speaking.
- Square root is possible, though there is a caveat. The SSE2 'sqrtps' opcode will compute the square root for all four SSE channels. However, 'sqrtps' is limited to approximately 11-bits of precision ("half-precision"), so I'm unsure whether this will sufficient to meet your need for such a low threshhold. Unfortunately, the FPU 'fsqrt' opcode doesn't seem to be recognised, so there is no instruction available which is more precise. If you need greater precision, you would have to use e.g. Newton's method to refine the result of 'sqrtps'.
- In assembly, it is possibly to modify hopping so that the phase is controlled in addition to the interval. This allows the CPU peaks of hopped execution to be spread more evenly across time. This requires just one extra opcode...
Much of the maths required for your project is beyond me - I shall defer to Martin there - but I can answer a couple of the simpler questions!
- In practical terms, "ducking" usually refers to connecting the compressor side-chain to a different audio source than the one for which gain is controlled. The usual example is the announcements on radio shows, where the announcer's voice is sent to the side-chain of a compressor on the music channel, so that the music reduces in level whenever they are speaking.
- Square root is possible, though there is a caveat. The SSE2 'sqrtps' opcode will compute the square root for all four SSE channels. However, 'sqrtps' is limited to approximately 11-bits of precision ("half-precision"), so I'm unsure whether this will sufficient to meet your need for such a low threshhold. Unfortunately, the FPU 'fsqrt' opcode doesn't seem to be recognised, so there is no instruction available which is more precise. If you need greater precision, you would have to use e.g. Newton's method to refine the result of 'sqrtps'.
- In assembly, it is possibly to modify hopping so that the phase is controlled in addition to the interval. This allows the CPU peaks of hopped execution to be spread more evenly across time. This requires just one extra opcode...
Code: Select all
mov eax, ecx;
add eax, 10; // Hop phase in samples.
and eax, 127; // Hop interval (must be a power of two) minus one.
jnz BypassCode;
// Hopped code here.
BypassCode: // End of hopped code.