Sometime ago, I was inspired by the article How to Use Transeint Designers in Your Mixes at audio tuts+. I ended up creating a crude Max/MSP patch that loosely approximated what I took away from the article. Over the weekend, I reimplemented this patch in Csound, creating a drum transient processor.
Source Code: drum_transient_processor.csd
So how does it work? Audio from a sample is played through a user-defined opcode transient detector, called Transient. Transient works by running the audio through the built-in opcode rms. The yielded rms value is divided by the previous rms value. If the ratio is greater than or equal to a user-set threshold, then the output is 1, else 0.
The output of Transient is then used to trigger (or not trigger) a built-in envelope generator. Basically, a trigger causes the envelope to be reset to 1. The envelope value decays over time until it reaches 0; The decay is set by the user. This envelope is multiplied by a copy of the original sample audio signal and an amplitude value set with pfield 6. The original audio and transient audio are mixed together, based on the value specified at pfield 5, and then sent to the output
One other feature built into this example is that user’s can set a value that determines the minimum amount of time that must pass before the envelope can be triggered again.
As for the audio example. The tempo of the sample is originally 110, though I play it at 165 BPM. It is played 8 times, with various transient settings. These settings are as follows:
1. Original audio unmodified.
2. Transients only.
3. Original audio mixed with transients.
4. Original audio mixed with transients, with emphasis on transients.
5. Transients only, with the RMS threshold and minimum delta time settings modified so that less transients are detected.
6. Same as 5, with a little of the original audio mixed in.
7. Original audio mixed with transients, except transients have been given a negative amplitude value, so that it is now 180 degrees out of phase, which cancels out the transient.
8. Same as 7, though with subtle changes to the numbers.