A friend of mine asked me if I could make some kind of filter that could provide information about subharmonic frequencies. I wasn't quite sure what he meant, but I thought I'd try a few things to see what I could get.
He mentioned he wanted the following bands 1-3 Hz, 4-6 Hz, 7-9 Hz, 11-14 Hz, and 15-18 Hz.
The first thing I tried was a series of [lop~] and [hip~] filters in the ranges he was wanting. I stacked multiple [lop~]s and [hip~]s, to make really hard limits and then sent the output from each band to vu~ meters. This was unreliable. In fact, a 5 Hz sine wave seemed more likely to show up in the 10 Hz band. I also tried [bp~], [vcf~], and [svf~] with no luck.
I then took a different approach, using [threshhold~] and [timer] to time the distance between zero crossings and output the result. This is very reliable for a sine wave, but I fear it wouldn't be that useful for real world signals.
Have any of you ever tried to separate out subharmonic frequencies in Pd? Any experience with brain wave analysis in software? What's a better technique?
Thanks,
Sam in Baltimore
Hi,
With fft~ you can go up to a framesize of 2^17, that is around 3 seconds when assuming 44.1KHz SR. The bin resolution is then ~0.37 Hz which may be just accurate enough for your purpose (spectral leakage will always make analysis less precise than the bin resolution suggests). Notice that the latency of your info will also be 3 seconds then.
Katja
On Mon, Oct 17, 2011 at 11:24 PM, Samuel Burt composer.samuel.burt@gmail.com wrote:
A friend of mine asked me if I could make some kind of filter that could provide information about subharmonic frequencies. I wasn't quite sure what he meant, but I thought I'd try a few things to see what I could get.
He mentioned he wanted the following bands 1-3 Hz, 4-6 Hz, 7-9 Hz, 11-14 Hz, and 15-18 Hz.
The first thing I tried was a series of [lop~] and [hip~] filters in the ranges he was wanting. I stacked multiple [lop~]s and [hip~]s, to make really hard limits and then sent the output from each band to vu~ meters. This was unreliable. In fact, a 5 Hz sine wave seemed more likely to show up in the 10 Hz band. I also tried [bp~], [vcf~], and [svf~] with no luck.
I then took a different approach, using [threshhold~] and [timer] to time the distance between zero crossings and output the result. This is very reliable for a sine wave, but I fear it wouldn't be that useful for real world signals.
Have any of you ever tried to separate out subharmonic frequencies in Pd? Any experience with brain wave analysis in software? What's a better technique?
Thanks,
Sam in Baltimore _______________________________________________ Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Hi Sam
If you're interested only in the lower frequencies anyway, you can drastically lower the sample rate in order to save some CPU cycles when doing the FFT.
Roman
On Mon, 2011-10-17 at 23:43 +0200, katja wrote:
Hi,
With fft~ you can go up to a framesize of 2^17, that is around 3 seconds when assuming 44.1KHz SR. The bin resolution is then ~0.37 Hz which may be just accurate enough for your purpose (spectral leakage will always make analysis less precise than the bin resolution suggests). Notice that the latency of your info will also be 3 seconds then.
Katja
On Mon, Oct 17, 2011 at 11:24 PM, Samuel Burt composer.samuel.burt@gmail.com wrote:
A friend of mine asked me if I could make some kind of filter that could provide information about subharmonic frequencies. I wasn't quite sure what he meant, but I thought I'd try a few things to see what I could get.
He mentioned he wanted the following bands 1-3 Hz, 4-6 Hz, 7-9 Hz, 11-14 Hz, and 15-18 Hz.
The first thing I tried was a series of [lop~] and [hip~] filters in the ranges he was wanting. I stacked multiple [lop~]s and [hip~]s, to make really hard limits and then sent the output from each band to vu~ meters. This was unreliable. In fact, a 5 Hz sine wave seemed more likely to show up in the 10 Hz band. I also tried [bp~], [vcf~], and [svf~] with no luck.
I then took a different approach, using [threshhold~] and [timer] to time the distance between zero crossings and output the result. This is very reliable for a sine wave, but I fear it wouldn't be that useful for real world signals.
Have any of you ever tried to separate out subharmonic frequencies in Pd? Any experience with brain wave analysis in software? What's a better technique?
Thanks,
Sam in Baltimore _______________________________________________ Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
On Tue, Oct 18, 2011 at 11:20 AM, Roman Haefeli reduzent@gmail.com wrote:
If you're interested only in the lower frequencies anyway, you can drastically lower the sample rate in order to save some CPU cycles when doing the FFT.
Right. A 2^17 point FFT is on average not expensive at all, but the problem is that all computations (in the order of 17 * 2^17) are done at once every 3 seconds, that's just too much and it causes buffer underrun in the realtime dataflow.
Depending on input signal, drastically lowering the sample rate may also require drastic filtering to prevent aliases, which could otherwise spoil analysis results. Such filtering can be done in frequency domain, using FFT again. Be sure to use 4 times overlap and Hann windowing before FFT and after IFFT.
Katja
Le 2011-10-18 à 14:35:00, katja a écrit :
Such filtering can be done in frequency domain, using FFT again. Be sure to use 4 times overlap and Hann windowing before FFT and after IFFT.
Why would the filtering be done by FFT ? Isn't a single [lop~] good enough ?
| Mathieu BOUCHARD ----- téléphone : +1.514.383.3801 ----- Montréal, QC
On Wed, Oct 19, 2011 at 2:50 AM, Mathieu Bouchard matju@artengine.ca wrote:
Why would the filtering be done by FFT ? Isn't a single [lop~] good enough ?
A single [lop~] is a mild filter, probably 6 dB per octave. FIR filters are normally used to make sure the potentially aliasing frequencies are really filtered out before up/downsampling, some 20 coefficients per octave up/down if I remember well. For 32 octaves down, FIR would be expensive, so it could instead be done as a convolution in frequency domain.
In frequency domain it is possible to almost brickwall-filter, it's very effective and cheap. I've documented experiments with it:
http://www.katjaas.nl/FFTwindow/FFTwindow&filtering.html
That said, it is of course dependent on the input signal whether radical filtering is really important before downsampling. I don't know what is the case of the original poster, so maybe this is theoretical digression.
Katja