Guest User

Untitled

a guest
Jun 26th, 2022
22
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.37 KB | None | 0 0
  1. import math
  2.  
  3. from neoscore.core import neoscore
  4. from neoscore.core.flowable import Flowable
  5. from neoscore.core.units import ZERO, Mm
  6. from neoscore.western.clef import Clef
  7. from neoscore.western.duration import Duration
  8. from neoscore.western.key_signature import KeySignature
  9. from neoscore.western.notehead import Notehead
  10. from neoscore.western.staff import Staff
  11. import time as time_
  12.  
  13. from pympler import muppy, summary
  14.  
  15. neoscore.setup()
  16.  
  17. flowable = Flowable((Mm(0), Mm(0)), None, Mm(500), Mm(30), Mm(10))
  18.  
  19. staff = Staff((Mm(0), Mm(0)), flowable, Mm(500))
  20. unit = staff.unit
  21. clef = Clef(ZERO, staff, "treble")
  22. KeySignature(ZERO, staff, "g_major")
  23.  
  24. center = unit(15)
  25.  
  26. n1 = Notehead(center, staff, "g", Duration(1, 4))
  27. n2 = Notehead(center, staff, "b", Duration(1, 4))
  28. n3 = Notehead(center, staff, "d'", Duration(1, 4))
  29. n4 = Notehead(center, staff, "f'", Duration(1, 4))
  30.  
  31. start_time = time_.time()
  32.  
  33. def refresh_func(time):
  34.     if time - start_time > 10:
  35.         all_objects = muppy.get_objects()
  36.         sum1 = summary.summarize(all_objects)
  37.         summary.print_(sum1)
  38.         quit()
  39.     n1.x = center + Mm(math.sin((time / 2)) * 10)
  40.     n2.x = center + Mm(math.sin((time / 2) + 1) * 12)
  41.     n3.x = center + Mm(math.sin((time / 2) + 1.7) * 7)
  42.     n4.x = center + Mm(math.sin((time / 2) + 2.3) * 15)
  43.  
  44.  
  45. if __name__ == "__main__":
  46.     neoscore.show(refresh_func)
  47.  
Advertisement
Add Comment
Please, Sign In to add comment