- Description has changed:

Diff:

~~~~

--- old
+++ new
@@ -9,37 +9,18 @@
 
 r2. e4*1/4 r4*1/4 e4*1/2 r2. e4*1/4 r4*1/4 e4*1/2 r2. e4*1/4
 
-I have written a patch to fix this. Inside of the class Duration (line
-129), replace the dump function with:
+I have written a patch to fix this. 
 
----
+--
+Fixes to midi2ly.py: better note lengths, now supports meter changes
 
-    def dump (self):
-        den = self.den; num = self.num;
-        # code below by C C Heckman
-        # looks for a neighboring fraction that reduces
-        if num > 1:
-            gcd1 = gcd (num - 1, den)
-            gcd2 = gcd (num, den)
-            gcd3 = gcd (num + 1, den)
-            if gcd1 > gcd2 and gcd1 > gcd3:
-                d = -1; g = gcd1
-            elif gcd3 > gcd2 and gcd3 > gcd1:
-                d = +1; g = gcd3
-            else:
-                d = 0; g = gcd2
-                # for now, do nothing
-            num = (num + d) / g
-            den = den / g
-        if den == 1:
-            if num == 1:
-                s = '%d' % self.dur
-            elif num == 3 and self.dur != 1:
-                s = '%d.' % (self.dur / 2)
-            else:
-                s = '%d*%d' % (self.dur, num)
-        else:
-            s = '%d*%d/%d' % (self.dur, num, den)
-        # end modified code
+(1) Note lengths currently are fractions like 61/120. If the numerator
+can be changed by 1 to get a better fraction, it is done. Quarter
+notes are also replaced with eighths/sixteenths if appropriate.
+For example: a duration of 461/120 is changed to 41/2 and then
+to 8. (2) Current version of midi2ly does not support meter changes.
+Patch does.
 
------
+Resolves: #5119
+
+http://codereview.appspot.com/325800043

~~~~

- **assigned_to**: pkx166h
- **Needs**:  -->  
- **Type**:  --> Enhancement



---

** [issues:#5119] MIDI2Ly fraction reduction**

**Status:** Started
**Created:** Sun Apr 16, 2017 02:32 PM UTC by Colin Campbell
**Last Updated:** Sat May 27, 2017 08:21 AM UTC
**Owner:** pkx166h


Submitted by Christopher Heckman:

When midi2ly is run, it will print fractions with large numerators
and denominators, like

r4*361/120 e4*29/120 r4*31/120 e4*59/120 r4*361/120 e4*29/120

when the actual durations are more likely to be

r2. e4*1/4 r4*1/4 e4*1/2 r2. e4*1/4 r4*1/4 e4*1/2 r2. e4*1/4

I have written a patch to fix this. 

--
Fixes to midi2ly.py: better note lengths, now supports meter changes

(1) Note lengths currently are fractions like 61/120. If the numerator
can be changed by 1 to get a better fraction, it is done. Quarter
notes are also replaced with eighths/sixteenths if appropriate.
For example: a duration of 461/120 is changed to 41/2 and then
to 8. (2) Current version of midi2ly does not support meter changes.
Patch does.

Resolves: #5119

http://codereview.appspot.com/325800043


---

Sent from sourceforge.net because [email protected] is 
subscribed to https://sourceforge.net/p/testlilyissues/issues/

To unsubscribe from further messages, a project admin can change settings at 
https://sourceforge.net/p/testlilyissues/admin/issues/options.  Or, if this is 
a mailing list, you can unsubscribe from the mailing list.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Testlilyissues-auto mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/testlilyissues-auto

Reply via email to