# Audio Zero-Crossing Detector

Status
Not open for further replies.

#### rWAVE

##### New Member
I am interested in identifying the instantaneous, dominant frequency in a complex audio (i.e. music) waveform (30Hz - 7000Hz) for use in a color organ project. Not wishing to pursue more accurate techniques such as FFT, I believe that simply measuring the time between successive positive-going, zero-crossings will provide the desired dominant frequency, which can then be used to generate the expected visual effect.

I would appreciate any comments on this approach, and if sound, some circuit suggestions as I have not found any suitable, single-supply designs that handle the stated audio frequency range.

#### dknguyen

##### Well-Known Member
You want single supply? Can't you just bias it with a resistive dividier and isolate the bias from the source with a series resistor then feed it to an comparator with the bias voltage as the reference?

But keep in mind: this zero-cross method won't work too well if non-dominant signals are strong enough as they will cause additional zero crosses and and mask fundamental zero crosses (pull the fundamental zero cross away from the zero due to superimposing of non-dominant frequencies).

BTW: 30Hz-7000Hz FFT should be fairly easy to do. Use the built-in ADC on a dsPICs and use the math libraries provided by Microchip which have 256 bin FFT function written for them. You can sacrifice sampling speed for increased bin resolution since accuracy isn't a concern as much as the frequency resolution of the FFT and only sample at 14kHz. THen you have 14kHz/256 bins = 55Hz, and thus an a fundamental frequency accuracy of 27.5Hz of if you just pick the bin of the largest amplitude.

I think you might have trouble with the low frequency end though...because 256 samples at 14kHz only covers a one period of a 54Hz signal and no lower.

EDIT: Googling around and playing with FFT appelets and it seems that even though the even though a number of samples and sampling frequency combination can't capture an entire period of a low frequency, it will still capture it properly in the FFT when it's done...somehow.

Last edited:

#### rWAVE

##### New Member
THANKS for the input, dknguyen.

I hadn't even looked at the dsPICs, but will now as FFT might not be as complicated as I earlier thought (by doing it in software).

256 bins is far more than I need as I plan to assign the entire frequency band (30Hz-7000Hz) to 10-20 frequency channels, with each channel assigned to either a unique color (via 8x8 RGB LED matrix) and/or display patterns.

I expect to update the color/display pattern between 5 and 40 times per second, depending on type of music and desired visual display.

A couple of advantages of a zero-crossing OA design is that the circuitry is simpler and no need for input signal amplification or AGC.

#### Nigel Goodwin

##### Super Moderator
THANKS for the input, dknguyen.

I hadn't even looked at the dsPICs, but will now as FFT might not be as complicated as I earlier thought (by doing it in software).

256 bins is far more than I need as I plan to assign the entire frequency band (30Hz-7000Hz) to 10-20 frequency channels, with each channel assigned to either a unique color (via 8x8 RGB LED matrix) and/or display patterns.

I expect to update the color/display pattern between 5 and 40 times per second, depending on type of music and desired visual display.

If you check the PICList there's an old (very old) project for creating an audio spectrum analyser display that directly feeds a VGA monitor - I think it used a 17C or 18C series chip?.

A couple of advantages of a zero-crossing OA design is that the circuitry is simpler and no need for input signal amplification or AGC.

But it's not going to be of any use, as it won't work for much above single tones.

Status
Not open for further replies.

Replies
9
Views
1K
Replies
19
Views
7K
Replies
8
Views
9K
Replies
14
Views
6K
Replies
3
Views
600