Re: Basic question
Re: Basic question
- Subject: Re: Basic question
- From: Laurent Cerveau <email@hidden>
- Date: Wed, 27 Mar 2002 14:59:19 +0100
On Wednesday, March 27, 2002, at 12:38 PM, Matthew Johnson wrote:
>
What I don't understand is what each float value actually is.
>
Each value corresponds to the value of the signal after conversion
"device native format" to float. The path of audio is in general the
following one : the sound is emitted in the air, capted by a microphone
on the device (could it be the built-in device or an external one like a
USB device), converted from the analog to the digital domain by the ADC
on the device, and then moved to the audio system of the Operating
system. The point of junction between hardware land and software land
is the driver. For output, the path is reversed.
Pretty often, the data moved to the sound system are in the same format
as the one that comes from the analog to digital conversion. For example
if the device is setup to deal with 16 bits data, it will pass 16 bits
signed integer. In MacOS X, all the procesing inside the audio stack
(CoreAudio) is done in float. In the example, the driver is doing the
conversion from the 16 bits to the float data.
Now the question is how to deal with this kind of conversion....
>
I.e if I record some audio I seem to get floats within the range of
>
-0.4 to
>
0.4 (I don't know what the units are) As far as I can deduce each value
>
must
>
represent a Amplitude and a Frequency.
If you deal with 16 bits data, then it is possible to represent 65536
different values with this number of bits : as you want to represents
data that can be either positive or negative (the sound wave corresponds
namely to a variation of pressure around an "average" value in the air),
these 65536 will be representing
half positive and half negative value. In fact this is not exactly
true, as 0 is one of these values and needs to be represented. So there
is a little non symetric place in the system. The driver is then mapping
these values to the floating range of [-1, 1].
Note that there is no "time" or "frequency" information here. The only
thing you can know is the sampling rate , which gives you the time
between two samples (1/SR). Getting the fundamental frequency of the
signal itself is a tricky problem, especially as you can deal with
different kind of tones.
>
Can I
>
determine from each value ( which I am assuming is a sample ) the
>
Amplitude
>
in Db's and the frequency in Hz.
Your question is also entering the vast domain of decibels. In fact
decibel scales are often used for many things . By definition a dB scale
is representing a relative value and not an absolut one. From am
acoustical point of view there is a reference pressure (2.10^-5 Pascal
if I remember well, but I I may be totally wrong). So when you say this
signal has a value of N dB, in fact this is in relationship to that
reference value, with the relationship :
dBValue = 20 log10 (amplitude of value/amplitude of referencevalue).
This, if you talk absolute dB. However dB can also be used to talk about
amplification. For example you can say this amplifier has a gain of X
dB, which means that
X = 20log10( amplitude of output value/amplitude of input value)
dB scales are very common as you can easily compute the total gain (in
the general sense) of an audio chain by simple addition. Note that
CoreAudio is pretty nice with you and is giving you the possibility to
query directly the value in dB of the hardware amplification, and avoid
you to manipulate logarithm. But this value is really a relative value
not an absolut one (see the AudioDeviceGetProperty call, and the list of
properties that can be passed).
Talking about the dB value of a signal is, in my opinion, not an easy
thing : what would be the reference signal : a sine wave of amplitude 1,
a white noise of power 1, ...? I personnally think this apparently
simple question can lead to multiple answers and would be curious to see
the other answers of that question. Note that you can also talk ain dB
for the dynamic of a signal which adds to the complexity.
>
I could be completely wrong. I am a total newbie to this.
>
We all were one day....and sometimes believe we are not :-) : I will be
curious to see how many errors will be reported in the email above
Laurent
Laurent Cerveau
Applications Division
Apple Computer Inc.
email@hiddenrent
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.