High-pass filter in Python (Scipy)

This code is taken from a pitch detection algorithm. It is called before pitch detection to remove low-frequency noises.

def highpass_filter(y, sr):
filter_stop_freq = 70  # Hz
filter_pass_freq = 100  # Hz
filter_order = 1001

# High-pass filter
nyquist_rate = sr / 2.
desired = (0, 0, 1, 1)
bands = (0, filter_stop_freq, filter_pass_freq, nyquist_rate)
filter_coefs = signal.firls(filter_order, bands, desired, nyq=nyquist_rate)

# Apply high-pass filter
filtered_audio = signal.filtfilt(filter_coefs, [1], y)
return filtered_audio


I have trouble understanding what the parameters filter_stop_freq, filter_pass_freq and filter_order mean. I have read this but it did not help me.

• "Design a digital FIR filter, of length 1001, where the gain at DC is 0 (silence), and all frequencies up to filter_stop_freq 70 Hz are also blocked, then the gain can rise up to filter_pass_freq 100 Hz, where the gain should be 1 (should be passed unchanged), and the gain from there up to the Nyquist frequency should stay flat at 1. Then use this filter on the signal, with one forward-in-time pass and one backward-in-time pass." May 23, 2017 at 19:13

In this case, the filter_stop_freq is that frequency below which the filter MUST act like a stop filter and filter_pass_freq is that frequency above which the filter MUST act like a pass filter.
The frequencies between filter_stop_freq and filter_pass_freq are the transition region or band.
Because this is designing an FIR filter, filter_order is just the length (number of taps) of the filter. The higher the order, usually, the better the fit (and the smaller the transition region can be).