Ladies, Gentlemen, please let me tell you that I have created small program finding 1st harmonic with accuracy 10 times and more better than fft can do. In few words I have create DFT grid with span 10 hz below and above fft pitch, divided in 200 parts, that is spaced by 0.1 hz. See my question at dsp.stackexchange. Indeed, programmer interesting in create software with my program, can change span and parts. Also he can use any method for find pitch in musical (periodic) sound. I suggest fft and relative snippet assuming 1st harmonic's amplitude is greater than half the maximum. Is my assertion correct?
-
Did you already ask this question at DSP? Seems like a better fit there. Either way, when you say “half the maximum”, what maximum are you talking about? – Todd Wilcox Nov 02 '22 at 11:53
-
@ToddWilcox. Thanks for commenting my question. 1) I haven't asked this question at DSP, but in question about snippet (see link in question here) Mr. Hilmar answered "You are supposing wrong". 2) by "half maximum" I mean maximum amplitude of harmonics. In my question at DSP, second harmonic's is maximum (220,000). Regards. – George Theodosiou Nov 02 '22 at 13:58
-
1If there is a recognized maximum amplitude for harmonics, I'm not aware of what it is. Do you mean, is the first harmonic always at least double the amplitude of the loudest of the other harmonics? Also, for the "first harmonic", do you mean the fundamental, f, or the harmonic just above the fundamental at 2x f? – Todd Wilcox Nov 02 '22 at 18:54
-
@ToddWilcox. Dear sir, thanks for your new comment. I mean that almost always in musical (periodic) sound (including singing human voice) fundamental frequency's (1st harmonic's) amplitude is higher than half the maximum amplitude of harmonics. For example, if maximum amplitude is second harmonic's (some 220,000), 1st harmonic's amplitude is higher than 110,000. By first harmonic I mean fundamental frequency. Regards. – George Theodosiou Nov 04 '22 at 08:30
-
Dunno what "most cases" is since the missing fundamental is a thing. – Dekkadeci Nov 04 '22 at 11:25
3 Answers
Your question is a bit unclear, but I'll try to provide some information:
The musical notes can have any arbitrary frequency spectrum. They don't even need to be limited to harmonic components. There is no rule saying that the base frequency must be the loudest, and it often isn't. Human ear deals with it. What is however characteristic for (most of) the pitched instruments is the frequency progression: f, 2 f, 3 f... and so on, even if some of those are absent, as in square wave mentioned by MS-SPO.
Regarding your algorithm, note that the pitch spectrum is logarithmic, so 10 Hz is a very wide window at low frequencies, and very narrow at higher frequencies. Also, I don't fully understand what you are doing, but I wonder if it's a variation of wavelet analysis?
- 16,667
- 2
- 24
- 66
-
Please accept my many thanks for you answered my question. At my site https://metrw-pitch.blogspot.com/ you can see what I'm doing. Just I'm creating documentation for any one interested create software for singers, chanters, violists, for help user see on screen in real time 8 times per second his voice's (or violin's) pitch in contrast to rectangular representing note, in order that regulate his voice for give the right (note's) pitch (frequency). Regards. – George Theodosiou Nov 04 '22 at 08:44
-
Regarding your 2nd paragraph I suggest you read code at https://metrw-pitch.blogspot.com/2022/08/dftgridm.html I have changed 10 hz to 40. When GridDemiSpan is great code doesn't work in low frequencies. I think it should be at most half the voicePitch. It's matter of trade off. What do you suggest me? Regards. – George Theodosiou Nov 04 '22 at 15:50
-
1@GeorgeTheodosiou It might be more efficient to express the search window as a percentage of the preliminary frequency candidate, rather than an absolute value in Hz, e.g. ±10%. Also, the search steps might not need to equal size in Hz depending on the frequency. Typically, musical pitch is expressed in cents, which is a logarithmic scale, and typical human ear resolution is of several cents, so depending on the exact application, there might be not much benefit from having steps much smaller than 1 cent. – user1079505 Nov 04 '22 at 16:15
-
Dear sir, many thanks for your comment by Nov 4. Already I have made 3 changes according to your instructions: 1. "GridDemiSpan = noteFreq / 2", 2. "PartsOfSpan = 1001", and 3. "TestFreqs = logspace(log10(FFTpitch-GridDemiSpan), log10(FFTpitch+... GridDemiSpan), PartsOfSpan)". Regards. – George Theodosiou Nov 08 '22 at 09:44
That assertion does not hold. See e.g. the spectrum of a rectangular pulse, which only has odd harmonics: https://en.wikipedia.org/wiki/Square_wave
- 948
- 1
- 16
-
2I think by “first harmonic” the OP actually means the fundamental (perhaps better called first partial), though it's by no means clear. – leftaroundabout Nov 02 '22 at 23:05
Ladies, Gentlemen, please let me tell you that Mr. Hilmar answered negative my question at https://dsp.stackexchange.com/questions/85037/whats-the-best-snipet-for-get-the-first-batch-of-matlabs-fft-abs-greater-than/85097#85097 then, for find FFT pitch I suggest (see https://metrw-pitch.blogspot.com/) "condition user give pitch between one tone (9/8) lower than note's frequency and one tone higher than it, even a student of music can do. Then program, by matlab's abs(fft()), find indices up to 12/10 note's frequency. 1st harmonic's abs is the maximum.". Regards.
- 121
- 3