I am looking for a possibilty to invert the envelope of a sound file (y-axis).
So that high amplitudes will be muted and low amplitudes will be amplified.
I tried working with plugins like hyperexp (where every amplitude is muted or amplified to about the same level)
and other Compressor effects but as I am totally new on Nyquist, it is hard to figure in which way i can analyze the envelope and write a function for the inversion of the data.
As far as i understand i need 3 steps.
Analysing the sound file to get the data of the amplitudes
Write a function to set new values for each amplitude automatically
Apply the new values on the sound file to output the inverted envelope
For the first point i tried (linear-to-db signal) but i could not find out in which range the data is output to get the right function for the inversion. For the last point i thougt a (vector) should do it, but as I said Im not really into it.
Anyones got a hint? Guess it would not be very difficult if i was more familiar with Nyquist.
Examples below are for mono tracks. The can be expanded to work with stereo tracks later if required, but it is simpler to start with mono tracks.
For the first step you need some sort of “envelope follower”. That is, to track the amplitude of the input.
A simple way to do that is with the function snd-avg Nyquist Functions
For example, if you select a (mono) track and apply the code (using the “Nyquist Prompt” effect):
(setq step 100)
(snd-avg s step step op-peak)
The first thing that you will notice with this is that the output length will be very much shorter than the selected audio.
What it is doing is looking at the peak level in each successive 100 samples, thus each sample of the output represents 100 samples of the input. If you zoom in on the result you will see that it has the same “shape” (envelope) as the input.
Setting “step” to a larger value will make the envelope smoother as it is then riding over a larger number of samples.