# Time-Average circuit?

Status
Not open for further replies.

#### solis365

##### New Member
I was wondering if there is some sort of circuit topology used for obtaining the time-averaged value of a signal.

i.e. the integral of a signal over a period of time set by whoever designs the circuit.

So for example, I have music playing, and I want to know the average voltage level over the last, say, 500ms, and I want this average to update continuously.

Is there a way to do this using analog techniques? Obviously you can just use an ADC, sample and hold, DAC algorithm on a uC but what if I wanted to leave digital signal processing out of the deal?

perhaps some kind of opamp circuit? maybe it would charge a capacitor to a desired level?

it doesnt have to be super accurate, or even reject the last "measurement" immediately... I mean, digitally speaking, if you want the moving average of 10 samples, when you take sample 11 you drop sample 1. For this analog application, you will obviously never be able to reject sample 1 entirely. So maybe if sample 1 was only weighted half as much by the time you are measuring sample 11... like I said, not super accurate.

I guess this would be for use in a sort of peak-detection circuit, now that I think about it. i.e. compare the magnitude of some transient spike to the average value of the signal over the last x seconds.

My initial application is to detect the "beat" of a music signal. Just to see if I can do it easily enough, but I would like to be able to extrapolate the idea to higher performing circuits.

#### kpatz

##### New Member
My initial application is to detect the "beat" of a music signal. Just to see if I can do it easily enough, but I would like to be able to extrapolate the idea to higher performing circuits.
Given the way today's music is compressed more than neutron star matter (open up any recent recording in a computer wave editor to see what I mean), I doubt any kind of voltage/amplitude based beat detection is going to work except on older, quality recordings.

At the very least you'll need to break the music down into frequency bands and look for the beat that way.

#### solis365

##### New Member
Well yes, I was going to at least low-pass the music output to isolate the bass from the rest of it a little bit. I can play around with that once I get a basic idea of what the circuit would look like. I can also try fine tuning it for a specific type of music thats easy to pick the beat out of (techno perhaps), or even for a specific song or fabricated waveform.

I don't want to get too off topic by discussing the specific needs of my application - I really just want to know if this can be done at all. If there is a basic analog method of the sample, hold, average algorithm to implement a moving average with a rough user-adjustable record time (# of samples, if you will, but this is analog, so everything is continuous).

My requirements at this point are:

low speed ( < 1kHz operation )
low number of samples (500? 1000? 5000 max?)

I am going to use a line-level music signal, so a few hundred mV average level. If necessary, I can just use a simple voltage amplifier on this to get it up to a level thats easier to work with. Again, once I get a handle on how this works I will be able to make it more precise and usable at lower voltages.

all my music is fairly high bitrate anyway (320kbps mp3), or FLAC. I could use a CD player with a high quality DAC circuit for better audio replication.

Last edited:

#### Sydney

##### New Member
I would suggest using dB meterswith freq. filters and a sampling rate. Hence you choose your band, i.e. 500c/s, 2000c/s, etc., and sample rate, set by 555 for example and procede from there.
Sydney

Think outside the square then square it

#### solis365

##### New Member
so there is no simple (at least in concept, if not implementation) analog circuit to find the average voltage over the last X seconds..?

I wonder if it would be possible to use a capacitor.

(1) Set something up that samples voltage at a desired rate.
(2) Given the size of capacitor, rate of sampling, and desired timespan to average over, convert the sampled voltage to a current that will add enough charge to the capacitor to appropriately change its voltage to represent the average voltage.
(3) repeat
(4) to read the voltage from the capacitor, simply use a high input impedance opamp to compare the capacitor voltage to some stable reference voltage.
The high input impedance prevents the capacitor from discharging during reading.

kind of like a charge pump circuit

It just seemed like someone somewhere might have already done this and I wouldn't have to design it myself. Its a little above my head, meaning I've never worked with charge pumps before, but no pain no gain, right?

sound feasible?

Status
Not open for further replies.

Replies
13
Views
7K
Replies
21
Views
2K
Replies
49
Views
16K
Replies
3
Views
864
Replies
27
Views
10K