Questionhi. I got stuck to understand the question. this one is really…hi. I got stuck to understand the question. this one is really hard, i have just few hours to submit it. can someone help me to solve 2 problems? the professor gave me hints but I still don’t understand. I will try my best in the next project, but right now, i am so crazy with this one. in the first problem , we allow to useimport stdarray, stdrandom, stdio. in the second one is import stdaudio, stdio, sys. Goal The purpose of this project is to write a program to generate a two-part waltz by pasting together 32 of 272 pre- composed musical elements at random, and another program to play a waltz. In 1787, Wolfgang Amadeus Mozart created a dice game (Mozart’s Musikalisches Warfelspiel). In the game, you compose a two part waltz by pasting together 32 of 272 pre-composed musical elements at random. The Waltz The waltz consists of two parts – the minuet and the trio. Each is comprised of 16 measures, which are generated at random according to a fixed set of rules, as described below. . Minuet The minuet consists of 16 measures. There are 176 possible minuet measures, named m.www through mrs.was in the ana directory, To determine which one to play, roll two fair dice, and use the following table: 19 11 12 14 10 141 41 105 140 11 81 TO 117 121 112 124 161 100 148 T4 143 45 25 143 104 101 152 171 53 95 ST 43 140 127 16 43 94 120 155 10 14 143 TS 147 186 33 103 149 144 173 134 18 103 131 For example, if you roll a 4 and 6 for measure 8, then play measure 123 (ie, date/2.www). . Trio The trio also consists of 16 measures. There are $6 possible trio measures named To.www through to.www in the arts directory. To determine which one to play, roll one fair die, and use the following table: 30 31 23 23 34 35 36 3 27 21 39 30 31 32 74 26 71 30 64 84 35 47 40 For example, if you roll a 4 for measure 29, then play measure 57 (ie, dats/757.v.). and trio tables. Data The 272 measures are available as .var files in the dan directory. The file assemsmart. in contains the values of the minuet Composition The file assessors,www is a sample waltz generated using the process described above. There are 11 15 x 615 different possible results, some of which are more likely than others. Since this is over 10 different possibilities, each time you play the game you are likely to compose a piece of music that has never been heard before! Mozart carefully constructed the measures to obey a rigid harmonic structure, so each waltz reflects Mozart’s distinct style. Unfortunately, due to the rigidity, the process never results in anything truly extraordinary. Problem 1. (Generating the Walls) Write a program gamestessie py that reads the mimiset and trio tables from standard input, generates a random sequence of 32 measures according to the rules described above, and writes the sequence to standard output. 1 of 2 C$110 Project 3 (Mozart Waltz Generator) Swami Iver python] generatewaltz , py < data/mozart , tas 40 96 27 194 195 129 21 24 46 156 48 34 43 18 89 78 72 39 50 08 29 7 15 94 76 34 93 27 12 95 47 10 Problem 2. (Playing the Walls) Write a program playasisa.py that reads from standard input, a sequence of 32 integers representing the 32 measures of a waltz, and plays the waltz to standard audio. Before playing any audio, your program must check if the inputs are correct, and if they are not, must call sys.exittomanage) to exit the program with an appropriate "ITor message, The following errors must be handled: . If the number of measures is not $2, exit with the message "A waltz must contain exactly 32 measures" . If a minuet measure is not from [1, 176), exit with the message "A minuet measure must be from [1, 176]". . If a trio measure is not from (1,96), exit with the message "A trio measure must be from [1, 96]". * pytbend generatewaltz.py < data/mozart. as I pythons playwaits. py Acknowledgements This project is an adaptation of the Mozart Waltz Generator assignment developed at Princeton University by David Costanzo and Kevin Wayne.Show less and trio tables. Composition The file asta/mozart.vav is a sample waltz generated using the process described above. There are 11 10 x 610 different possible results, some of which are more likely than others. Since this is over 10" different possibilities, each time you play the game you are likely to compose a piece of music that has never been heard before! Mozart carefully constructed the measures to obey a rigid harmonic structure, so each waltz reflects Mozart’s distinct style. Unfortunately, due to the rigidity, the process never results in anything truly extraordinary. Problem 1. (Generating the Waltz) Write a program generatewaltz.py that reads the minuet and trio tables from standard input, generates a random sequence of 32 measures according to the rules described above, and writes the sequence to standard output. 1 of 2 C8110 Project 3 (Mozart Waltz Generator) Swami Iyer "/workspace/projecta * pythons generatewaltz . py < data/mozart. txt 69 95 27 103 105 129 21 24 66 165 48 34 43 18 89 78 72 39 59 68 29 7 25 94 76 34 93 77 12 95 47 10 Problem 2. (Playing the Waltz) Write a program playsaltz.py that reads from standard input, a sequence of 32 integers representing the 32 measures of a waltz, and plays the waltz to standard audio, Before playing any audio, your program must check if the inputs are correct, and if they are not, must call sys. exit (message) to exit the program with an appropriate error message. The following errors must be handled: . If the number of measures is not 32, exit with the message "A waltz must contain exactly 32 measures". . If a minuet measure is not from [1, 176], exit with the message "A minuet measure must be from [1, 176]". . If a trio measure is not from [1,96), exit with the message "A trio measure must be from [1. 96 ". "/workspace/project] * python3 generatewaltz .py < data/mozart txt | python3 playwaltz.py Acknowledgements This project is an adaptation of the Mozart Waltz Generator assignment developed at Princeton University by David Costanzo and Kevin Wayne.Show less Problem 1. (Generating the Waltz) Write a program generatemitz.py that reads the minuet and trio tables from standard input, generates a random sequence of 32 measures according to the rules described in the project writeup, and writes the sequence to standard output. Hints: Read the minuet measures from standard input into 2D list of dimension 11 x 16 Read the trio measures from standard input into a 2D list of dimension 6 x 16 Write to standard output a random sequence of 16 minuet measures, each of which is a value from the minuet table – the column index j is a value from [0, 15] and the row index i E [0. 10] is obtained from the sum of two die rolls Write to standard output a random sequence of 16 trio measures, each of which is a value from the trio table – the column index j is a value from [0, 15] and the row index i ( [0. 5] is obtained from a die roll Problems Problem 2. (Playing the Waltz) Write a program playwaltz.py that reads from standard input, a sequence of 32 integers representing the 32 measures of a waltz, and plays the waltz to standard audio. Hints: Read the waltz measures from standard input into a 1D list Handle the input errors described in the project writeup Play each of the first 16 minuet measures by calling stemsdis. playfile(filesuse) – if the measure is 123, the value of filmme is santana" Play each of the last 16 trio measures by calling axeratio.playFile(filmname) – if the measure is 57, the value of filename is "dats/TST" Problems The au directory contains: " The 272 measures as .was files The values of the minuet and trio tables in sexart. tot A sample waltz smart.ww generated using the process described in the project writeup Problems Goal The purpose of this project is towrite a program to generate a two-part waltzby pasting together 32 of 272 pre… Show more… Show more . The 272 measures as .wav files. . The values of the minuetand trio tables in mozart. txt. . A sample waltz mozart.waygenerated using the process described above… Show more… Show moreComputer ScienceEngineering & TechnologyPython Programming CS 110

Order your essay today and save 20% with the discount code ESSAYHELP