Play sound from a specific time

Hello. Can I play a .wav sound from for example the fifth second using wx.Sound? I tried to read the raw data with f.seek(…), calculating the position based on bit rate, channels etc. but it doesn’t work if I’m trying to play it (because I think of missing header of the .wav). If anyone have a sample of a program that does that it will be very helpful, thank you.

Vladislav Cebotari wrote:

Hello. Can I play a .wav sound from for example the fifth second using
wx.Sound? I tried to read the raw data with f.seek(..), calculating
the position based on bit rate, channels etc. but it doesn't work if
I'm trying to play it (because I think of missing header of the .wav).

No, the wx.Sound class is extremely basic -- all or nothing.

There are a large number of very good sound packages for Python,
including PyMedia, sound4python, pyglet and pygame.

···

--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

I used pymedia to decode mp3 files into raw data for drawing the waveform, but it doesn’t play the sound very good in async mode (well it lags for about 5 seconds playing in sync and then it goes playing nicely in the background). I’ll give a try maybe to pygame since I have worked in it some time ago.
Thank You.

wx.MediaCtrl works for me on Win7 (though the demo is weird and I had to hack it a bit, initially it told me it was unsupported, but I think the demo was just poorly crafted as it most definitely works!)

···

On Thursday, August 28, 2014 11:56:12 AM UTC-7, Vladislav Cebotari wrote:

I used pymedia to decode mp3 files into raw data for drawing the waveform, but it doesn’t play the sound very good in async mode (well it lags for about 5 seconds playing in sync and then it goes playing nicely in the background). I’ll give a try maybe to pygame since I have worked in it some time ago.
Thank You.