On 22/08/2012 17:07, Peter wrote:

> But, often there will be some level of buffering in the buffer sent to 
> the sound card. That part we can't answer I suspect (maybe someone on 
> list does know?)

Although it varies a lot by sound library, operating system, etc, the 
basic algorithm is that you fill some buffer and the soundcard will read 
the buffer sample by sample until empty.  Many soundcards can literally 
let you feed new samples one sample ahead of them being needed to be fed 
into the audio card, however, it's impractical to get any common 
operating system to wakeup a thread and service something 1,000 times a 
second if the machine is under reasonable load, and certainly not at 
44.1Khz.   So much more common is that the buffer is sized such that the 
thread generating samples has ample time to wakeup frequently, generate 
some data and feed the audio buffer without an underflow occurring.

So, if your framesize were 20ms, then it would seem sensible to set your 
framesize to say 10ms (100hz is likely achievable on a well setup linux 
machine), and that way you should have a 10ms delay due to buffering and 
up to 10ms of additional buffer to prevent underflows (someone check 
that logic for me?)

Additionally the soundcard processor and the DAC itself will create a 
delay of somewhere in the region of 8-40 samples (possibly more). Likely 
that is just a few millisecs, but would need to be measured on a per 
soundcard basis (eg I think my RME 9632 has either an 8 or 12 sample 
output delay - I measured it once, but can't remember the answer now, 
but it was around that kind of level)

Kind regards

Ed W

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Freetel-codec2 mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freetel-codec2

Reply via email to