3 ms·
I don't recommend using DFT (FFT) analysis unless you can constrain N to small sizes (<= 256 at 44.1KHz sampling rate perhaps) to reduce time aliasing. Use of
by waffletower 6y ago
I don't recommend using DFT (FFT) analysis unless you can constrain N to small sizes (<= 256 at 44.1KHz sampling rate perhaps) to reduce time aliasing. Use of wavelets may be a better fit for this application.
- ggerganov 6y agoI have found that I need to use about 75-100 ms of audio around the keystroke-down peak when comparing waveforms. At the sample rate that I am using - 16kHz, I would probably need samples of size about 1024 - 2048. Not sure if this is feasible, just giving some additional info.
- cnity 6y agoIf you want to compute an FFT with fewer bins you can also use STFT and configure the bin count and hop size (essentially computing many FFTs of smaller regions of the signal and computing the average). A quick side note, 16kHz is quite a low sample rate for your use case, since you won't be able to capture frequencies over 8kHz (the Nyquist frequency), and key clicks at least intuitively I'd imagine to contain a lot of detail at higher frequencies. I have no data to back this up though!
- ggerganov 6y agoRegarding the sampling rate: I switched down to 16kHz from 48kHz, because I found that with my approach there wasn't much of a difference in the key-matching performance. At the same time, I gained computational performance. At some point, I was looking at the spectrum of the key sounds and I think that almost the entire signal is in the lower few kHz. It might be just my keyboard - not sure. I still have the tool, so I can easily check if there is some high-frequency portion that I am missing.
- cnity 6y agoI believe you, it was only a hunch. Not backed up by evidence! I've been way off about my intuition of frequencies, especially with non-harmonic sounds like key presses :)
- waffletower 6y agoI agree, 44.1KHz is a commonly available sampling rate and could provide better temporal resolution regardless of time doamin and frequency domain analysis technique you decide to use.
- cnity 6y agoI don't quite understand what you mean. Do you mean that in general you don't recommend DFT for signal processing? This seems counter to most approaches in the field. Issues (aliasing, spectral leakage, etc) arising from DFT more or less iron out with reasonable use of zero padding, sample rate, and windowing. Edit: I didn't mean for this to sound so closed minded. I don't know that much about more recent audio processing practices and I think you probably know things I don't. If you have any reading about wavelets vs DFT I'd be very thankful and interested.
- waffletower 6y agoThe uncertainty principle is is the key concept that I think is relevant here: https://en.wikipedia.org/wiki/Uncertainty_principle#Harmonic_analysis https://en.wikipedia.org/wiki/Uncertainty_principle#Harmonic... A Discrete Fourier Transform (DFT/FFT) balances frequency vs time resolution based upon its parameterization. In this application, I think that frequency differentiation is less important than time differentiation for events. To get an advantage from utilizing spectral analysis, I think that the STFT can be used with very small overlapping analysis windows. (https://en.wikipedia.org/wiki/Short-time_Fourier_transform https://en.wikipedia.org/wiki/Short-time_Fourier_transform) However, due to the importance of transients I would consider use of wavelet transforms instead (https://en.wikipedia.org/wiki/Wavelet_transform https://en.wikipedia.org/wiki/Wavelet_transform) since they can resolve temporal characteristics better than a DFT.