[futurebasic] Re: Sound Routines?

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : November 1997 : Group Archive : Group : All Groups

From: mags craven <mags@...>
Date: Mon, 24 Nov 1997 22:23:26 +0000

Helvetica>2. Measure the microphone
input as a frequency value (kHz).



There are a number of ways to determine the incoming frequency each has
the

usual pros and cons. They are,


1. FFT or Fast Fourier Transform. This is from all the research that
I've done the

best and most accurate way to archive what you want. However the main
problem

is that I have not been able to get a working FFT routine going in FB.
This to be

honest could well be my fault. Ted was kind enough to send me a
QuickBasic FFT

but as I say I have been unable to get it working in FB. With Ted's
permission I

would be only too happy to send you a copy. I'm sure there are a few
people on the

list that would be interested in this.  FFT is the method used by all
the

"professional," signal processing systems that I've come across. If you
intend to

examine complex waveforms this is the only way to go.


2. As you mentioned Zero Crossings is a possibility. Problems are that
no matter

what sample rate you are using you will not be able to get fast enough
a sample rate to

detect every single zero crossing. For example even at a sampling rate
of 44.1KHz

you mac or any other sampler for that matter will still only be to take
a sample every

0.000002267 seconds. Simple question what happens if the zero crossing
occurred

between two samples, (which from experience I can tell you that 9 times
out of 10 it will)

answer you failed to detect it and your calculation goes to pot. To get
over this problem

a process called Interpolation can be used. This is a simple formula to
guesstimate the

position of a Zero Crossing that happened between to sample points.
This method is not

very accurate nor very linear however you may decide that you can live
with this.

It is relatively straightforward to implement and I can give you more
information of

this if you need it.


I guess my real questions would be what you need to used this for, how
accurate does

it need to be ?


Have to you look at Digital Oscilloscope ? It's a really neat little
programme that will

either calculate the frequency of an incoming frequency or display it's
waveform on

screen As Ted mentioned in his posting this is only any good if you are
trying to examine

a fixed input frequency.  You can get a copy of
Digital Oscillscope from my WEB site

at www.g0oanint.demon.co.uk


Hope this helps,



Sean.