for_guitar.py 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. # TODO
  2. # make pygame version
  3. # make dsl version
  4. # make suckless sent powerpoint automation that displays 23 notes then 4 rests (at tempo 202), 3 notes then 1 rest (at tempo 8), etc...
  5. import time
  6. import os
  7. def clear():
  8. os.system("cls" if os.name == "nt" else "clear")
  9. def give_count_in():
  10. clear()
  11. counts = ["one", "two", "three", "four"]
  12. for countindex in counts:
  13. print(countindex + "!")
  14. time.sleep(1)
  15. clear()
  16. clear()
  17. def print_score(note, rest, guitar, bpm):
  18. clear()
  19. quarter = "\u2669"
  20. print(
  21. "play "
  22. + str(note)
  23. + " notes"
  24. + " then "
  25. + str(rest)
  26. + " rests at "
  27. + quarter
  28. + " = "
  29. + str(bpm)
  30. + " ("
  31. + guitar
  32. + ")"
  33. )
  34. def get_seconds_total_of_measure():
  35. "not implemented"
  36. pass
  37. def get_preview_of_upcoming_measure():
  38. "not implemented"
  39. pass
  40. def print_notes(counter, sleep):
  41. print(str(counter))
  42. time.sleep(sleep)
  43. def print_rests(rest, sleep):
  44. print("rest for " + str(rest) + " beats!")
  45. for rest in range(rest):
  46. print(str(rest + 1))
  47. time.sleep(sleep)
  48. def main(guitar, note, rest, bpm):
  49. clear()
  50. sleep = 60.0 / bpm
  51. counter = 0
  52. while True:
  53. counter += 1
  54. if counter == 1:
  55. print_score(note, rest, guitar, bpm)
  56. if counter <= note:
  57. print_notes(counter, sleep)
  58. elif counter > note:
  59. clear()
  60. print_rests(rest, sleep)
  61. clear()
  62. break
  63. # for guitar Erik Carlson
  64. give_count_in()
  65. main("G# third string", 23, 4, 202)
  66. main("F sixth string", 3, 1, 8)
  67. main("A# third string", 5, 15, 120)
  68. main("D open string", 6, 14, 75)
  69. main("F fourth string", 20, 8, 70)
  70. main("C fifth string", 16, 19, 45)
  71. main("C# second string", 8, 5, 65)
  72. main("C# fifth string", 1, 6, 209)
  73. main("G open string", 7, 2, 38)
  74. main("B open string", 15, 21, 54)
  75. main("G sixth string", 13, 13, 60)
  76. main("A third string", 12, 17, 41)
  77. print("second page\n")
  78. main("D# fourth string", 17, 23, 109)
  79. main("D second string", 14, 11, 250)
  80. main("C second string", 24, 24, 60)
  81. main("A# fifth string", 18, 3, 315)
  82. main("F# sixth string", 21, 20, 55)
  83. main("D# second string", 10, 22, 96)
  84. main("E open string", 22, 7, 58)
  85. main("B fifth string", 9, 12, 70)
  86. main("E fourth string", 4, 10, 23)
  87. main("F# fourth string", 19, 18, 58)
  88. main("A open string", 2, 9, 19)
  89. main("G# sixth string", 11, 16, 50)
  90. if __name__ == "__main__":
  91. main()