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

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

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

It will work when you take the 2nd gradient of the signals: import numpy as np from scipy import signal s0 = np.gradient(np.gradient(s0)) s1 = np.gradient(np.gradient(s1)) np.argmax(signal.correlate(s0, s1)) -> 525358 That corresponds to a shift of 1071 which is close to your expected 1069 Interestingly the minimum (most negative correlation) is close ...


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

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

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

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


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

I was going to post this as a comment, but then it became so long that I thought, this constitutes really as an answer in fact. Your question reminds me of the lab-work in my MSc course on Adaptive Filters. We used "Wiener filter" to remove some unwanted background noise (wind and tire noise) from the recorded input to make the speech clearer. The Wiener ...


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 ...


2

I don't know much about this semantics? of WAV files but their numerical format is the following. (assuming mono) Given a recording with 8-bit per sample precision, then those samples are unsigned integers taking values between $0$ and $255$. Due to being unsigned, to represent negative values, there is a bias of $128$, and the sample values are actually ...


2

The semantics for a sampled audio signal is very simple. Each sample represents an amplitude, each sample is done at a specific time. If you create a signal using a microphone, the amplitude is related to the pressure as measured by the microphone diaphragm. The sampling process will introduce time in the equation. In the question, there are two sets of ...


2

In practice, this does not matter much. All serious work normalizes audio levels. In our code base, there's even some code that runs a nightly check to verify our algorithms are gain-independent. We recognize that the external format is typically 16 bits, but this does not need to match the internal formats used in transforms. Internally, extra precision ...


2

I'd consider why you really want to do this - I personally can't think of a reason why I'd want to downsample to a specific sample number but I don't know your project Floating an alternate idea, you could downsample until you're near around that level of decimation and then truncate? It won't be 100 samples exactly but it might be easier in the long run to ...


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