On Sat, Jan 15, 2011 at 11:38 AM,  <lu...@proxima.alt.za> wrote:
>> Can anybody comment this and/or possibly point me at some good documents?
>
> It looks kind of easy, although I've never gone there myself.  After
> all, you just need to display two lines, one fixed (you omitted to
> mention that you need to specify the tone you are after) and one that
> moves closer or further from the base line as the tuning is adjusted.
> Two points may suffice, but they may be hard to read.

Aliasing... You need to read more than two points, even if you produce
only two after. Essentially I would do something like:

Read N PCM samples from the sound card, this is just a read from the
audio in file, easy part.
The samples you can read from http://plan9.bell-labs.com/magic/man2html/3/audio
audio(3) or a similar interfaces provided by usb/audio usb(4).

Calculate some sort of windowed FFT.
Find the peak (I would correlate with a moving peak shape and find a big value).
Generate the read/estimated frequency, fin.

Then you can draw the margin for the frequency  error you tolerate
which are probably two lines fthlow, fthhigh or different colors
dividing the window/output in three
parts, too high, too low and acceptable and superpose the
line depicting fin over it (something like the letonian flag).
fthlow and fthhigh can come from the user clicking on the window and
moving up and down
or from some slider (I would do the first)..

This last part, I would use draw
http://plan9.bell-labs.com/magic/man2html/2/draw
draw(2). You can use control
http://plan9.bell-labs.com/magic/man2html/2/control control(2)
to add sliders but for what you are doing just drawing rectangles and
lines should be fine.

HTH.

G.

Reply via email to