Obtain Envelope and Pitch curves of my Singing Voice I wish, in real time, to hum into a mic and produce via dsp the envelope and pitch of what I am humming, before outputting these two signals to my analog synth. This synth takes a gate and a cv signal.
Control Voltage/Gate is an analog method of controlling synthesisers, drum machines and other similar equipment with external sequencers. The control voltage typically controls pitch and the gate signal controls note on-off (or ASDR).
I'm trying to figure out what algorithms would be suitable for establishing these two signals. I have made an attempt using a sliding blackman window and zero-padding. I apply an fft in order to extract the pitch and loudness of these windows. I'm using a sampling rate of 8kHz and I'm humming melodies within roughly a two octave range.
I'm wondering about other approaches. I have read a little about the hilbert transform and noted that it is used to find the envelope of narrow band signals. Am I right in say that my voice would not be suitable in this case since as it contains multiple harmonics? Could I bandpass around the fundamental harmonics in the frequency spectrum (fft window)?, before applying an ifft. What about the fact that the attack portion of a note is often rich in higher harmonics. I presume I would need to compensate for this if bandpass filtering is an option. Could I possibly use the hilbert approach? Any other suggestions?
A zero-padded FFT is not the best method for accurately estimating musical pitch in (near)real-time.  I suggest researching other pitch detection/estimation algorithms (lots of literature and research papers), such as interpolated autocorrelation, AMDF, YAAPT, cepstrum, harmonic product, phase vocoder, and etc., and see if one of those algorithms better meets your exact requirements.
Once you have a pitch estimate, you can sum the waveform energy over a single or small integer number of pitch periods, as that will include all the harmonics, even if fundamental frequency energy is low or missing.  Using an integer number of periods will reduce the amounts windowing artifacts (scalloping or so-called &quot;leakage&quot;) that can appear in a non-integer-period-multiple sized FFT magnitude.
Hilbert methods of measuring envelopes work best for narrow-band signals, but where one does not know or can not extract the exact periodicity.  And a human singing voice is rarely, if ever, narrow-band.
The &quot;attack&quot; portion of a pitched vocalization may not only be rich in harmonics, but temporarily ambiguous in pitch (e.g. not purely periodic, even disregarding envelope).