+ 5

Question for Python3 (music)

Create a program in Python that does the following. I need to give a name to a string. ex. Major (a,b,c,d,e,f,g) and assign this to different values. a=A, b=Bm, c=Cm, d=D, e=Em, f=F, g=G Then I need to print the results. Then I may want to do another similar example like ex. Dorian (a,b,c,d,e,f,g) a=A, b=B, c=cm, d=Dmb5, e=E, f=Fm, g=Gm What would be the best way to approach this? I need to create atleast 7 examples like this (it is for a music project).

7th Jun 2018, 10:00 PM
Dave
Dave - avatar
4 Respuestas
+ 6
I will try to not be too confusing lol. We have 7 scales. "Major, Dorian, Phrygian, Lydian, Mixolydian, Aeolian & Locrian Those 7 scales have a specific set of notes and chord extensions they follow a pattern. A capital letter alone will represent a "Major chord" A capital letter with a lowercase "m" represents a Minor Chord So I need to assign the patterns for each scale. Here's what they would look like. C Major: C, Dm, Em, F, G, Am, Bm D Dorian: Dm, Em, F, G, Am, Bm, C E Phrygian: Em, F, G, Am, Bm, C, Dm F Lydian: F, G, Am, Bm, C, Dm, Em G Mixolydian: G, Am, Bm, C, Dm, Em, F A Aeolian: Am, Bm, C, Dm, Em, F, G B Locrian: Bm, C, Dm, Em, F, G, Am, Now if I selected note "A" I would like it to output our 6th line A Aeolian: Am, Bm, C, Dm, Em, F, G If we selected the note "C" it would output our first line "Major" and so on. Recapping: we have our 1st scale C Major C, D, E, F, G, A, B By selecting a note from C,D,E,F,G,A,B (or be viewed as 1,2,3,4,5,6,7) it will output the corresponding scale and its chord types. If a "D" or "2" is input we want it to output D Dorian: Dm, Em, F, G, Am, Bm, C. I need this to work on 7 letters/numbers. Thank you
8th Jun 2018, 2:09 AM
Dave
Dave - avatar
+ 2
then it will be so simple.....just make a dictionary and output the value with respect to the key which is your input
8th Jun 2018, 6:51 AM
Hemu@coder
+ 1
can you give some more inputs and outputs
8th Jun 2018, 1:13 AM
Hemu@coder
+ 1
Use dictionary in python. The declaration of it is like this : major = {"a":"A", "b":"Bm" } You can continue putting values. Sorry for not going in details here, and I hope it's good enough hint.
3rd Nov 2019, 2:07 AM
Anonymous
Anonymous - avatar