If tuned correctly, this technique can be used to separate the pitched parts of the spectrum from the noisy parts. In practice this depends greatly on the type of sound, the quality of the recording and digitization, and also on the analysis window size and frame increment. Next is an example using amplitude gating. The last 2 in the argument list stands for f2 in the score. In this case the lower the amplitude the more severe the scaling down would be.
Functions can be arbitrarily complex.
Just remember that the normalized amplitude values of the analysis are themselves the indeces into the function. Finally, both spectral extraction and amplitude gating can be used together. The author uses pvadd to synthesis one bin at a time to have control over each separate component of the re-synthesis. If any combination of ibins , ibinoffset , and ibinincr , creates a situation where pvadd is asked to used a bin number greater than the number of bins in the analysis, it will just use all of the available bins, and give no complaint. Expect to have to scale up the amplitudes by factors of 10-100, by the way.