2013/7/11 Peter Meerwald <pmeerw at pmeerw.net>: > Hello, > >> that there is no reuse of the leftover samples across the rewind. This >> also applies to your wrapper, otherwise the following happens: >> pulseaudio pushes some samples to the resampler, resampler (or >> wrapper) remembers the last few of the fed-in samples because they >> would be needed for the next portion, but then pulseaudio feeds in a >> completely unrelated block of audio instead of that portion because of >> the rewind. > > thank you for pointing this out > > so if there is a rewind, reset() must be called on the resampler Sorry for playing dumb - could you please point me to some documentation what a reset() does? If this only zeroes out the internal left-over buffer, this is wrong. Also see http://www.mail-archive.com/pulseaudio-discuss at lists.freedesktop.org/msg06294.html - while my comment about IIR filters obviously doesn't apply here (because both ffmpeg and speex resamplers settle in a finite and actually very short period of time), it should give you some inspiration. > I guess some test code would be handy... Well, the simplest test case (from my viewpoint) would be: submit a second of static (i.e. some non-zero DC level), half-second of a beep, half-second of silence, rewind one second, submit one second of static. The end result should be half-second of anything (we have to allow that in order for the initial onset of static to settle in the resampler), followed by 1.5 seconds of static, without any clicks in the middle of that static. Right now I am busy with other things, and thus cannot write code, but I would be happy to review your code if you mail it to me or to the list. Also (unrelated to pulseaudio) it would be very nice if you write similar (differing only by adding beeps in the beginning and in the end) testcases for pure ALSA, using mmap and using snd_pcm_rewind, so that one can test by ear that there are no clicks or artifacts between the beeps. -- Alexander E. Patrakov