From 5b6d1881abbb2655a9e8f7b9de874dbd869c4b23 Mon Sep 17 00:00:00 2001 From: Roman Zeyde Date: Mon, 2 Feb 2015 20:53:37 +0200 Subject: [PATCH] audio: don't specify framesPerBuffer. from "Pa_OpenStream" documentation: @param framesPerBuffer The number of frames passed to the stream callback function, or the preferred block granularity for a blocking read/write stream. The special value paFramesPerBufferUnspecified (0) may be used to request that the stream callback will receive an optimal (and possibly varying) number of frames based on host requirements and the requested latency settings. Note: With some host APIs, the use of non-zero framesPerBuffer for a callback stream may introduce an additional layer of buffering which could introduce additional latency. PortAudio guarantees that the additional latency will be kept to the theoretical minimum however, it is strongly recommended that a non-zero framesPerBuffer value only be used when your algorithm requires a fixed number of frames per stream callback. --- amodem/audio.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/amodem/audio.py b/amodem/audio.py index 26b6e7a..b78b9ee 100644 --- a/amodem/audio.py +++ b/amodem/audio.py @@ -92,7 +92,7 @@ class Stream(object): ctypes.byref(self.params) if read else None, ctypes.byref(self.params) if write else None, ctypes.c_double(config.Fs), - ctypes.c_ulong(config.samples_per_buffer), + ctypes.c_ulong(0), # (paFramesPerBufferUnspecified) ctypes.c_ulong(0), # no flags (paNoFlag) self.stream_callback, self.user_data)