Has anyone done anything with trying to detect feedback in a signal?
I am not looking so much for feedback suppression techniques, but
rather detection techniques. I am working on a system that has a
slow feedback loop. I want to detect when feedback is the dominant
part of the signal, and make the system respond in novel ways.
.hc
Feeback tends toward periodicity at 1/t for a delay of t so you could do an autocorrelation (expensive - does Pd have an object to help with that?) of te feedback signal to look for it. Since you know the frequency in advance a simple bp filter is more effective. Not sure what you mean by "dominant" part. If gain is greater than unity then it will eventually be, but if you think of a Karplus=Strong it is by definition once the excitory signal has vanished. Am I understanding your question(?) if I say the best way is to simply monitor the amplitude , because if G>1 the amplitude will *always* keep growing.
On Sun, 30 Jul 2006 19:07:12 -0400 Hans-Christoph Steiner hans@eds.org wrote:
Has anyone done anything with trying to detect feedback in a signal?
I am not looking so much for feedback suppression techniques, but
rather detection techniques. I am working on a system that has a
slow feedback loop. I want to detect when feedback is the dominant
part of the signal, and make the system respond in novel ways..hc
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
This isn't a standard feedback suppression system that I am after. I
want to be able to play with the feedback while having the ability to
prevent it from taking over. Its part of an interactive installation
I am working on, the next generation of this:
The autocorrelation stuff sounds interesting, plus I just found Ed
Kelly's [peakit~], which gives amplitude info of FFT channels.
.hc
On Jul 31, 2006, at 10:23 AM, padawan12 wrote:
Feeback tends toward periodicity at 1/t for a delay of t so you could do an autocorrelation (expensive - does Pd have an object to help with that?) of te feedback signal to look for it. Since you know the frequency in advance a simple bp filter is more effective. Not sure what you mean by "dominant" part. If gain is greater than unity then it will eventually be, but if you think of a Karplus=Strong it is by definition once the excitory signal has vanished. Am I understanding your question(?) if I say the best way is to simply monitor the
amplitude , because if G>1 the amplitude will *always* keep growing.On Sun, 30 Jul 2006 19:07:12 -0400 Hans-Christoph Steiner hans@eds.org wrote:
Has anyone done anything with trying to detect feedback in a signal? I am not looking so much for feedback suppression techniques, but rather detection techniques. I am working on a system that has a slow feedback loop. I want to detect when feedback is the dominant part of the signal, and make the system respond in novel ways.
.hc
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
Man has survived hitherto because he was too ignorant to know how to
realize his wishes. Now that he can realize them, he must either
change them, or perish. -William Carlos Williams
There is an cross-correlation class [cc~] in the flib library, which you can use to do auto-correlation. It has both a time domain and a frequency domain CC function. I found the output of the time domain implementation to be easier to interpret.
There are also number of other feature extraction objects in flib that might help with what you need, including [peak~], which does the same as [peakit~] except that with [peak~] the magnitude spectrum isn't calculated by the object, so you can precalculate the power spectrum, log mag spectrum, cepstrum and pass it to the object. With [peak~] you can also set a threshold as a percentage below the maximum peak found.
You might find [bmax~] useful, as it returns the bin numbers of the n most prominent partials, I think similar to ekext/[hasc~]. (ekext/[hssc~] might also be useful, but you have probably already tried).
Also you might want to try flib/[irreg~], flib/[ss~] which measure spectral irregularity and spectral smoothness respectively.
I guess it depends how prominent you are expecting the feedback to be, and how it is distributed across the spectrum.
Let me know how you resolve this issue, as I am very interested in this.
HTH,
Jamie
BTW: sounds like a good installation!
On Mon, 31 Jul 2006 01:01:56 -0400 hans@eds.org wrote:
This isn't a standard feedback suppression system that I am after. I
want to be able to play with the feedback while having the ability to
prevent it from taking over. Its part of an interactive installation
I am working on, the next generation of this:The autocorrelation stuff sounds interesting, plus I just found Ed
Kelly's [peakit~], which gives amplitude info of FFT channels..hc
On Jul 31, 2006, at 10:23 AM, padawan12 wrote:
Feeback tends toward periodicity at 1/t for a delay of t so you could do an autocorrelation (expensive - does Pd have an object to help with that?) of te feedback signal to look for it. Since you know the frequency in advance a simple bp filter is more effective. Not sure what you mean by "dominant" part. If gain is greater than unity then it will eventually be, but if you think of a Karplus=Strong it is by definition once the excitory signal has vanished. Am I understanding your question(?) if I say the best way is to simply monitor the
amplitude , because if G>1 the amplitude will *always* keep growing.On Sun, 30 Jul 2006 19:07:12 -0400 Hans-Christoph Steiner hans@eds.org wrote:
Has anyone done anything with trying to detect feedback in a signal? I am not looking so much for feedback suppression techniques, but rather detection techniques. I am working on a system that has a slow feedback loop. I want to detect when feedback is the dominant part of the signal, and make the system respond in novel ways.
.hc
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
Man has survived hitherto because he was too ignorant to know how to
realize his wishes. Now that he can realize them, he must either
change them, or perish. -William Carlos Williams
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
You can do autocorrelation in pd using internals only. Actually, it will be a circular auto-correlation performed in the frequency domain. Look at the attached [autocorr], maybe you can use it...
BTW, the help file uses [mux~] from zexy but it's just for fun...
br, Piotr
On Jul 31, 2006, at 6:43 AM, Jamie Bullock wrote:
There is an cross-correlation class [cc~] in the flib library,
which you can use to do auto-correlation. It has both a time domain
and a frequency domain CC function. I found the output of the time
domain implementation to be easier to interpret.
I've forgotten all my DSP math, could you enlighten me as to how I
might use this?
There are also number of other feature extraction objects in flib
that might help with what you need, including [peak~], which does
the same as [peakit~] except that with [peak~] the magnitude
spectrum isn't calculated by the object, so you can precalculate
the power spectrum, log mag spectrum, cepstrum and pass it to the
object. With [peak~] you can also set a threshold as a percentage
below the maximum peak found.
I checked out [peak~], it looks like its outputting data similar to
what I am looking for, but in a strange format. How can I get just
the frequency of the highest peak? Also, I would like to have much
higher resolution. Is that possible?
You might find [bmax~] useful, as it returns the bin numbers of the
n most prominent partials, I think similar to ekext/[hasc~]. (ekext/ [hssc~] might also be useful, but you have probably already tried).
I played a bit, and didn't really get anywhere. More on that later...
Also you might want to try flib/[irreg~], flib/[ss~] which measure
spectral irregularity and spectral smoothness respectively.
I will play with those in the future, for sure.
.hc
I guess it depends how prominent you are expecting the feedback to
be, and how it is distributed across the spectrum.Let me know how you resolve this issue, as I am very interested in
this.HTH,
Jamie
BTW: sounds like a good installation!
On Mon, 31 Jul 2006 01:01:56 -0400 hans@eds.org wrote:
This isn't a standard feedback suppression system that I am after. I want to be able to play with the feedback while having the ability to prevent it from taking over. Its part of an interactive installation I am working on, the next generation of this:
The autocorrelation stuff sounds interesting, plus I just found Ed Kelly's [peakit~], which gives amplitude info of FFT channels.
.hc
On Jul 31, 2006, at 10:23 AM, padawan12 wrote:
Feeback tends toward periodicity at 1/t for a delay of t so you could do an autocorrelation (expensive - does Pd have an object to help with that?) of te feedback signal to look for it. Since you know the frequency in advance a simple bp filter is more effective. Not sure what you mean by "dominant" part. If gain is greater than unity then it will eventually be, but if you think of a Karplus=Strong it is by definition once the excitory signal has vanished. Am I understanding your question(?) if I say the best way is to simply monitor the amplitude , because if G>1 the amplitude will *always* keep growing.
On Sun, 30 Jul 2006 19:07:12 -0400 Hans-Christoph Steiner hans@eds.org wrote:
Has anyone done anything with trying to detect feedback in a
signal? I am not looking so much for feedback suppression techniques, but rather detection techniques. I am working on a system that has a slow feedback loop. I want to detect when feedback is the dominant part of the signal, and make the system respond in novel ways..hc
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
Man has survived hitherto because he was too ignorant to know how to realize his wishes. Now that he can realize them, he must either change them, or perish. -William Carlos Williams
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/ listinfo/pd-list
"[W]e have invented the technology to eliminate scarcity, but we are
deliberately throwing it away to benefit those who profit from
scarcity." -John Gilmore
Hi Hans,
Sorry for the late reply.
On Thu, 17 Aug 2006 01:44:07 -0400 Hans-Christoph Steiner hans@eds.org wrote:
On Jul 31, 2006, at 6:43 AM, Jamie Bullock wrote:
There is an cross-correlation class [cc~] in the flib library,
which you can use to do auto-correlation. It has both a time domain
and a frequency domain CC function. I found the output of the time
domain implementation to be easier to interpret.I've forgotten all my DSP math, could you enlighten me as to how I
might use this?
Auto-correlation is a measure of how much a signal resembles a delayed version of itself. [cc~ <n>] calculates the cross-correlation between the signal at the left inlet, and the signal at the right inlet with delays from -n to +n. If you present the same signal to both inlets you get an auto-correlation. This can be used to detect periodicities (e.g. to extract a periodic signal from a noisy, or detect the fundamental of a sound, where the fundamental is missing) in a signal. The wavelength of the 'extracted' signal is usually taken as the period of the first minimum in the autocorrelation function.
I would not advise you to use [cc~] as it stands. It is under revision at the moment.
There are also number of other feature extraction objects in flib
that might help with what you need, including [peak~], which does
the same as [peakit~] except that with [peak~] the magnitude
spectrum isn't calculated by the object, so you can precalculate
the power spectrum, log mag spectrum, cepstrum and pass it to the
object. With [peak~] you can also set a threshold as a percentage
below the maximum peak found.I checked out [peak~], it looks like its outputting data similar to
what I am looking for, but in a strange format. How can I get just
the frequency of the highest peak? Also, I would like to have much
higher resolution. Is that possible?
Please find attached a patch, which I think demonstrates what you need. It uses [peak~] and [bmax~] to find the frequency of the partial that has the highest amplitude. [peak <n>] outputs the frequencies and amplitudes of the partials that are >=n% of the highest detected peak. Output is audio rate, with each value retaining its FFT bin position within the block. Left outlet gives the frequencies, right outlet gives the respective amplitudes.
The frequency output is fed into [bmax~], the left outlet of which returns the value of the highest value in the block. It returns a list of bins that contain this value from its right outlet. The bin number might be useful in determining whether your detected frequency truly is feedback. For example, you could measure the amount of time for which the bin number of the 'loudest' partial stayed constant. If the partial is above a certain amplitude threshold, and it stays constant for a given period, you can assume that it is feedback and attenuate that frequency in your audio stream with a notch filter.
HTH
Jamie
P.S. I am currently working on a revised version of the library with more features, some of which might prove useful to you.
Hi,
There is an cross-correlation class [cc~] in the flib library, which you can use to do auto-correlation. It has both a time domain and a frequency domain CC function. I found the output of the time domain implementation to be easier to interpret.
I've forgotten all my DSP math, could you enlighten me as to how I might use this?
In short: cross-correlation or autocorrelation looks at how 'similar' signals are at various 'lags' (relative delays between signals). For example, in the case of cross-correlation, you have two different signals, and you compare how well they match up when there is no delay between signals. This gives you one number, for lag=zero. Then you shift one of the signals by a sample and do the same again (the comparison is just dot product of all samples in the two signal vectors), etc, so you have values for all lags. Then you will have a new vector with peaks where the two signals are similar. So this is often used for finding the delay between two similar signals. For autocorrelation, the same signal is used for the comparison, there is no second signal. Then clearly there will be a big peak at lag=zero because the signals are identical with no relative delay. The next biggest peak is often used for pitch detection because if the signal contains a large tonal component then at a lag equal to the wavelength of this frequency the signals will again look quite similar (positive values mostly line up, negative mostly line up, etc). This is all time domain stuff. As Jamie says, freq domain can be harder to interpret.
enjoy.
Matt
-=-=-=-=-=-=-=-=-=-=-=- http://www.loopit.org -=-=-=-=-=-=-=-=-=-=-=-
There is also another problem with using cross-correlation that you ought to be aware of, that other people did not mention.
If you are using a loudspeaker and microphone. There is a substantial amount of phase shifting involved as well. (The loudspeaker and microphone contain reactive elements). So, the location of your peak, depends on the type of signal that you send through the system.
For narrow bands of sound (over which the phase shift is nearly constant), the phase shift is incorporated into your estimation of the latency.
For broad bands of sound, the phase shift can vary dramatically between different frequencies. Because of this variability, the peak you are looking for may be more diffusely distributed, or may appear to be absent.
So, keep in mind what your transfer function looks like, and how it is different for different frequencies. Your best bet (in my opinion) is to use sweeps of maybe just an octave or two, to estimate your latency.
Chuck
On Mon, 21 Aug 2006, matthew jones wrote:
cross-correlation
[...]
This is all time domain stuff. As Jamie says, freq domain can be harder to interpret.
Cross-correlation in the time domain is the same as ordinary product by conjugate. This is again the Convolution Theorem, with a slight variation because of the little difference between convolution and cross-correlation.
This means that cross-correlation of two sinewaves of different frequencies will be zero, and cross-correlation of two sinewaves of same frequency will give a sinewave of that same frequency again, with an amplitude that is the product of the two amplitudes, and a phase that is the difference of the two phases. (in convolution, phases add up instead).
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard - tél:+1.514.383.3801 - http://artengine.ca/matju | Freelance Digital Arts Engineer, Montréal QC Canada
On Wed, 23 Aug 2006, Mathieu Bouchard wrote:
On Mon, 21 Aug 2006, matthew jones wrote:
This is all time domain stuff. As Jamie says, freq domain can be harder to interpret.
Cross-correlation in the time domain is the same as ordinary product by conjugate.
Arrr. I meant:
Cross-correlation in the time domain is the same as ordinary product by conjugate in the frequency domain.
PS: Similarly, cross-correlation in the frequency domain is the same as ordinary product by conjugate in the time domain. (due to the Fourier transform being almost its own inverse)
BTW some people (or a lot of people) may write conj(A)*B instead of A*conj(B). This doesn't yield the same result, but still, the two results are conjugates of each other.
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard - tél:+1.514.383.3801 - http://artengine.ca/matju | Freelance Digital Arts Engineer, Montréal QC Canada
You could "cheat", taking an engineer's approach: plot tendency toward runaway feedback against some appropriately chosen paramater values, use the data to aid in constructing a feedback gain modulator. If the system is predicted to run away for certain parameter values, maybe nudge the gain down a bit. A properly chosen modulation scheme may even allow you an additional quirky point of control over the "personality" of the installation at any given moment. Depending on just what intelligence extraction is going on as regards the fed in data, it might get hairy automating gain control, however, and even if an appropriate control scheme can be found it may be unstable, even to the point of unusability in performance. Babysitting may of course be required.
Or maybe store known good samples for comparison with data under feedback, choose where enough tonal/... difference is enough?
hope this helps
I've been working on the stable feedback between a loudspeaker and microphone for a little while....and I'm still working on it. I recommend first of all to try compression, as a means of reigning in your unstable feedback. Once the volume becomes loud enough, the roll-off will decrease the loop gain to the point where it is no longer unstable (won't blow up and clip persistently). It will however oscillate between low and high volumes this way.
To make your effects stable, you will need to do some analysis. For instance with convolution, you have to have the fourier components of the convolving signal everywhere less than 1. You are guaranteed stability if the integral of the square of the signal is less than 1. For instance with reverb effects, you can truncate your room reverb signal at the point where the integral is less than 1 (or adjust the gain by the integral of the signal)
The method I'm working on is for subband adaptive filtering to equalize frequency response. It's not going so well....I've been trying a frequency domain algorithm for a little while now...and I've tried a lot of different things to try to get it to converge, like averaging and selection, with no good results yet. Since I've already got it to record 64 consecutive measurements, I will try to program an independent components analysis next.
Chuck