Tag Info

0

hat's hard to tell without seeing your actual signal and looking at your entire signal chain. A few observations and ideas: Spectral analysis works much better with proper windowing. However, lack of windowing tends to be more of a high frequency problem, so this is probably or your specific issue. 225Hz is the third harmonic of 75Hz. For many audio signal ...

0

Just doing np.mean(y,axis=0) seems to work for me. But to really check I'd need to know how you loaded the file. My code below. Code only import librosa import numpy as np import soundfile y, sr = librosa.load('Q76477.mp3', mono=False) ymean = np.mean(y,axis=0) soundfile.write('Q76477_output.wav', ymean, samplerate=22100)

0

A typical loudness chain comprises of Frequency weighting filter. For breathing, A-weighting is probably fine RMS detector with a suitable time constant (maybe 100ms or so) If you want a single number: suitable integration over the entire clip. Energy average will probably be ok here. Potential Python libraries: https://github.com/csteinmetz1/pyloudnorm ...

0

Input to sine should be phase, not frequency The * t is only to apply to fc per 1 Corrected: Code import numpy as np import matplotlib.pyplot as plt #%% Generate ################################################################# t = np.linspace(0, 1, 2048, 0) fc = 200 b = 15 data = -np.cos(2*np.pi * 1 * t) phi = fc*t + b * data fm = np.sin(2*np.pi * phi) ...

0

What you need is to filter out lower frequencies: You do that with a high-pass filter. Since you don't really need that filter from "very much blocking" to "completely letting everything through" in a very narrow band, that filter will be pretty short (meaning it only needs very few multiplications per sample to compute its output. I've ...

1

You need to perform FFT on data_chunk, then take the magnitude of the resulting complex array. The result will be a vector with the magnitudes of all frequency components in data_chunk. This is how you would go about doing that: from scipy.fft import fft import numpy as np Y = fft(data_chunk) Y = Y[0:round(len(Y)/2)] YMag = np.abs(Y) Now YMag has the ...

1

So Tim Wescott's answer was most likely a part of the issue, but during my attempts to correct my IIR filters I realized something even simpler was going on. My LP_RC filter class was calculating its output entirely incorrectly, and in a spectacularly bad way. For some reason, my sleep-deprived mind tried to implement an RC filter by simply multiplying the ...

1

I'm about 99.44% sure that you're filtering wrong, in that you're not carrying over any previous filter state. You've kind of fixed this in your differentiation step by saving the previous sample, because the filter that np.diff (effectively) implements uses the previous sample as it's current 'state'. In your filter-and-decimate stage (I assume that's what ...

0

Following up the suggestion to use so-called shelving filters by Hilmar (thanks!), with the biquad_cookbook module that endolith linked (thanks!). The package (written in 2013) runs with (conda) python 3.8.10 out of the box. Mini example: import numpy as np import scipy import biquad_cookbook # need the file in the working directory precompensated_signals = ...

4

Is there an invertible low-pass filter No is there something particularly difficult about inverting a low-pass filter? Yes. Digital low pass filters (in the most common sense) have a zero at Nyquist which means that the inverse has infinite gain at Nyquist and is unstable. Seemingly having two identical coefficients in b as the first and only ...

0

First – the fact that the filename ends in .wav indicates this is an uncompressed file. That's a great way to waste storage! There's lossless compression formats (mostly: FLAC) that should do quite excellently on bat sounds (meaning they don't need much space) and deal relatively gracefully with usual background noise. It's quite possible that this already ...

0

OP mentioned using high pass filter but this still removed components. This simply means the high pass cutoff was too high. I think the simplest solution is to use and exponential averager to extract the moving average, and then subtract this from the result. Below is the simple structure to create an exponential averager. Parameter $\alpha$ will modify the ...

0

You have a very large bias, that means that every filtering that you do will either create a strong transient response unless the filter state is properly initiated. A few options: If the bias is stable, you can simply calculate it as the mean and subtract it Apply a "DC blocking" filter. Details depends on the lengths of you signal and the ...

Top 50 recent answers are included