sky-music / sky-python-music-sheet-maker

Make visual music sheets for thatskygame (graphical representations of the Sky keyboard)
MIT License
29 stars 10 forks source link

We cannot play in other keys than C #9

Closed jmmelko closed 4 years ago

jmmelko commented 5 years ago

The musical key changes in some places of Sky’s world. That would be cool to render visual sheets in other keys than the standard one (C).

As agreed with Tracey she will do it, in her own time (that’s a feature request not a real issue).

tracey-le commented 5 years ago

Ok I had a think about this over the past few days-

I needed time to weigh between:

  1. only allowing two octaves in each major scale, which means ignoring all accidentals and ignoring all notes higher or lower than those two octaves e.g.
E major selected.
The following notes are allowed: 
(E4, F#4, G#4, A4, B4, C#5, D#5, E5, F#5, G#5, A5, B5, C#6, D#6, E6)
Other notes will be ignored/produce an error icon.
Type line:

(octave shift would be allowed)

  1. OR, provide some automation for the user, in translating from a music language with 88 chromatic notes (not all 88, but a portion of) to a selection of 12 possible major scales each with two octaves (15 notes)

For the second option:

List of possible keys:
D major (Matches: 45)
A major (Matches: 30)
G major (Matches: 23)

# maybe only top 3 matches
C major (Matches: 20)
...

maybe notes lower than the lowest allowed note can be shifted up an octave until it is in range (provided it doesn’t pass the highest note). and we can decide a bit later if this behaviour can be opted out (I think yes), and how to handle accidentals (print icon error, or automatically shift them one note up or down – based on if the phrase is going up or down at that point, or if shifting would make a repeated note next to it). [<- really not sure about these ideas in this paragraph yet, basically on handling cases that usually are handled by human judgment]

This is sort of based on how I transcribe other songs into Sky

I guess I just wanted to think a bit more about the behaviour/design, and draft some algorithms for these, before going into implementation (which jmmelko shared ideas with me in the other issue!)

tracey-le commented 5 years ago

Here is a video I made https://www.youtube.com/watch?v=R_q1XdBJqoo

I don’t think I’ll be able to work on this issue sadly, I really wanted to, but there is stuff I’m struggling with in real life that makes it difficult for me to right now :(

jmmelko commented 5 years ago

Wow, this is ambitious. I had this idea in the back of my mind too but I let it stay there because I was afraid of the consequences! I was afraid we would have to use a neural network algorithm to predict the key while the user is typing the note :-P Maybe this problem has been solved already? Have you searched the web?Musicians are better than machines in this area but one never knows... Besides I agree with your teacher, it works, I used it to eliminate notes in chords taken from piano sheets.

tracey-le commented 5 years ago

Yeah hmm I searched "determining a key for a midi song"

https://stackoverflow.com/questions/14734644/is-there-an-algorithm-to-get-the-scale-and-key-of-a-song-from-a-series-of-notes

jmmelko commented 5 years ago

Mmm.... maybe you can try the music21 package?

JMM.

Le 5 nov. 2019 à 04:16, Tracey notifications@github.com a écrit :

 Yeah hmm I searched "determining a key for a midi song"

https://stackoverflow.com/questions/14734644/is-there-an-algorithm-to-get-the-scale-and-key-of-a-song-from-a-series-of-notes

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

tracey-le commented 4 years ago

it looks like the music21 package takes in midi

I found this site which describes one of the algorithms used in music 21 though

http://rnhart.net/articles/key-finding/

This document describes the Krumhansl-Schmuckler key-finding algorithm. If you have music data that consists of note pitch and duration information, this algorithm can be used to assign an appropriate major or minor key to the music data.

it uses the note pitch and note duration which we don't have information about atm hmm.


Ahh about this issue (9), I'm sorry, I had wanted to try work on this. I was diagnosed with mixed anxiety and depression recently. I was interested in this but I am just finding difficulty making myself right now, I'd still like to work on other parts of the program though.

jmmelko commented 4 years ago

Dear Tracey, I’m sorry to hear that; you seem to be a nice person, so I wish you the best, naturally. These things can take time, so don’t spend it too much inside Sky, at least not more than necessary 😴 I have sacrificed a bit of my personal life (and some hours of sleep) to make the python script progress, but I’m satisfied with how it is (don’t worry, no real harm done :-)). It almost made me feel young again 👴🏻(Haha, exaggerating).

I think it is now up to Alex to move his a*, oops I mean try his best to do the bot interface.😇

tracey-le commented 4 years ago

I appreciate that, thank you JMM aw 😥 I feel concerned. but I admit I get how it feels when you are excited about something lol

tracey-le commented 4 years ago

I thought of a way to convert a note to the right coordinate, without needing to make long dictionaries for each scale 😃

It is by treating the note (in Western notation) like it’s a number in base 7, where the note name tells you the 7^0 column, and the octave number tells you the 7^1 column.

Then to get the right coordinate, you shift the number down and convert the number to base 5 (because the sky piano/harp has 5 notes in each row) https://sky.bloomexperiment.com/t/playing-in-keys-other-than-c-initial-planning/180/4?u=cactusflower

tracey-le commented 4 years ago

Closing as the initial work is done, being continued on https://github.com/sky-music/sky-python-music-sheet-maker/issues/35

tracey-le commented 4 years ago

(we now have methods to convert a Western note into a coordinate on the Sky piano — given a note name, octave number and a song key.)