# Song Length Calculator

a guest
Feb 17th, 2013
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. # velocity in beats per minute
2. bpm = 108
3. # printing crap just for control
4. print "Your song has a velocity of ", bpm, "beats per minute."
5.
6. # beats per measure
7. measure = 4
8. print "at ", measure, "beats per measure"
9.
10. # how many different sections
11. section = 3
12. print "Your song has", section, "different sections."
13.
14. # how many measures long are different sections
15. section_length1 = 4
16. section_length2 = 16
17. section_length3 = 4
18.
19. # how often are sections played in total
20. rep1 = 1
21. rep2 = 4
22. rep3 = 3
23. print "The first part is ", section_length1, "measures long and played ", rep1, "times in total."
24. print "The second part is ", section_length2, "measures long and played ", rep2, "times in total."
25. print "The third part is ", section_length3, "measures long and played ", rep3, "times in total."
26.
27. # number of measures in total
28. measures_total = section_length1 * rep1 + section_length2 * rep2 + section_length3 * rep3
29. print "That is a total length of ", measures_total, "measures."
30.
31. # beats in total
32. beats_total = measures_total * measure
33. print "That is an impressive total of ", beats_total, "beats!"
34.
35. # length in minutes - divide beats in total by bpm
36. length = beats_total / bpm
37. seconds = beats_total % bpm * 60 / bpm
38. print "Your song is approximately ", length, "minutes and ", seconds, "seconds long."