sample rates in audio

Stephen Barncard stephenREVOLUTION at barncard.com
Tue May 16 21:15:22 EDT 2006


I just checked out the docs. I'd never looked at this before.


recordRate = 5 gives a sample rate of 5k  -- THIS is the SAMPLE RATE

According to Nyquest, the highest frequency that can be passed at a 
sample rate of 5k/second is 2.5khz.

recordSampleSize = number of bits used to record  = 11 -- THIS is the BIT WIDTH


I am not aware one could specify odd bit lengths. The number of bits 
determine the dynamic range - how many steps are used to represent 
the high and low points in the audio waveform.

  This is an odd pair - you should test on several players. I was not 
aware that sound files rate and bit properties would be recognized on 
a sliding scale.

I would check for the 'chipmunk effect' on voices. There are 
standards that are base on the power of 2

96 48 32
88.2 44.1 22.05 11.025 5.5125   should be standard values for 
recordRate if the hardware can do it.

The fractional sample rates are that way because early CD players 
were based on color TV crystals for frequency stability. Because they 
were around already in the millions and cheap. Also video tape 
machines were the only devices around that had the bandwidth to 
record audio digitally at the time. The digital audio had to be 
turned into an analog video signal to record on tape! You could look 
at it on a video monitor.

And again these numbers below are 'standard' bit widths.
32 24 16 8  -- recordSampleSize

I don't know how rev would store an 11 bit wide word without waste. 
Computers store info in their nice 8-wide world. It comes down to 
parts and sanity. There are packing methods to do this - is that's 
what's happening here?

Try a test. See if there is no difference in file size between using 
11 bit and 16 bit wide for  RecordSampleSize

- which is NOT the sample rate by the way - it is the width of the 
word describing the voltage of the waveform at that slice of time)

-- the sample rate is actually set by the recordRate property

typical Rev misleading property and command names.   At least there's 
no DestroyRecording command.

If I used the sound features I would immediately bounce the params 
from my own well-named commands and call them what I like. Also 
define with standard rates in constants.

sqb




>Amazing... Stephen... I really don't know much about this... I mean 
>I don't know theactually "audio physics" between bits and sampling 
>rates. Of course sample rates seems obvious... how often the 
>recorder is "trapping" for sound, but how that relates to 'bits" is 
>mysterious... anyway... just going with what you said:
>
>on recordSound
>   set the recordsamplesize to 11
>   set the recordrate  to 5
>   set the recordformat to "wave"
>   record sound file gAudioTestPath
>end recordSound
>
>I'm getting really decent quality at about 15 K per second or 900 K per minute
>
>i.e. 11 seconds gives  us a 168 K file... I don't think it gets any 
>better than that!  And you seem to have declared the bottom 
>threshold... as anything less than a sample rate of 11 starts to 
>break down noticeably... I guess  everyone has figured this out long 
>ago...
>
>Sivakatirswami
>

-- 
stephen barncard
s a n  f r a n c i s c o
- - -  - - - - - - - - -



More information about the use-livecode mailing list