drsounds / mingus

Automatically exported from code.google.com/p/mingus
GNU General Public License v3.0
0 stars 0 forks source link

Lilypond output is wrong with most float length values #37

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

from mingus.containers.Bar import Bar
from mingus.containers.Note import Note
from mingus.extra import LilyPond
import mingus.core.value as value
b = Bar()
b.place_notes(Note().from_int(50), 16)
b.place_notes(Note().from_int(50), 16.0)
print value.dots(16)
b.place_notes(Note().from_int(50), value.dots(16))
print LilyPond.from_Bar(b)

What is the expected output? What do you see instead?

output:
10.6666666667
{ \time 4/4 \key c \major d'16 d'16.0 d'16. }

what i would expect:
10.6666666667
{ \time 4/4 \key c \major d'16 d'16 d'16. }

What version of the product are you using? On what operating system?
3.9.0.1 ubuntu 64bit

Please provide any additional information below.

if you set 10.6666667 as length the lilypond output is 16+ a point (1/16 +
1/32 length thats right) but the lilypond string dont supports 16.0 as length.

part solution would be: if you hit no exact length with points -> round to
a full int value

perfekt solution would be: rounding to point values 16... as example if
input would be 10.5 its closer to 10.66666667 as to 10 or 11.

Original issue reported on code.google.com by s.huchler@gmail.com on 1 Mar 2009 at 10:05

GoogleCodeExporter commented 9 years ago
Hi, Stefan. Thanks for finding and reporting these bugs. I just pushed in the 
fix for
this. The problem was that the values returned from value.determine were 
converted to
string directly, while some of them have to be converted to int first while 
0.25 and
0.5 need to be converted to \longa and \breve. That's why you got '16.0' (a 
float
converted to string) instead of '16'.

The value.determine function is pretty good and matches on ranges instead of 
exact
numbers to minimize rounding and floating point errors (the 10.5 from your 
example
already gets parsed as a dotted 16 note).

Original comment by Rhijnauwen@gmail.com on 2 Mar 2009 at 6:01