test.py 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. # plays inputed higher by a value. By now only works upwards (positiv values) and can
  2. # cause weird notation like G#- with F- and 2
  3. def sequenz(input_list, value):
  4. notes_list = ['C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'A#', 'B']
  5. working_list = []
  6. for n in input_list:
  7. note = n[:4]
  8. pitch = n[4:5]
  9. ord_number = notes_list.index(pitch)
  10. octave = int(n[-1:])
  11. ord_number += value
  12. while ord_number >= 12:
  13. octave += 1
  14. ord_number = ord_number - 12
  15. if n[5:6] == '#':
  16. note = note + notes_list[ord_number] + '#' + str(octave)
  17. working_list.append(note)
  18. elif n[5:6] == '-':
  19. note = note + notes_list[ord_number] + '-' + str(octave)
  20. working_list.append(note)
  21. else:
  22. note = note + notes_list[ord_number] + str(octave)
  23. working_list.append(note)
  24. return working_list
  25. # work in progress ...
  26. def convert_multiple_key_signetures(note):
  27. notes_list = ['C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'A#', 'B']
  28. while len(note) > 7:
  29. if note[5:7] == "##":
  30. note[4:5]
  31. if note[5:7] == "--":
  32. if note[5:7] == "-#" or note[4:6] == "#-":
  33. note = note[:5] + note[7:]
  34. return note
  35. l = ['1.00D#5', '0.25F-4', '0.50C5']
  36. print (l)
  37. print(sequenz(l, 3))