Determination of common periodic signals (square, sine, sawtooth, ...)

Without any interaction with the user, how will the program determine what type of waveform is present in the recording from the ADC?

For this question: triangle, square, sine, half-sine or sawtooth waves of constant frequency. The level and frequency are arbitrary, and they will have noise, slight distortion and other shortcomings.

Various waveforms

I also offer some (naive) ideas, and you can vote for them up or down.

+6
numerical audio signal-processing waveform
source share
7 answers

You definitely want to start with autocorrelation to find the fundamental one.

In doing so, take one period (approximately) of the waveform.

Now take the DFT of this signal and immediately compensate for the phase shift of the first hopper (the first bit is fundamental, your task will be easier if all phases are relative). Now normalize all the bunkers so that the fundamental one is unity gain.

Now compare and compare the remaining bunkers (representing harmonics) with a set of pre-saved waveforms that you are interested in testing. Accept the closest and reject as a whole if it does not meet some threshold of accuracy determined by noise measurements.

+7
source share

Make an FFT, find the odd and even harmonic peaks and compare the speed with which they decrease to a library of common signals ... peaks ....

+4
source share

Perform autocorrelation to find the fundamental frequency, measure the RMS level, find the first zero crossing, and then try to subtract common signals at that frequency, phase, and level. Whatever the victory, the best wins (and more than some threshold).

+3
source share

This answer does not imply any noise and that it is a simple academic exercise.

In the time domain, take a sample based on the difference in waveform samples. Histogram of the results. If the distribution has a pronounced peak (mode) at zero, it is a square wave. If the distribution has a pronounced peak with a positive value, it is sawtooth. If the distribution has two sharply defined peaks, one negative and one positive, this is a triangle. If the distribution is wide and peaks on both sides, it is a sine wave.

+2
source share

arm yourself with more information ...

I assume that you already know that a theoretically perfect sine wave has no harmonic partitions (i.e. only fundamental) ... but since you are going through an ADC, you can throw the idea of ​​a theoretically perfect sine wave out of the window ... you need fight against aliasing and determine what the β€œreal” partial is and what artifacts ... good luck.

The following information comes from this link about csound.

(*) The sawtooth wave contains (theoretically) an infinite number of harmonic particles, each with respect to the inverse partial number. Thus, fundamental (1) has an amplitude of 1, a second partial 1/2, a third 1/3 and nth 1 / n.

(**) A square wave contains (theoretically) an infinite number of harmonic partial numbers, but only odd harmonics (1,3,5,7, ...). The amplitudes are in the inverse partial number ratio, as are the sawtooth waves. Thus, fundamental (1) has an amplitude of 1, a third of 1/3, a fifth of 1/5 and nth 1 / n.

0
source share

I think that all of these answers are still pretty bad (including my previous ones ...) after I thought about the problem a bit more, I would suggest the following:

1) take a 1 second sample of the input signal (it doesn't have to be that big, but it simplifies a few things)

2) throughout the second, zero intersections are counted. at the moment you have cps (cycles per second) and know the frequency of the generator. (in case you want to know)

3) now take a smaller segment of the sample for work: take exactly 7 zero intersections. (therefore, your working buffer now, if rendered, will look like one of the graphical representations that you sent with the original question.) use this small working buffer to perform the following tests. (normalization of the working buffer at this moment can make life easier)

4) square wave test: zero crossings for a square wave are always very big differences, look for a large delta of the triangle, followed by a slight movement until the next zero transition.

5) saw wave test: similar to a square wave, but a delta of a linear constant value will follow a large signal delta.

6) test for triangles of a triangular wave: linear constant (small). find the peaks, divide by the distance between them and calculate what the triangular wave should look like (ideally), now check the actual signal for deviation. set the deviation tolerance threshold and you can determine if you are looking at a triangle or sine (or something parabolic).

0
source share

First find the base frequency and phase. You can do this with FFT. Normalize the sample. Then subtract each sample with the waveform sample that you want to test (with the same frequency and phase). A square result adds all this and divides it by the number of samples. The smallest number is the waveform you are looking for.

0
source share

All Articles