MCPcopy Create free account
hub / github.com/bspaans/python-mingus / from_Track

Function from_Track

mingus/extra/lilypond.py:173–195  ·  view source on GitHub ↗

Process a Track object and return the LilyPond equivalent in a string.

(track)

Source from the content-addressed store, hash-verified

171
172
173def from_Track(track):
174 """Process a Track object and return the LilyPond equivalent in a string."""
175 # Throw exception
176 if not hasattr(track, "bars"):
177 return False
178 lastkey = Key("C")
179 lasttime = (4, 4)
180
181 # Handle the Bars:
182 result = ""
183 for bar in track.bars:
184 if lastkey != bar.key:
185 showkey = True
186 else:
187 showkey = False
188 if lasttime != bar.meter:
189 showtime = True
190 else:
191 showtime = False
192 result += from_Bar(bar, showkey, showtime) + " "
193 lastkey = bar.key
194 lasttime = bar.meter
195 return "{ %s}" % result
196
197
198def from_Composition(composition):

Callers 1

from_CompositionFunction · 0.70

Calls 2

KeyClass · 0.90
from_BarFunction · 0.70

Tested by

no test coverage detected