Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Random music scale generator
-
Looking to create a database that retrieves scales for guitar practice. At the moment, I just want it to list a major or minor scale when you answer the question: “Major or minor scale?”
I’m a noob, trying to take some class examples and make them into what I’d like to work on.import random class scale: def __init__(self,minor=False, major=True, **kwargs): for key,value in kwargs.items(): setattr(self,key,value) class Ionian(scale): def __init__(self): data = { "value": 'major' } super().__init__(**data) class Dorian(scale): def __init__(self): data = { "value": 'minor' } super().__init__(**data) class Phrygian(scale): def __init__(self): data = { "value": 'minor' } super().__init__(**data) class Lydian(scale): def __init__(self): data = { "value": 'major' } super().__init__(**data) class Mixolydian(scale): def __init__(self): data = { "value": 'major' } super().__init__(**data) class Aeolian(scale): def __init__(self): data = { "value":'minor' } super().__init__(**data) class Locrian(scale): def __init__(self): data = { "value": 'minor' } super().__init__(**data) scales = [Ionian(), Dorian(), Phrygian(), Lydian(), Mixolydian(), Aeolian(), Locrian()] for scale in scales: arguments = [scale,scale.value] string = "{}: - value:{}".format(*arguments) while True: choice = input("Major or Minor scale?: ").strip().title() if choice in scale: mode = int(input("Do you like a particular mode?").strip())
-
The second last line is a problem... Two solutions to try...
- Change
scale
toscales
(plural). - Change
scale
to('Major', 'Minor')
.
I think the second is what you really intended.
- Change
-
@ccc thanks, that cleared up one of the errors I was getting through experimenting.
Craig