-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
parameters/Duration: Refactor inner repr to float instead of fraction
In d9a861c the explicit duration type was introduced. This commit also changed the internal representation of durations from floats to fractions. The main reason for this change was to avoid floating point errors when comparing two different durations (and because in music it's more 'clean' to think of ratios than of floats). Unfortunately this change had some serious problems: it made the performance of the system very bad as calculating with fractions is much slower than calculating with floats. Due to this very often the durations were internally converted to floats before making calculations with them (see for instance fc49bb7). Due to these problems it became clear that it's wiser to use float as a durations value type. The floating point errors are mostly solved by rounding the numbers. This change can only be done now in version 2.0.0, because it breaks backwards compatibility. It has some additional implications: - the 'Duration.duration_in_floats' attribute is dropped, as 'Duration.duration' is already always in floats - a new class 'RatioDuration' was introduced which uses a fraction for internal duration representation. This class is used if the user passes a ratio string to the duration parser (e.g. something like '3/2' or '4/1' is parsed to 'RatioDuration')
- Loading branch information
1 parent
0f4f792
commit 90b0a3f
Showing
13 changed files
with
203 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.