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

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

Suggestions for the new music feature #176

Closed Specy closed 4 years ago

Specy commented 4 years ago

I have some suggestions regarding the new music feature in the bot.

1) Link the sky-music.github.io website once an user finished with the composition of the song, saying something like "for more music sheets visit the website ---", it's a library of songs in the end, always good to publicize it.

2) Black mode in the sheets? Not really that important but it could be a nice touch.

3) Give option to also export the song in the sky music app/sky studio format based on the bpm of the song, if not given, use 220

The format is this one:

[{
name:" ",
bpm:" ",
isComposed: true,
bitsPerPage: 16,
pitchLevel: 0,
songNotes[
      {
             key:"Key0", //Key goes from top left to bottom right 
             time:1000 //Timestamp since the beginning of the song
      }
}]

It's an array because it supports multiple song import/export, each note time is calculated with the bpm , each "cell" increases the timestamp by 60000/bpm, empty cells just increase the timestamp and don't add any other notes. Notes pressed together have the same timestamp.

This is a JSON but can be given both .JSON or .txt file extension.

Any attribute can be added to the format like the author name and other information, but the name of the song must be the first attribute. Jmmelko and Tracey already are familiar to this format, I made a script to convert the html songs to this format on the sky-music.github.io website.

jmmelko commented 4 years ago

1/ ok excepted if @e-a-h disapproves 2/ easily doable, I just have to generate new png elements with a dark background 3/ @e-a-h disapproved sending HTML, and recommended PNG, but maybe he won’t be opposed to sending text

In the meantime, it would be great if you could find a name or an acronym for this format. eg SSWT : Sky Sheet With Tempo, or whatever’s better

e-a-h commented 4 years ago

3: export as JSON format would be fine. Possibly it could be incorporated as an option in the Aspect ratio question, which maybe could be renamed as "Output Format"

Specy commented 4 years ago

I think it would be better in the very end a question like "would you also like -----"

e-a-h commented 4 years ago

Possibly. Or maybe the output question can be reworked to allow multiple choices. e.g.: Please choose one or more of the following. When your selection is complete, also react with ✅:

[1] 16:9 [2] 4:3 [3] 1:1 [4] 1:1.41 [5] SkyStudio Playable JSON file [1][2][3][4][5][✅]

e-a-h commented 4 years ago

also, if skystudio output format, we can add a link in the option and help for that question. I think this obviates the advertisement requested in (1) above.

Specy commented 4 years ago

It isn't sky studio format though, it's an universal format, would be wrong to say it's theirs.

Also I can provide something to give a link that automatically imports the song to the website like I'm already doing with the account songs

this is an example

Which will be then deleted after some hours

e-a-h commented 4 years ago

if the site can accept JSON as POST, skybot can directly POST and return the link. Unless you're saying you can provide code that will allow skybot to create a hash as in your example link?

Specy commented 4 years ago

Yes It does support JSON as post, I use only that. What I was thinking is 1) Sky bot sends the JSON of the song 2) website hosts the song for 1 hour/1day either on the database or locally in an array, creates a random 8 characters code identifying the song, sends back a JSON containing the link that then will be sent to the user.

e-a-h commented 4 years ago

That sounds preferable to sending member a JSON file, which most people won't have any interest in. I think we should still include the JSON file in addition to a generated link though.

Specy commented 4 years ago

Good then, I'll work on adapting the website and backend for that then. Also, I think writing on discord would be more convenient from now (regarding this) as it is more convenient

jmmelko commented 4 years ago

Just to add that the music maker already has a question asking for the output format. We could use it or create a music-cog specific question; however I would prefer that we do not tweak the Aspect ratio question. It is not intended for that and would make maintenance difficult.

e-a-h commented 4 years ago

as long as it works I don't have strong opinions about how the question is implemented. I was only looking for ways to streamline if possible.

Specy commented 4 years ago

I've adapted the website backend to accept cross origin requests and added a route to generate a temporary link that works for 1 hour or untill the website shuts down (heroku sleeping)

Send a POST request to this address: https://sky-music.herokuapp.com/api/generateTempSong

and send a JSON made like this:

{
  "API_KEY":"The private key that I will share"
  "song":{/*Object of the song*/}
}

the song should have this format:

{
  "name":"",
  "pitchLevel":0,
  "bpm":220,
  "isComposed":true,
  "bitsPerPage": 16,
  "songNotes":[{"time":0,"key":"Key0"},...]
}

The website will answer back with the temporary link that then can automatically get the song whenever someone opens the link

jmmelko commented 4 years ago

Great!

I have already applied your suggestion no1 and modified the code to support no2 dark mode (or any other theme as a matter of fact).

I don’t know how to send a POST request by python. I used to do that with Django that does all this automatically.

Specy commented 4 years ago

https://stackoverflow.com/a/11324941/12878032 https://www.w3schools.com/python/ref_requests_post.asp ?

jmmelko commented 4 years ago

Seems simple enough.

I may have to change the program a bit so that it handles sending a link as output. Because at the moment only IOString and IOByted are supported

Specy commented 4 years ago

You could also just include it in the end inside the embedded text instead of it being a new format to chose from, I think with discord you can add an URL to the embed as hyperlink.

So like the final message would be like

Your song is available at this link to listen to for the next 30 minutes , if you want more visual sheets, go to this website

Also one note, I understand sending the .zip file, but does iOS have a way to automatically unzip them? Users probably won't want to download a file unzipper to see their songs.

Specy commented 4 years ago

Ops

jmmelko commented 4 years ago

Yes you’re right, this link should not be another output format. It should be the cherry on top of the cake. I will think add a last message for it.

Yes, on iOS you can unzip files by opening them in the Files application. You can also create a zip archive from there.

jmmelko commented 4 years ago

@Specy-wot did you change the song format again? Currently I assume it is the following:

[{"name": "Xxxxxxx", "author": "xxxxxx", "arrangedBy": "xxxxxx", "transcribedBy": "xxxxxx", "permission": "", "bpm": 120, "pitchLevel": 0, "bitsPerPage": 16, "songNotes": [{"time": 125, "key": "1Key4"}, {"time": 250, "key": "1Key5"}, {"time": 375, "key": "1Key6"}, ...........

Specy commented 4 years ago

Oh well, your choice in the end

Specy commented 4 years ago

@jmmelko no I didn't, that's sky studio Information, he added it like 1 month ago after i told him about a collaboration with all 3 of us so he added those but isn't using them, I added something called "isComposed" which I use in the composer to chose the algorithm type to import the song (if it's true it's more strict, if it's false then it's less strict). That information is probably useful to the visual sheets and I can easily add it to mine if you wish.

jmmelko commented 4 years ago

Ok but shouldn’y the key be 1Key0 instead of 1Key0 ?

You told me that the first digit was the starting octave or something, did you remove it?

Btw should I set is Composed to True or False by default?

Thanks.

Specy commented 4 years ago

Since the song isn't recorded by hand, put isComposed to true, use 1Key , the 1 is the layer number, it's used by sky studio to determine layers. But I don't need it so I just remove it, but make the bot send the 1Key so it stays universal, I already have a function to convert it

jmmelko commented 4 years ago

Ok, I have another question. JSON are supposed to be enclosed in brackets [], and items separated by commas right?

So the complete format would be:

[{ "API_KEY":"The private key that I will share", "song": [{"name":"", "pitchLevel":0, "bpm":220, "isComposed":true, "bitsPerPage": 16, "songNotes":[{"time":0,"key":"Key0"},...]}] }]

or are brackets optional when there’s only one item?

About the private key, I suppose it’s a complex alphanumeric key that you’ll give me using a private channel??? Or a file? But then how can I include it in the code without revealing it?

Specy commented 4 years ago

No you don't need the brackets, you can omit them.

Don't you have environment variables? How do you store the bot token?

jmmelko commented 4 years ago

@e-a-h is there a place to store private keys?

e-a-h commented 4 years ago

I can store private keys on the server (in config.json), or I can add to github "secrets" and have my deploy action insert where needed. I'm confused about this issue being assigned to me though; if part of it is ready for skybot implementation, would it be best to make issues in that repo? It sounds like the conversation is focused on item 3 above.

jmmelko commented 4 years ago

Yeah, sorry, I will close this issue and open a new one in yours

jmmelko commented 4 years ago

@Specy-wot I have moved the issue here: https://github.com/e-a-h/That-Sky-Bot/issues/52