How to make Low/High Pass remove perfect, cut, not faded or smooth frequencies

I’m trying to cut low frequencies when set to Add, and remain high frequencies, set for below the Hertz frequency so the unwanted reflection is erased. When I run this and choose “Add”;

;nyquist plug-in
;version 4
;type process
;name "Frequency Up"
;restoresplits 0
;control type "Frequency Raise Method" choice "Multiply,Add" 0
;control factor "Up In Percent Or Hertz" float "" 100 10 10000

(setf factor (+ (/ factor 100) 1))
(let ((slen (get-duration 1))
      (target (get-duration factor))
      map)
  (setf map (abs-env (pwlv 0 target slen)))
  (case type
    (0 (resample (phasevocoder *track* map 2048 256 1)
                 (/ *sound-srate* factor)))
    (t     (mult *track* (hzosc (* 100 factor) *sine-table* 90)
	       (highpass8 *track* (* 1 factor)))
	)))

This does like a smooth wipe, faded from frequency to frequency, but I need an instant cut (like Spectral Delete, but number in “Factor” used) so the lower frequencies below “Factor” is removed, but frequency above remains. How would you adjust this code? And is there a simple code that is small and easily human-readable?

Is there a special “High Pass” or some code setting I can use in this file?

No filters have “instant” cut, not even Spectral Delete. Spectral Delete has extremely steep filter slopes, but they still slope and are not “instant”.

You can increase the steepness of Nyquist’s “highpass8” filter by cascading it like this:

(defun highpass (sig hz)
  (highpass8
    (highpass8
      (highpass8 sig hz)
      hz)
    hz))


(highpass *track* 1000)

It still isn’t as steep as Spectral Delete, but it is still pretty steep.

If you want to get much steeper than that, you need a more advanced type of filter, such as the one used in Spectral Delete, but the code becomes much more complex.
See: https://github.com/audacity/audacity/blob/master/plug-ins/spectral-delete.ny

What do I use in place of “sig” and “hz”? is “hz” the frequency? and what is up with the signal (if that is what “sig” stands for)?

This isn’t working…

;nyquist plug-in
;version 4
;type process
;name "Frequency Up"
;restoresplits 0
;control type "Frequency Raise Method" choice "Multiply,Add" 0
;control factor "Up In Percent Or Hertz" float "" 100 10 10000

(setf factor (+ (/ factor 100) 1))
(let ((slen (get-duration 1))
      (target (get-duration factor))
      map)
  (setf map (abs-env (pwlv 0 target slen)))
  (case type
    (0 (resample (phasevocoder *track* map 2048 256 1)
                 (/ *sound-srate* factor)))
    (t     (mult *track* (hzosc (* 100 factor) *sine-table* 90)
	(defun highpass (sig hz)
    (highpass8
    (highpass8
    (highpass8 sig hz)
    hz)
    hz))

(highpass *track* factor)
    ))
	))

How do I make “(highpass track )” work with being a value from another tool? I want to try to use the value in the Add setting, raising frequency (not moving) and erasing anything below with the highpass, both using single only.

Not to be mean, but could you try to be a little more clear? Where do I add the highpass’s?

Put the function definition before you need to use it.
You then call the function like this:
(highpass sound frequency)
where sound is the sound that you want to filter, and frequency is the filter frequency.

Example:

;nyquist plug-in
;version 4
;type process
;name "Frequency Up"
;restoresplits 0
;control type "Frequency Raise Method" choice "Multiply,Add" 0
;control factor "Up In Percent Or Hertz" float "" 100 10 10000

(defun highpass (sig hz)
  (highpass8
    (highpass8
      (highpass8 sig hz)
      hz)
    hz))

(setf mysound (mult *track* (hzosc factor *sine-table* 90)))
(highpass mysound factor)

I need it to switch back-and-forth from one to the other;

;nyquist plug-in
;version 4
;type process
;name "Frequency Up"
;restoresplits 0
;control type "Frequency Raise Method" choice "Multiply,Add" 0
;control factor "Up In Percent Or Hertz" float "" 100 10 10000

(setf factor (+ (/ factor 100) 1))
(let ((slen (get-duration 1))
      (target (get-duration factor))
      map)
  (setf map (abs-env (pwlv 0 target slen)))
  (case type
    (0 (resample (phasevocoder *track* map 2048 256 1)
                 (/ *sound-srate* factor)))
    (t     (mult *track* (hzosc (* 100 factor) *sine-table* 90)))
	))

I am starting to get frustrated. I want it to change pitch when on Multiply, but do this effect that we made when switched to Add;

(defun highpass (sig hz)
  (highpass8
    (highpass8
      (highpass8 sig hz)
      hz)
    hz))

(setf mysound (mult *track* (hzosc factor *sine-table* 90)))
(highpass mysound factor)

Please give me fully working code. I was editing it around, and can’t get it to work.

No filters have “instant” cut, not even Spectral Delete.

What he said. Brick Wall Filters are not fun. They leave high energy trash at the transitions and create distortions to the original sound or performance.

Here’s a little two-second sample of 300Hz (mellow) tone. All there is in the sound file is 300Hz and silence, and yet there’s a tick sound at the end of the tone and, depending on your system, at the beginning, too. Where did the tick or pop come from?


Koz

You wrote:

(case type
    (0 (resample (phasevocoder *track* map 2048 256 1)
                 (/ *sound-srate* factor)))
    (t     (mult *track* (hzosc (* 100 factor) *sine-table* 90)
	       (highpass8 *track* (* 1 factor)))
	)))

I’ll rewrite that so that it’s easier to see what’s happening:

(case type
  (0 (resample (phasevocoder *track* map 2048 256 1)
               (/ *sound-srate* factor)))
  (t (mult *track*
           (hzosc (* 100 factor) *sine-table* 90)
           (highpass8 *track* (* 1 factor)))))

So that’s saying:

If “type” = 0
then do
otherwise
multiply
track x
(hzosc (* 100 factor) sine-table 90) x
(highpass8 track (* 1 factor))


If you want to replace “highpass8” with the new “highpass” filter, then we look at the “highpass” function definition to see what the necessary syntax is:

(defun highpass (sig hz)
  (highpass8
    (highpass8
      (highpass8 sig hz)
      hz)
    hz))

We see that “highpass” takes two arguments, which are the “signal” to be processed, and the “frequency” (in Hz).
So we need to replace (highpass8 track (* 1 factor)) with (highpass track (* 1 factor)),

but what is (* 1 factor) ?
Why are you multiplying “factor” by 1?
factor x 1 = factor, so better for us to use
(highpass track factor)

Then the code becomes:

(case type
  (0 (resample (phasevocoder *track* map 2048 256 1)
               (/ *sound-srate* factor)))
  (t (mult *track*
           (hzosc (* 100 factor) *sine-table* 90)
           (highpass *track* factor))))

I don’t know what a Brick Wall Audio is, but I’ll try to be more specific in visual. Moving up the spectrum using a Sine in Ring Modulation, and clipping out bottom reflected ringing. The picture shows original audio, what I am trying to get or something similar to get when set to “Add” and “3000”, and what I get in result when I use the code and set to “Add” and “3000”.
Example4.jpg

Here is another example with no high-pass, which is what I am trying to use to remove the bottom reflection. Note that the “reflection” I’m trying to at least somewhat remove is below 3000Hz, which is an inverted version of what is above 3000Hz.
Example5.jpg

Here is white noise, before and after applying this code with the default settings:

;control frequency "Frequency" real "Hz" 5000 1000 10000

(defun highpass (sig hz)
  (highpass8
    (highpass8
      (highpass8 sig hz)
      hz)
    hz))

(highpass *track* frequency)

First Track000.png