bastibe/PySoundCard

Reading, without caring if data is skipped ?

Closed this issue · 1 comments

Hi,
I'm interested in using this for music visualisation, basically I want to read some data - but it to be the most recent data - what is the best way of doing this ?

If I use stream.read then I can end up behind, whats the best way to get the most recent [amount] of bytes, each time I draw a frame.

I guess ideally on the backend would be some kind of ring buffer, I could then get that into numpy to do things like fft when I want to draw a frame.

Cheers
S

Actually, stream.read will only buffer up to one blocklength (1024 by default). You should be fine with just using that. If you don't read() for a while, all but the most recent blocklength samples will be discarded.