Use the absolute of the rate when calculating sample_duration.

Fixes #72