|
From: Daniel M. <pr...@gm...> - 2026-02-07 17:52:23
|
You can compute the complex analytic signal, which turns a real-valued signal into a complex-valued signal, and then take the derivative of the phase with respect to time to get the instantaneous frequency. The complex analytic signal can be obtained by taking the FFT of the signal, setting the negative frequencies to zero and doubling the positive frequencies, and taking the inverse FFT. For my guitar pedal design, I use zero crossings, the zero crossings being determined by a comparator with hysteresis. The frequency is determined by measuring the time during zero crossings and using these crossings to compute the 1-bit autocorrelation of the signal, choosing the lowest harmonic of the autocorrelation. Here's the code I wrote to do it: https://github.com/profdc9/GuitarPico/blob/main/Code/guitarpico/gpico/src/pitch.c It is very fast because it only needs to keep track of the time between edges and computes the autocorrelation based on those. It needs to be very fast because most of the time needs to be spent on the actual guitar effects. On Fri, Feb 6, 2026 at 2:34 PM Patrick Kurth <p....@po...> wrote: > Hi list, > > Is there a way of measuring the instantaneous frequency of a signal > over time? Something like the TRIG measurement, but as a waveform, as > if you would call the TRIG measurement repeatedly and concatenated all > results into a waveform. More precisely I am looking for a crossing > function. > Is there a simple way to achieve this? > > Kind regards, > Patrick > > > _______________________________________________ > Ngspice-users mailing list > Ngs...@li... > https://lists.sourceforge.net/lists/listinfo/ngspice-users > |