https://github.com/nautrw/mtheorypy
I am trying to reinvent the wheel and make a library to programatically manipulate music. In the keys.py file, I have a dataclass for keys, which holds the number of sharps or flats. I also have a function to get the key signature of a key. How can I get the notes in a specific scale according to the key signature? (The file contains my failed attempt at implementing it)
#๐ Get a scale based on the number of sharps of flats
27 messages ยท Page 1 of 1 (latest)
@lusty current
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
Closes after a period of inactivity, or when you send !close.
can you explain it in a simpler way just using numbers and letters and such data for us that doesn't know music theory?
its easier to do arithmetic on them
bump
Dictionary with the scale as the key and notes as the value?
thats probably the way i should do it but
ive seen other libraries do it programatically
Would it not just be a case of working out each scale's procession in semitone values then mapping keys to offsets?
hm
Major, minor, harmonic, melodic, etc, then plus offset.
A sharp/flat is just a modifier, so you can make a scale using just the base note, a list of offsets for the scale type, and apply the sharps/flats.
but i still need the flats and sharps
if i bring down the c scale a step down i get bcdefgab but they are all natural
so how do i apply the sharps and flats
Like usual? Sharp = +1 half step, flat = -1
Apply the naming from the key sig.
how would i go about that
the key sig function just gives a list of numbers corresponding to notes
My music theory is very rusty. But if you have a given absolute note in a scale and it matches an accidental in the sig, you'd be able to have another mapping of absolute notes:names per key.
I don't think I'm explaining very well.
If you write out a dictionary mapping of keys to scale notes manually, you might start to be able to see patterns you can condense into algorithms.
ig
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.