Question: Using Python 3 The set of musical notes is A, A#/Bb, B, C, C#/Db, D, D#/Eb, E, F, F#/Gb, G, G#/Ab. All notes start with

Using Python 3

The set of musical notes is A, A#/Bb, B, C, C#/Db, D, D#/Eb, E, F, F#/Gb, G, G#/Ab. All notes start with a letter and may be followed by either # (sharp) or b (flat). A# and Bb are two names for the same note. The distance between two consecutive notes is a half-step. A sequence of 12 half-steps is called an octave. As you can see in the picture, if you move a full octave, you will return to the same note but at a higher or lower pitch. A chromatic scale includes all the notes in an octave, either with sharps or flats but not both. So A A# B C C# D D# E F F# G G# is a sharp chromatic scale and A Bb B C Db D Eb E F Gb G Ab is a flat chromatic scale. A piece of music is written in a specific key (a set of notes in a scale). However, a musician may wish to transpose the piece to a different key by uniformly raising or lowering its notes. This is done to either change its pitch or to convert to a set of notes that is more easily played. As an example, the sequence C D E could be transposed down 3 half-steps to become A B C# or A B Db. Similarly, it could be transposed up by 1 half-step to become C# D# F or Db Eb F. A chord is a group of notes played together. Its lowest note is called its root. The name of a chord is derived from its root note, for example, F#.

The purpose of this assignment is to write a program that will take a set of chords, allow the user to indicate how many half-steps to transpose and display the resulting chords. Divide the program into three functions:

a main

1.Declare a string that that represents a set of chords (just the roots at this point)

2.Get input for the number of half-steps

3. Display the the transposed chords

a function with one parameter, a string of chords.

4. Return a list of chords from the given string. (In this assignment, the function is only one or two lines, but will be expanded in the future.)

a transpose function with two parameters, a string of chords, and the number of half-steps.

6.Determine whether the original chords use either a sharp or flat scale and make the corresponding chromatic scale.

5.Construct the set of transposed chords.

7.Return a string of transposed chords. Use string and list methods and operations in your solution.

Examples: transposing "Eb D C F Bb G" 1 half-step down (-1) should produce the string, "D Db B E A Gb"; transposing "D# D C F A# G" 11 half-steps up (+11) should produce the string, "D C# B E A F#"

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!