I have spent the last few days looking for ways to get the duration/length of an Ogg audio file using Python3.2.
It seems that all the tools to do this were created as far back as 2007, therefore they aren’t designed to support python3.2.
The tools/modules I have tried using are as follows:
Pymad
Mutagen
Audioread
Is there anything available which will give me ogg and wave audio duration/length for python3.2?
Thanks
-Helenclarko
HG1 got Pygame working (by changing dll’s)!
It works with Blender 2.59 and up to Blender 2.63.12 r48053M.
Only sound playback and duration were tested.
here is his packed version of Pygame along with an example blend file.
Just extract the zip file and start the blend file. http://www.mediafire.com/?wb3l42theyb210d
the dirty way:
load sound into blender as sequencer strip, determine the strip length and calculate duration based on FPS settings. Not sure if this really works though
bpy.data.screens[‘Video Editing’].scene.sequence_editor.active_strip.frame_final_duration
or get some file format specs and write your own header parser to calculate the length
I am guessing there is no easy way to get the duration of a sound file using python3.2.
batFINGER, your solution would probably work. However it looks as though it will be loading the sound clips into a speaker before it can get the duration from it… is that right?
like BatFinger is using wav-codec with “fixed compression” - you may have the possibility to use a conversion of the sound-file to another codec.
In linux with “sox” (is it available for windows?) its easy to convert from one sound-codec to another:
sox input.mp3 output.wav
and there are options to specify codecs not automatically identified.
HG1 got Pygame working (by changing dll’s)!
It works with Blender 2.59 and up to Blender 2.63.12 r48053M.
Only sound playback and duration were tested.
here is his packed version of Pygame along with an example blend file.
Just extract the zip file and start the blend file.