[python-win32] Python sound playback threading control?

Jacob Kruger jacob at blindza.co.za
Thu Feb 14 06:45:05 CET 2013


Well, it's currently making use of the sound_lib module - not sure which API 
it's using as such - but am using the stream object's play_blocking() 
method, which seems to be meant to interrupt other playbacks, but also 
played around with first using the stream's stop() method, before then 
trying to initiate .play(), or play_blocking(), and while they all seemed to 
work a little differently, none of those options seemed to really handle it 
quite like I would have hoped for/expected, in terms of just cutting sound 
playback off immediately, and then initiating a new playback, or something - 
suppose should also test this a bit on another machine to make sure it's not 
the machine am currently working with a form of performance lag, or 
something.

Alternatively, any thoughts on something simple could try using that would 
offer something similar in terms of just, at least being able to manipulate 
playback pitch, at least 2D panning, pausing/stopping on demand, etc.?

And, got hold of that sound_lib module from here:
http://hg.qwitter-client.net/sound_lib

TIA

Jacob Kruger
Blind Biker
Skype: BlindZA
'...fate had broken his body, but not his spirit...'

----- Original Message ----- 
From: "Tim Roberts" <timr at probo.com>
To: "Python-Win32 List" <python-win32 at python.org>
Sent: Wednesday, February 13, 2013 9:51 PM
Subject: Re: [python-win32] Python sound playback threading control?


> Jacob Kruger wrote:
>>
>> However, what it comes down to is to wanting to make it possible to
>> sort of
>> bypass something like current sound playback, or interrupt it, and
>> re-initiate the playback for the same object/sound file, etc
>
> It depends on what APIs you're using to play the sound.  Often, you're
> feeding the sound in buffer by buffer, so stopping the playback is just
> a matter of telling your own sound thread to stop sending buffers.
>
> If you're using some other higher-level API where you just deliver a WAV
> file, then you'll need to check out the facilities in that API.
>
> -- 
> Tim Roberts, timr at probo.com
> Providenza & Boekelheide, Inc.
>
> _______________________________________________
> python-win32 mailing list
> python-win32 at python.org
> http://mail.python.org/mailman/listinfo/python-win32
> 



More information about the python-win32 mailing list