LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

"Using the harmonic analyser to determine the musical note of sound input from a mic and soundcard"

"Hi there, I am currently trying to extract what musical note is being sung via a mic plugged into my soundcard and using the harmonic analyser VI, I am experiencing problems however, as the fundamental frequency output does not always match the note being sung. Does anyone have any ideas why this may be? I initally thought it may be due to aliasing occurring but this is compensated for in harmonic analyser VI! If anyone has any suggestions I would be extremley grateful. Thanks
Em"
0 Kudos
Message 1 of 6
(3,764 Views)
This is one question with a lot of potential answers. The human voice produces very complex waveforms. It is possible for different components of the waveform to combine to produce peaks at frequencies other than the fundamental. Have you tried it with a "pure" tone (tuning forks should work reasonably well)? The microphone/soundcard may have non-linear response (I know that mine at home does). I'd say - try it with a pure tone first and see that it works.

Rob
0 Kudos
Message 2 of 6
(3,761 Views)
I'm pretty sure it would work fine with pure tones (although I do intend to test this), my problem really is how to fix it so that it can work with voices! One idea I thought about was to apply the A-weighting to the waveform to more accurately model the way a human would hear the sound, but I'm not sure how much difference this will make, any other suggestions would be very useful.
Thanks
Em
0 Kudos
Message 3 of 6
(3,761 Views)
[posted and mailed]

em wrote in news:5065000000050000009F680000-1012609683000
@exchange.ni.com:

> I'm pretty sure it would work fine with pure tones (although I do
> intend to test this), my problem really is how to fix it so that it
> can work with voices! One idea I thought about was to apply the
> A-weighting to the waveform to more accurately model the way a human
> would hear the sound, but I'm not sure how much difference this will
> make, any other suggestions would be very useful.
> Thanks
> Em



Rob Cole is right, your question is one that has a lot of potential
answers.

Here are a couple of notes / thoughts:

A-weighting probabably won't help much for your particular app, as it
sounds like your are more interested in tone detection, rather than
modeling how a human would hear or compliance with a standard.

Probably the most likely reason you are seeing the fundamental frequency
vary is that you are measuring a real-world signal that is a human voice.
Even though your singer may be singing a constant note, the frequency
content will vary somewhat--your singer is an imperfect boilogical
system. (Nothing against your singer in particular--no signer is
perfect!) Also, as Rob Cole pointed out, your singer's note isn't a pure
tone at all, but a collection of harmonics that you perceive as a note.

Regarding aliasing, it's important not to confuse any algorithmic
compensation (applied after a signal has been sampled) with true alias
protection. If you are using a sound card, it likely doesn't have
hardware-based alias protection. The only way to ensure that aliases
don't intrude on the frequency span of interest is to apply a hardware
filter prior to sampling your signal. Such filters can be added to the
front end of a DAQ board or come built-in with DSA hardware such as the
NI 4472. The software alias-related functionality of the Harmonic
Analyzer VI's simply excludes signal content that exceeds the Nyquist
rate in the distortion calculation.

I'm not sure specifically which VI you are referring to, but the SINAD
and Harmonic Distortion Analyzer VIs from the waveform analysis palette
use a tone detection algorithm to find the fundamental which is the same
as the one found in the Extract Single Tone Information VI. All of these
VIs include an advanced search input where you can specify a guess for
the frequency of interest and a range (as a percent of the sampling
frequency). You might try to narrow the search from the "try everything"
mode (-1 in the approx freq.) to something with less span around the
expected freq range.

Take a look at the power spectrum of your signal and verify that you see
a distinct, time-invarient peak where you expect your fundamental. My
guess is that you don't. I've whistled into a mic enough to know.

A final suggestion is to increase the duration (# of samples) acquired in
your acquisition. When you do so, you increase the duration of the signal
window that you analyze. If your signal shows slight frequency variation
over a given period of time, they can tend to average out with increased
duration of the signal that you analyze.

Hope this helps!

--Sam
Message 4 of 6
(3,761 Views)
Thanks very much for that - you've certainly given me several more things to think about. Do you know if it is possible to get hold of any more detailed documentation about the Harmonic Analyser/Extract Single Tone vi's?
Thanks
Em
0 Kudos
Message 5 of 6
(3,761 Views)

another thing to consider about voice note recognition... first the approach being used seemes to need prefiltering to acually reduce it's output accuracy; it tracks everything and that can relate to unstability because the voice being such a complex waveform (its never a pure tone). 

a filter should be designed to provide windows of acceptable pitch ranges; ie the chromatic scale.... with centerpoints at known well calculated "standard" 12 tone harmony pitches over several octaves.

the "windows" accuracy should be based on cents or +/- 1/100 of a semitone. these wil be a graduated set intervals with some well known multiplyer function.

as the sensed voice note is analyzed its fundamental will apear to be more stablil (depending on the window accuracy) as it will be filtered into 1 of teh 12 tones within teh appropriate octave. displays can be developed comparing center freq of the "window in use" verses the freq offset for displaying sharp and flat values in cents...   

it seems at least in theory that fft can then be filtered by this for a more less accurate but more useful tool for pitch recognition.

check out the peterson tuners for a nice disply; they emulate a strobe tuner on a LCD with 1/100 semitone accuracy.

let me know when you build "the labview tuner" 

regards

jp

0 Kudos
Message 6 of 6
(3,511 Views)