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

[pygame] Catch mixer output



Hello all,

Is there any way to catch the output of the pygame mixer, say as a buffer/some sort of stream, in order to record it (in addition to/instead of playing it)?


I previously posted this question on the pygame reddit, but the more I delve into it, the harder it seems, so I'll take all the chances i can get.
So far I have found or imagined only four possible solutons, all of which seem absurdly involved:

- Parroting the mixer by keeping a sndarray that I update permanently with every new sound that is played

- This system-specific workaround  https://pyweek.org/d/4394/   which requires catching the stream played by PulseAudio. But it is frustrating to have the audio first sent to the OS, then recaptured by my program.

- An equivalent, more generic workaround with pyaudio (I would have used pymedia but it is quite dead). 

- not using pygame at all for the audio; can you recommend some alternative?


My goals include: internal audio/video capture (I got the video part already), and an interactive music making program.

Thanks for any idea! 

A.H.