[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Mixer latency



OK, I have done some more tests tonight on both NSSound and pygame, and I think that the results from yesterday may have been anomalies. Your thoughts on keyboard latency may also be correct. I did some more tests using the serial port device, instead of the keyboard, and this time the results were much more promising, with both sound libraries. I don't know what the difference could be; the only change was a reboot between yesterday and today, for a security update. Perhaps there was to much stuff running yesterday, and there was too much swapping going on; who knows.

Anyways, I will keep you all informed of my progress, but hopefully this will continue to work tomorrow as well 8-)

Cheers

Brian Fisher wrote:
That's a fascinating way to measure the latency - however it may not
be a good way to measure pygame mixer's own latency specifically (it's
really odd if you can't see a difference with different mixer buffer
settings). If you believe "gamer keyboard" sales people marketing,
depending on the hardware keyboards can have latencies up to like
100ms all on there own.
http://www.pcmag.com/article2/0,1759,1908876,00.asp

Also, I wonder what results the same test would give using something
other than pygame to play the sound?  here's some code on the mac that
may be able to do that:
-------------------
   from AppKit import NSSound

  class MacSound:
     def __init__(self, filepath):
       self._sound = NSSound.alloc()
       self._sound.initWithContentsOfFile_byReference_(filepath, True)
     def play(self): self._sound.play()
     def stop(self): self._sound.stop()
     def is_playing(self): return self._sound.isPlaying()
--------------------
that way you'd have some other data point for comparison.


On Sun, Mar 30, 2008 at 9:26 PM, Wyatt Olson <wyatt.olson@xxxxxxxxx> wrote:
 Once the application starts, type "0:1023" (without quotes), and hit
 enter.  A drum sound will play.  I am measuring latency by recording the
 whole thing in an audio recorder, and measuring the difference in time
 between the sound of me hitting enter and the sound of the sample being
 played.  In my tests, it seems to average to about 65 or 70 ms, with a
 maximum of about 100ms.


Attachment: signature.asc
Description: OpenPGP digital signature