If you really want to do this sort of thing, you need to use

MatLab, or

Octave, or

Nyquist.

Of those three, Nyquist is by far the easiest to learn and use, and it is built into Audacity.

The other two are unrelated to Audacity, and have their own support channels.

Looking at your original post, if we ignore the bit about "overflow", then it is a kind of averaging filter that may be achieved in just a few lines of Nyquist code.

These examples can be run in the Nyquist Prompt effect, and require a fairly recent version of Audacity. They are not full plug-ins, though they could easily be made into full plug-ins, but are to illustrate how you would approach this type of task in Audacity. I don't use MatLab or Octave, so I can't help with either of those.

- Code: Select all
`;version 4`

;control type "Filter type" choice "Low pass,High pass" 0

(setf type (1+ (* type -2)))

(defun filter (sig)

(let ((d (/ len)))

(sum

(mult type 0.25 (extract (* 2 d) 1 sig))

(mult 0.5 (extract d 1 sig))

(mult type 0.25 sig))))

(multichan-expand #'filter *track*)

If all you are interested in is the frequency response of the filter, then it is even easier:

- Code: Select all
`;version 4`

;control type "Filter type" choice "Low pass,High pass" 0

(if (= type 0)

(lowpass2 *track* (/ *sound-srate* 4) 0.57)

(highpass2 *track* (/ *sound-srate* 4) 0.57))

It gets a little more complicated to add the "overflow" samples, and in most cases it will just create a click at the start and/or end, but it can be done like this:

- Code: Select all
`;version 4`

;control type "Filter type" choice "Low pass,High pass" 0

;control loop "Loop boundary values" choice "Yes,No" 0

(setf type (1+ (* type -2)))

(defun sample (val)

(snd-const (* type 0.25 val) 0 *sound-srate* (/ *sound-srate*)))

(defun sampleval (sig n)

(if (= loop 0)

(abs-env (sref sig (/ n *sound-srate*)))

0))

(defun filter (sig)

(let ((d (/ len))

(first (sampleval sig 1))

(final (sampleval sig (1- len))))

(if (= loop 0)

(sum

(sample final)

(mult type 0.25 (extract (* 2 d) 1 sig))

(mult 0.5 (extract d 1 sig))

(mult type 0.25 sig)

(at-abs (/ (- len 1) *sound-srate*) (cue (sample first))))

(sum

(mult type 0.25 (extract (* 2 d) 1 sig))

(mult 0.5 (extract d 1 sig))

(mult type 0.25 sig)))))

(multichan-expand #'filter *track*)