I'm currently developing an audio processing software that must detect the frequency of the incoming signal by use of Zero Crossing estimation. It's not difficult to estimate the frequency when a perfect sin wave is the input, but when speaking about a piano, the soundwave is different and the theory behind this changes.
At the moment the software detects every zero and saves the index location between it and the previous one (to record how many samples have gone by).
The following is an array that contains the samples between each zero for a 130 Hz piano C note sampled at 44.1kHz.
44 11 36 65 56 12 37 66 52 13 38 67 51 11 39 68 50 11 47 60 49 11 48 61 47 14 47 66 43 13
The task is to determine an unknown pattern of an unknown length. But, these patterns might have an error margin. For example,
44, 11, 36, 65
56, 12, 37, 66
52, 13, 38, 67
are patterns. So, after processing the pattern's mean sums the frequency can be easily detected. How can I detect these type of patterns, knowing that the pattern, as is, and the length of it is unknown.