Hot answers tagged

13

All three transforms are inner product transforms, meaning the output is the inner product of a family of basis functions with a signal. The parametrization and form of the basis functions determine the properties of the transforms.The number of basis functions for a complete picture (i.e. a result that contains enough information to reconstruct the original ...


11

The STFT transform pair can be characterized by 4 different parameters: FFT size (N) Step size (M) Analysis window (size N) Synthesis window (size N) The process is as follows: Grab N (fft size) samples from the current input location Apply analysis window Do the FFT Do whatever you want to do in the frequency domain Inverse FFT Apply synthesis window Add ...


9

I've tried to get the bin with greatest magnitude but that only give me right results for higher pitch signals, it doesn't matter which oversampling factor I use I still get bad data for low freq signals. That's because the harmonics are larger than the fundamental. Plot your spectrum and you'll see. A better method to find the true fundamental is ...


9

If you really insist on using FFT (rather than parametric methods, which wouldn't suffer from time/frequency trade-offs), you can fake a much better resolution by using the phase information to recover the instantaneous frequency for each FFT bin. Partials can then be detected by looking for plateaus in the function giving instantaneous frequency as a ...


7

Your question is tricky because it is hard to define what "discarding the phase information" means without specifying a practical way of doing it; but then we encounter problems/artifacts which are specific to this particular method. Since you mentioned STFT, let us assume phase information is suppressed by doing a STFT, keeping the magnitudes, setting to 0 ...


7

We always want to apply some kind of a window function in order to minimize the effect of leakage. This makes rectangular window (lack of any windowing) case never used, this is why: Any tapering function used is almost always decreasing to zero at boundaries. This is why we are losing some data. In order to retrieve that somehow you will usually do 50% of ...


7

Definitely you will have to calibrate your system. You need to know what is the relationship between dBFS (Decibel Full-Scale) and dB scale you want to measure. In case of digital microphones, you will find sensitivity given in dBFS. This corresponds to dBFS level, given 94 dB SPL (Sound Pressure Level). For example this microphone for input $94 \;\mathrm{...


6

Yes, using a peak frequency estimator for pitch is wrong. Pitch is a psychoacoustic phenomena, so pitch detection or estimation is different from frequency estimation. There have been plenty of pitch estimation methods given in previous answers to similar questions here. There's more than 1 to choose from. Here's one: https://stackoverflow.com/questions/...


6

As pichenettes already pointed out in a comment above, one approach is to use the Goertzel algorithm. However, it is a somewhat common misconception that in order to deduce the amplitude of various frequency bands in a signal, one must use Fourier-transform-based techniques. There are other methods that may be more appropriate to your application. In your ...


6

Simply speaking both the const-Q-transform and the Gabor-Morlet wavelet-transform are just continuous wavelet transforms. Or, more precisely, approximations thereof, as there will always be discretization issues in real applications. A property of wavelet transforms is that they have build in the constant Q-factor property, or in other words logarithmic ...


5

You don't HAVE to zero pad, ever, unless there are constraints on the length of data required by the FFT algorithm - often it's a case of speed. Many FFT's (like the Numerical Recipes code) require a power-of-two length series, some (like Kiss-FFT) only require it to be an even number, but being a multiple of 2,3 and 5 makes it run much faster. In Matlab'...


5

This is a rather general answer : I would say that, although each window function has specific characteristics that make it more or less suitable for specific situations, in this context you're not going to see a huge difference in the STFT of a windowed speech signal. In particular, the two windows that you're comparing are quite similar, so I'd expect ...


5

I am going to break down this answer into two main parts, one for a step-by-step computation of the STFT, and the other in regards to how to compute the MFCC's, once you have the STFT. STFT: Let us say you wanted to compute the STFT of your signal $x[n]$, of total length $N=100$, and block size $M = 10$, with $50$% overlap, and using a hamming window. I ...


5

If you are using a non-rectangular window (Hamming, von Hann, etc.), then the centroid of your window would be offset to the middle of your FFT aperture, and the FFT results would thus more highly correlate with the content of your data near or at the center, and not at the edges where the windowing would reduce influence on the results from the time domain ...


5

There is no single "time instant" associated with a short-time Fourier transform. As you noted, if you perform a DFT on data collected from $t = 0$ to $t = 64$, then there isn't a single point in time that you can associate with the output from that DFT; it is a function of every sample in its time interval. For this reason, there is no standard convention ...


5

The length of the FFT is a tradeoff between frequency and time resolution. Spectrograms are often generated by calculating overlapping FFTs on the signal of interest. If you make the FFT longer, then the effective bandwidth of each output bin becomes smaller, so the resolution along the frequency axis improves. The only limiting factor to the frequency ...


5

In general, shorter windows contain less information, and will thus provide less frequency resolution. But short windows will be more localized in time, and thus a sequence of short windows might allow greater resolution in locating or separating time domain behavior. Longer windows will contain more information, but this information will be averaged ...


5

Please refer to this paper on the optimum overlap percentage for the Blackman-Harris window, which is derived to be 66.1%. It has a lot of useful information on spectral analysis and windows.


5

Since the input signal is real, half of the FFT data is "useless" because it is simply the complex conjugate of the other half. More precisely, a 256-long FFT of a real signal will give you: the DC amplitude, 127 amplitudes, the amplitude at Nyquist, and 127 conjugate amplitudes. Among the 700 chunks, 256 / 32 - 1 = 7 extend outside the boundaries of the ...


5

I'm wondering why the STFT pops out. To me, wouldn't a simple threshold on the signal itself or on its envelope do better / just as well, after removal of the g offset? Once you decide what "measure" is best to detect your event, you can apply the work of Basseville and Nikiforov, that I answered here. The classic reference for that problem is Detection ...


5

If this graphics represents the most typical application scenario, then I would go for some simple short window variance estimation and perform thresholding afterwards; $$ \sigma_x^2 = \frac{1}{N} \sum_{n=0}^{N-1} x_{ac}[n]^2$$ Where $x_{ac}[n]$ is the DC removed input signal; i.e., $x_{ac}[n] = x[n] - \bar{x}[n]$ where $\bar{x}[n]$ is the DC (mean) value ...


5

I did answer a similar question a few years back, but can't find it. Basically, you are losing the energy because of the windowing. It's true to say that you should multiply the spectra by 2 in order to retrieve the energy from negative frequencies and divide it by the window size. However, this is only true for the rectangular window. The correct ...


4

Window functions have an inherent tradeoff between two of their frequency-domain properties: Main lobe width: Any tapered window function will cause some "smearing" in the frequency domain. This is visualized by the width of the center lobe in the window function's frequency response. The wider the main lobe, the more difficult it is to resolve two tones ...


4

The short-time Fourier transform is generally a redundant transformation, usually implemented with the same subsampling over every frequency. If the window is well chosen, it is complete: you can invert it and recover any initial signal. Since it is redundant and complete, it has many perfect inverses. It can be implemented and understood using more ...


4

A vocoder is a type of synthesizer originally developed for speech (or the human voice, thus the "vo" prefix), even before the use of digital processors. The Bell Labs Voder was demonstrated in 1939, and VoCoders were reportedly used for encrypted voice communication during WW2 (according to Wikipedia). DFTs can be used to analyze which audio spectrum ...


4

The short-time Fourier transform (STFT) refers to the time-frequency representation of a signal, which is given by: $$X(\tau,\omega) = \int_{-\infty}^{\infty}x(t)w(t-\tau)e^{-j\omega t} \, dt$$ which is equivalent to: $$ x(t)w(t-\tau) = \tfrac{1}{2\pi}\int_{-\infty}^{\infty} X(\tau,\omega) e^{+j\omega t} \, d \omega $$ If the window is scaled so that: $$...


4

The default parameters of signal.spectrogram are: nperseg = 256 noverlap = nperseg/8 = 32 This means that: The length of analysis window is $256$ samples ($256/250 = 1.024$ second) The overlap between consecutive windows is $32$ samples ($32/250 = 0.128$ second) The timestamps returned by signal.spectrogram correspond to the centres of a window. So in ...


4

Real/imaginary or modulus/phase are two representations of a complex number that carry the same level of information. Then, a STFT is a redundant mapping from a space of functions over a 1D variable (time) onto a space of functions over a 2D variable (time and frequency). Under mild conditions on the window, there are an infinity of inverses, due to the ...


4

With all due caution, no in both cases (title and body question). I'll start with the second one. Continuous wavelets use all dilations of the mother wavelet, which are not accessed with the STFT The STFT is complex in general, and the windowed sine is not. For the first one: I never tried it, and do not remember having seen it in use, and one should ...


3

The least-squares re-synthesis procedure is very similar to the overlap-add (OLA) procedure. Let w_n be the discrete window vector and y_n(:,k) be the time domain vector computed using the IFFT on a column k of the 2D matrix. Both w_n and y_n(:,k) are the same length. Then, using Matlab syntax, we compute the point-by-point multiplication with the window: ...


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