Hot answers tagged

8

Since this is a constant spectrogram, you could just as well have just averaged the |FFT|² and plotted that! (The most colorful way of visualizing things isn't always the optimal one; your signal doesn't change over time, so you don't need the time axis of the spectrogram at all.) Quite possibly, in that "easier" representation, you would have spotted this: ...


5

Choice of $N$ Dual-tone multi-frequency (DTMF) tones should be of certain minimum duration (40 ms) and quality to be detected (reviewed in ITU TABLE A-1/Q.24). The detection algorithm that you cite uses a block duration of $t=N/f_s,$ where $N$ is the block length in samples and $f_s$ is the sampling frequency. The duration is either 210/(16 kHz) = 13.125 ms ...


5

I think there are a couple things going on here. First, the flatness of your baseline plot is a little deceiving because the tones that you have added (1 - 500 Hz) are all almost exact multiples of the fundamental frequency of the fft (fs/nfft = 1.024 Hz/bin). If you increased nfft by a factor of 10, for example, the finer frequency resolution of the zero-...


4

Standard Savitzky-Golay filters are linear phase (type I) FIR filters. So they have an odd number of filter coefficients $2N+1$, and the delay equals $N$. For a good overview of Savitzky-Golay filters see this article by Ronald Schafer. For the definition of the four types of linear phase FIR filters see this answer.


3

As others said in the comments, this looks like numerical error. 3rd-order filters are not typically prone to this, but the higher your sampling frequency, the closer the poles move to +1: You might benefit from splitting this into second-order sections. The easiest way is to use output='sos' and sosfreqz() and sosfilt(), which handle the splitting ...


3

...best results come from a weighted ensemble of techniques... Maybe they do, depending on the application. But each one of the similarities mentioned, is equivalent to the other at least when we are talking about signals originating from linear systems. Cross correlation provides very good results especially if you are trying to figure out if a signal is ...


3

With cues from Olli's answer, I have made the modifications in the program here. The modification I did was that I kept the block duration as : $$N = t\times f_s = 13.125\text{ ms}\times f_s,$$ So, according to this : for $f_s = 24\text{ kHz},$ $N = 315$, for $f_s = 32\text{ kHz},$ $N = 420$, for $f_s = 48\text{ kHz},$ $N = 630$. Which in the python ...


3

I am not a good Python coder, but did similar processing in Matlab in the past. The subject has been discussed in SE.DSP in several instances, for instance Librosa stft + istft - Understanding my output. Tools seem to exist: scipy.signal.istft: Perform the inverse Short Time Fourier transform (iSTFT). librosa.core.istft: Inverse short-time Fourier ...


3

Hm well, technically it is some kind of envelope: it oscillates between hilbert(x) and -hilbert(x). Your examples (dashed lines are $\pm$hilbert(x)): I'm assuming you're looking for something smoother. Matlab has a function called envelope where you have various ways of controlling how the envelope is extracted. Not sure if there is a Python equivalent. ...


3

the discrete function $$x_q[n]=\sin(\pi n)$$ is always zero for all of the integers $n$. the discrete function $$x_i[n]=\cos(\pi n)$$ is always $(-1)^n$ for integer $n$. so this general sinusoid at Nyquist that has a phase term: $$\begin{align} x[n] &= A \cos(\pi n + \theta) \\ &= A \big( \cos(\pi n) \cos(\theta) - \sin(\pi n) \sin(\theta) \...


3

Is the rate of 2B exclusive? Yes. The sampling theorem states that the signal must be band limited to half the sample rate. That implies that the energy at the Nyquist frequency must be zero. In practice you need a healthy margin between the highest usable frequency and the Nyquist frequency. There is always some "transition band" that you need to get the ...


3

My guess is that the currently popular and new and likely robust way to solve this detection problem is to feed a sequence of audio fingerprints (such as MFCCs) to an RNN machine learning algorithm that was trained on a large wide range of rhythm tracks mixed with increasing levels of realistic background noise. Feeding audio stream samples directly to a ...


2

You can use pyvib to do frequency based subspace identification. Beware that there is no estimation of the initial state. It is possible to do optimization of the identified model, if the data is not perfectly linear. See the implemenentation, maybe you can use it, in case you want to do your own implementation. Somewhat incomplete example. Take a look at ...


2

I got the same results in Paco's example, but changing the input signal to a vector of ones does not yield same results in MATLAB and Python (Scipy 1.0.0): MATLAB: input_signal = ones(10000,1); [b,a] = butter(5, [0.75*2/30, 5.0*2/30], 'bandpass'); y = filtfilt(b, a, input_signal); y(1:5)' ans = 1.0e-13 * -0.306211857054885 -0.468000282200120 -...


2

A = [0, 0, 5, 10, 0, 0, 0, 23, 24] If I fft A, will it give me the same answer as if I fft B, where B = [5, 10, 23, 24] No. The reason for this is not in what effect does the sample has to the amplitude but in that you would effectively be changing the phase. That is, the relative timing of the sample with respect to the rest. The Discrete ...


2

signal.windows.cosine is a window function, not a signal, as it says in the docstring: Return a window with a simple cosine shape. You want something like numpy.cos(2*pi*f*t).


2

They do mean the pseudo-frequency of the wavelet which is not dependent on the signal being analyzed. The misleading terminology that they use seems to come from from one of the references, Han, P. (2013), Investigation of ULF seismo-magnetic phenomena in Kanto, Japan during 2000–2010, PhD thesis, Chiba University, Chiba, Japan. Quoting an article of a ...


2

Your first problem is that you have your axes mixed up. Your "17 Hz" picture shows this quite clearly. The red bars are the impulses from the signal. The bars should indicate an impulse (wide range of frequencies) but your axes indicate they are across time. This is what it should look like: Notice that the bars are along the frequency axis rather than ...


2

Does it have to use python? For exploring your workflow and pipeline for a kind of image analysis, I would suggest getting ImageJ / FiJi. Use it together with the MorphoLibJ plugin to get more options on morphological segmentation. Once you determined your workflow you can code it in python to batch analyze. Anyways, your workflow should look like this, ...


2

With an IIR filter, the higher the ratio is of sampling frequency to bandpass filter frequency, the closer the poles are to the complex unit circle in the Z-transform. Poles close to the unit circle can produce numerical instabilities (ill conditioned computations) when computing the filters response. This is because any numerical quantization or "rounding ...


2

It means your song is stereo (two channels). if that's not the case, then that is weird indeed.


2

One simple way to solve it is using Overlapping Patches. Let's say you have image which is $ 20 \times 20 $ and you work on patches of the size $ 5 \times 5 $. As I understand from your description you do 16 times denoising of $ 5 \times 5 $ patches. What you should do is run the patches mask like in convolution. So each pixels (Ignoring boundaries) will ...


2

The ltfatpy 1.0.16 package is a partial Python port of the Large Time/Frequency Analysis Toolbox (LTFAT), a MATLAB®/Octave toolbox for working with time-frequency analysis and synthesis. Among linear and quadratic time-frequency methods, there is a large number of options for sharper analysis tools converting a 1D signal into 2D data. You can even ...


2

how anyone can be confident in the result of an FFT when the signal being sampled has some frequency content that is at the frequency Fs/2. You can't. In practice you need a healthy margin between the highest frequency of interest and the Nyquist frequency. In audio for example the highest frequency is typically 20 kHz but you sample at 44.1 kHz or 48 ...


2

It is a similar question as the one I have asked a few weeks before, and I received a nice answer -> Shannon-Nyquist theorem reconstruct 1Hz sine wave from 2 samples I was trying to do the reverse: reconstruct a 1Hz sine wave from only 2 samples.


2

The main reason why your Kalman filter is not working is because you are not converting lat and lon values to kms. In the code below, I defined a new function called lat_lon_posx_posy which converts lat and lon values to px and py values in mts. You will need to make the following changes to your code. Include the following function import utm def ...


2

First off, a small thing: The sampling rate usually has to be one of the standard sampling rates. Closest to your 1024*40 would be 44100. The hardware has to support the sampling rate. Some drivers will resample to the given rate, but that will be somewhat slow as it is in software. Try using a proper sampling rate. The real bottle neck is the plotting. ...


2

First of all, thanks for sharing this problem. I hope it can foster some good discussions here at stack-exchange. I guess this problem is commonly called Multi-Focus Multi-Image Fusion (MF-MIF). Let's look at all the images together with their grayscale histograms and the gradient magnitude (information content in each image): As the original question ...


2

The frequency resolution of your FFT is determined by its length and the sampling rate. In your second plot you show Fs = 10e6 and 3200 samples. Assuming you don't zero-pad these samples when you pass them to the FFT this gives you a frequency resolution of 3125Hz: $$ 3215 = \frac{10 \times 10^6}{3200} $$ So at lower frequencies you have frequency bins as ...


2

For sinusoids that are not exactly integer periodic in the FFT length, an FFT measures the phase at a circular discontinuity. And that discontinuity flips direction as frequency changes from slightly below to slightly above an exact integer periodic-in-aperture frequency. This is part of the effect of the default rectangular windowing of any finite length ...


Only top voted, non community-wiki answers of a minimum length are eligible