python-sounddevice icon indicating copy to clipboard operation
python-sounddevice copied to clipboard

Setting latency returns unexpected result

Open wilsco opened this issue 5 years ago • 1 comments

Hi,

The following code produces an unexpected result.

import sounddevice as sd
sd.Stream(channels=1,latency=(0.1,0.1)).latency

returns :

(0.014512471655328799, 0.10158730158730159)

I would not have been as surprised if it returned a latency longer than the desired input latency, but why would the first value be so much smaller than 0.1?

The devices being used are:

   0 Microsoft Sound Mapper - Input, MME (2 in, 0 out)
>  1 Microphone Array (Realtek High , MME (2 in, 0 out)
   2 Microsoft Sound Mapper - Output, MME (0 in, 2 out)
<  3 Speaker/HP (Realtek High Defini, MME (0 in, 2 out)

wilsco avatar Sep 08 '20 21:09 wilsco

Can you try some more extreme values to check if the returned values change at all? Can you try different values for input and output?

There might be a bug in the sounddevice module mixing up inputs and outputs (or something like that), but it might also simply be the behavior of the PortAudio library.

mgeier avatar Sep 26 '20 16:09 mgeier