Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 Dec 1997 11:33:14 +0100 (MET)
From:      Luigi Rizzo <luigi@labinfo.iet.unipi.it>
To:        steve@visint.co.uk (Stephen Roome)
Cc:        multimedia@FreeBSD.ORG
Subject:   Re: precise soundcard tuning ?
Message-ID:  <199712221033.LAA02195@labinfo.iet.unipi.it>
In-Reply-To: <Pine.BSF.3.96.971222110348.5515A-100000@dylan.visint.co.uk> from "Stephen Roome" at Dec 22, 97 11:19:03 am

next in thread | previous in thread | raw e-mail | index | archive | help
> I wrote a really simple program last night that just writes an X Hz sin
> wave to a file as raw 16 bit unsigned data. I then used sox to convert
> this to a WAV file and played it with rplay.
> 
> Although my program seems to work fine, 440Hz from it just doesn't match
> the A/440 tuning fork I've got. The computer is about a semitone flat,
> unfortunately I need it to be perfect (or very close anyway ?).

for various reasons (essentially cutting complexity in the hardware,
and using shorter counters on the frequency divisors, and not using PLLs)
some sample rates on many soundcards are only approximate to 1% or so.

This is a _systematic_ error, not related to the precision of the
crystal (which should account for some 0.0001 % or so). You can
compensate the problem by determining the actual error using a
known reference, and using the appropriate scaling factors.

Since capture and acquisition often have the same sample clock,
you could sample the tuning fork with a microphone, determine the
actual period in samples, and then generate the sound with the
"correct" (i.e. equal to the reference) frequency.

Should not be too hard.

	Cheers
	Luigi
-----------------------------+--------------------------------------
Luigi Rizzo                  |  Dip. di Ingegneria dell'Informazione
email: luigi@iet.unipi.it    |  Universita' di Pisa
tel: +39-50-568533           |  via Diotisalvi 2, 56126 PISA (Italy)
fax: +39-50-568522           |  http://www.iet.unipi.it/~luigi/
_____________________________|______________________________________



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199712221033.LAA02195>