
this was an error, or the very beginning of a
new frequency. If it is a valid new frequency,
the next reading will confirm that. We have
a little time before we need to change the
output. Changing too quickly back and forth
will sound bad.
b. Otherwise, if the pitch estimation is outside
of the valid range (line 139), we assume the
user has stopped humming! We set our
activePitch variable to -1, and we send
a Note Off message to any connected MIDI
devices.
c. Otherwise, we assume we have a valid
frequency! We convert that frequency (line
146) to a musical note. If that note is not
included (line 149) in our targeted musical
scale, we find the ...