Re: MP3 - VBR - Frame length in time

2004-12-11 Thread Florian Schulze
On Sat, 11 Dec 2004 20:32:30 +0100, Ivo Woltring <[EMAIL PROTECTED]> 
wrote:

mmpython will help but not always.
Lets put it this way. I will ALWAYS read through the whole file. In that
order I don't mind evaluating each frame. The thing I don't seem to be 
able
to find is the timelength-constants for frames for the different mp3
versions, bitrates and layers. Can anybody help me?
From http://www.oreilly.com/catalog/mp3/chapter/ch02.html#71109
"In addition, the number of samples stored in an MP3 frame is constant, at 
1,152 samples per frame."

So you only need the samplerate for each frame to calculate the duration 
of that frame.

1152 samples / 44100 samples per second ~ 0.026 seconds
I don't exactly know whether you need to include mono/stereo into the 
calculation, you would have to test that out.

Regards,
Florian Schulze
--
http://mail.python.org/mailman/listinfo/python-list


problem with newlines in regexp substitution

2006-02-23 Thread Florian Schulze
See the following results:

Python 2.3.5 (#62, Feb  8 2005, 16:23:02) [MSC v.1200 32 bit (Intel)] on 
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import re
>>> s = "1"
>>> re.sub('1','\\n',s)
'\n'
>>> '\\n'
'\\n'
>>> re.sub('1',r'\\n',s)
'\\n'
>>> s.replace('1','\\n')
'\\n'
>>> repl = '\\n'
>>> re.sub('1',repl,s)
'\n'
>>> s.replace('1',repl)
'\\n'

Why is the behaviour of the regexp substitution so weird and can I prevent 
that? It breaks my asumptions and thus my code.

Regards,
Florian Schulze

-- 
http://mail.python.org/mailman/listinfo/python-list