This application is turned on for some experiment-purpose. The
application should be ready all the time during the experiment. The
user-input will be performed in arbitrary time (could be 5 minutes
after the previous input, 10 minutes after or even longer)
I have the following code for playing sound-feedback in this
application.
It's played when the image was clicked.
When it's played for the first time, it was delayed little bit
(approximately 0.5sec?)
So, I copied this code under the 'def __init__(self):' of wx.Frame. I
guessed it won't get delayed at all since it was played once when the
application started. It worked out.
But when it was played again after quite long interval (about 5 to 10
minutes), it was delayed again.
I made a little-application using wxPython.
..
----------------
AUDIO_FEEDBACK = "positive.wav"
AudioFeedback = wx.Sound(AUDIO_FEEDBACK)
AudioFeedback.Play(wx.SOUND_SYNC)
----------------
When it's played for the first time, it was delayed little bit
(approximately 0.5sec?)
So, I copied this code under the 'def __init__(self):' of wx.Frame. I
guessed it won't get delayed at all since it was played once when the
application started. It worked out.
But when it was played again after quite long interval (about 5 to 10
minutes), it was delayed again.
Is there any way to eliminate this delay?
If you listen closely, I'm sure you will be able to hear the disk
running during this gap. What's almost certainly happening here is that
the operating system has noticed that you haven't use that file, or the
sound modules, in quite a long time, so they got paged out to disk.
It's a difficult problem to solve. It is better for the overall
performance of the system for it to unload memory that is being tied up
but not used.
As an experiment, you might try recording a very short blank wave file,
and send that through the feedback every 30 seconds or so.
···
--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.
This application is turned on for some experiment-purpose. The
application should be ready all the time during the experiment. The
user-input will be performed in arbitrary time (could be 5 minutes
after the previous input, 10 minutes after or even longer)
I have the following code for playing sound-feedback in this
application.
It's played when the image was clicked.
----------------
AUDIO_FEEDBACK = "positive.wav"
AudioFeedback = wx.Sound(AUDIO_FEEDBACK)
Maybe the issue is that you are reloading the wav file from disk every time you play it. The above line should be executed only once.
···
On Mon, 11 Apr 2011 19:50:14 +0200, namush <namushh@hotmail.com> wrote:
When it's played for the first time, it was delayed little bit
(approximately 0.5sec?)
So, I copied this code under the 'def __init__(self):' of wx.Frame. I
guessed it won't get delayed at all since it was played once when the
application started. It worked out.
But when it was played again after quite long interval (about 5 to 10
minutes), it was delayed again.
If the platform is Linux (or other unix using wxGTK) then another possibility is that after a certain amount of time since the last sound the application has to reestablish a connection to the system's sound server before it can start playing the sound. IIRC then depending on the system's configuration this may even involve startting and running a separate executable in the background.
···
On 4/11/11 11:13 AM, Tim Roberts wrote:
namush wrote:
I made a little-application using wxPython.
..
----------------
AUDIO_FEEDBACK = "positive.wav"
AudioFeedback = wx.Sound(AUDIO_FEEDBACK)
AudioFeedback.Play(wx.SOUND_SYNC)
----------------
When it's played for the first time, it was delayed little bit
(approximately 0.5sec?)
So, I copied this code under the 'def __init__(self):' of wx.Frame. I
guessed it won't get delayed at all since it was played once when the
application started. It worked out.
But when it was played again after quite long interval (about 5 to 10
minutes), it was delayed again.
Is there any way to eliminate this delay?
If you listen closely, I'm sure you will be able to hear the disk
running during this gap. What's almost certainly happening here is that
the operating system has noticed that you haven't use that file, or the
sound modules, in quite a long time, so they got paged out to disk.