Author gpk
Recipients
Date 2006-06-26.15:16:36
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
In wave.py, a floating point frame rate is truncated
(rather than rounded) in function _write_header().

Fractional frame rates are perfectly reasonable,
even if not normally seen in audio practice,
and the software ought to represent them as accurately
as possible.

Moreover, it's sometimes reasonable to store the
inverse of the frame rate, which is the time
interval between frames.   That's important
when you're doing signal processing, and some
data formats store 1.0/framerate rather than
framerate.

Anyhow, if you give setframerate() a float,
it truncates rather than rounding, so
dt = 1.0/44100
setframerate(1.0/dt)  can end up setting
the frame rate to 44099 Hz in the resulting
data file.

The fix is to change the last line of setframerate() to
self._framerate = int(round(framerate))
.
That also has the beneficial side-effect of giving
an earlier error report in case someone gives
the wrong type of object to setframerate()
(such as None, or "44100", or some class).
History
Date User Action Args
2008-01-20 09:58:45adminlinkissue1512791 messages
2008-01-20 09:58:45admincreate