(Solved) : Standard Piano 88 Keys Repeat Pattern Notes Travel Right Notes Get Higher Get Lower Trave Q42740718 . . .

python

We were unable to transcribe this imageA standard piano has 88 keys that just repeat this pattern of notes over and over again. As you travel to the right the notes get higher, and they get lower as your travel to the left. The notes that are in higher octaves sound higher pitched, and the lower octaves sound lower pitched. You will use a combination of the note’s letter and the octave it is played in to accurately describe an individual key on the piano. Octave 5 Оctave 4 Octave 3 F G A CN D DN F G A DR Fi G A cD E F G A B CDEF GLA B CDEFAB in a song, this would be FW3 this is A4 this would be G5 Notice how the notes themselves are repeated several times. A standard piano has 7 full octaves (1 through 7), but the first key will actually start at A0, and the last key will be C8. Octaves 0 and 8 on the piano are there incomplete, the will only have the notes A0, A#0, B0, and C8. By pressing any of the keys on the piano, you are causing a small hammer to hit a string that will vibrate at a particular frequency. A note is octave 5 will have twice the frequency of the same note in octave 4, which is why the octave 5 note sounds higher pitched. You can compute the frequencies for each note by implementing the following formula: En=Fox 2″/12 Fo is the frequency of base note, in other words the note that you are using to tune all of the other notes. It is standard to tune your piano so that the note A4 is exactly 440HZ, but the function you write to generate the frequencies of the notes will use any arbitrary starting frequency n is the number of half steps you are away from the base note (A4): n>0 means you are on a note above the base note o A#4 is one half step above A4, so n 1 o B4 is two half steps above A4, so n 2 o AS is twelve half steps above A4, so n 12 n<0 means you are on a note below the base note o F#3 is one half step below A4, so n-1 o F3 is one half step below A4, so n -2 o A3 is twelve half steps below A4, so n-12 Note Types There are few different speeds at which a note can be played in a piece of music. We generally think of this in terms of ‘beats’ rather than seconds or minutes. A song will describe its overall tempo in beats per minute (BPM) where a higher BPM means a faster song. When reading music, the notes are organized in “measures.” The composer of the song would tell you how many beats should be in one measure. We will assume that all music used in this project uses 4 beats per measure. This makes computing the speeds easier We have five different note types in this project. The name of the note type indicates how much of one measure that note should occupy: “Quarter” notes take up a quarter of the measure, so for us that is exactly 1 beat “Half” notes take up half of the measure, that would mean they last for 2 beats in our songs “Whole” notes take up the entire measure, so they require 4 beats to play correctly “Eighth” notes take up an eighth of the measure, so that would be half of one beat “Sixteenth” notes take up a sixteenth of a measure, so that would be a quarter of one beat Song Files Files that contain songs in this project are denoted by the extension song”, and are organized like this SongTempoInBPM BaseNoteFrequency NoteletterAndoctave, NoteType NoteLetterAndoctave, NoteType The first line of the file is the song’s tempo expressed in beats per minute. The second line of the file is frequency of the base note used to tune the rest of the notes. The rest of the lines contain the notes in the order that they should be played for a particular song. They are comma separated, where the first item is the note’s letter on the piano and octave that is should be played in. You can open up these files in Restrictions There is exactly one import statement allowed in this project: import random o You are not allowed to import anything else. You are not allowed to use classes, exceptions, the with statement, and list/dictionary comprehensions From the built-in functions, you are allowed to use: range (), len(), sorted(), int(), sun) From list methods, you are allowed to use: append(),insert ), copy(), remove), pop(),index) From the dictionary methods, you are allowed to use get),values ), keys (),items ), update () For the file methods, you are allowed to use open(), read(), readline You may not make more than one pass of a file when reading it. Do nat circumvent this rule by reading in the file as one entity (one string, a list, etc.), and then performing multiple passes on that. Questions on Piazza like “Can I use [thing not listed above]?” will not be answered by an instructor. Assumptions You may assume that: The types of the function arguments are the proper ones, you don’t have to validate them G#8″ : 1328s9.758322558239 find note(filename, highest or lowest) Description: Determine the highest or the lowest note found in the song. You can assume that all notes in the song will be ones found on an 88 key piano. Parameters: filenane (string) the name of the file containing the song, highest or lowest (Booklean) is a flag that controls whether you are finding the lowest or the highest note. Beturn value: a string: the highest noate in the song if highest or_lowest is set to True, the lowest nate if it is set to False “test.song Example 90 440 find note(“test.song”, True) find note(“test.song, False) “B5” -> A4,Quarter B5, Half C2,Quarter D#2,Whole “C2” 5 Show transcribed image text
A standard piano has 88 keys that just repeat this pattern of notes over and over again. As you travel to the right the notes get higher, and they get lower as your travel to the left. The notes that are in higher octaves sound higher pitched, and the lower octaves sound lower pitched. You will use a combination of the note’s letter and the octave it is played in to accurately describe an individual key on the piano. Octave 5 Оctave 4 Octave 3 F G A CN D DN F G A DR Fi G A cD E F G A B CDEF GLA B CDEFAB in a song, this would be FW3 this is A4 this would be G5 Notice how the notes themselves are repeated several times. A standard piano has 7 full octaves (1 through 7), but the first key will actually start at A0, and the last key will be C8. Octaves 0 and 8 on the piano are there incomplete, the will only have the notes A0, A#0, B0, and C8. By pressing any of the keys on the piano, you are causing a small hammer to hit a string that will vibrate at a particular frequency. A note is octave 5 will have twice the frequency of the same note in octave 4, which is why the octave 5 note sounds higher pitched. You can compute the frequencies for each note by implementing the following formula: En=Fox 2″/12 Fo is the frequency of base note, in other words the note that you are using to tune all of the other notes. It is standard to tune your piano so that the note A4 is exactly 440HZ, but the function you write to generate the frequencies of the notes will use any arbitrary starting frequency n is the number of half steps you are away from the base note (A4): n>0 means you are on a note above the base note o A#4 is one half step above A4, so n 1 o B4 is two half steps above A4, so n 2 o AS is twelve half steps above A4, so n 12 n A4,Quarter B5, Half C2,Quarter D#2,Whole “C2” 5

Answer to A standard piano has 88 keys that just repeat this pattern of notes over and over again. As you travel to the right the …