Using threads for audio computing?

Chris Angelico rosuav at gmail.com
Mon May 12 01:58:29 EDT 2014


On Mon, May 12, 2014 at 3:54 PM, lgabiot <lgabiot at hotmail.com> wrote:
> So back to my original question: A Queue and two threads (producer/consumer)
> seems a good answer to my problem, or is there a better way to solve it?
> (again, I'm really a beginner, so I made up this solution, but really wonder
> if I do not miss a well known obvious much better idea).

Well, the first thing I'd try is simply asking for more data when
you're ready for it - can you get five seconds' of data all at once?
Obviously this won't work if your upstream buffers only a small
amount, in which case your thread is there to do that buffering; also,
if you can't absolutely *guarantee* that you can process the data
quickly enough, every time, then you need to use the queue to buffer
that.

But otherwise, it sounds like a quite reasonable way to do things.

ChrisA



More information about the Python-list mailing list