I use PyAudio for many things and am very happy with it. If this is possible, I do not know, but I think it is possible.
One solution is to feed the audio buffer manually and control / set the required delay. I did this and it works very well. If you have a sufficiently high latency, it will work.
Another solution similar to this is latency management. You can queue and mix small audio files manually, for example. sizes 0.5-1 s. This will significantly reduce the requirements for "realism" and allow you to make pretty nice transitions between the "speeds"
I donโt know what latency you are dealing with, but if we talk about train speeds, I think that they do not change instantly - therefore, latency from 500 ms to several seconds is most likely acceptable.
source share