Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Song "Link" (share link for showing off a creation) #27

Open
elliot-nelson opened this issue Nov 9, 2020 · 3 comments
Open

Song "Link" (share link for showing off a creation) #27

elliot-nelson opened this issue Nov 9, 2020 · 3 comments

Comments

@elliot-nelson
Copy link

It would be nice if, while playing around with songs, there was a way to share a link to an embedded song in the tracker.

Max URL length is generally ~2000 characters, which is easy to go over for a song with a few patterns, so we might need to do one or more of:

  • Build in an all-javascript gzip and see if you could crunch songs by gzip+base64 and put them in URL? Certainly this would just increase the max length (maybe it's closer to 4000 characters with this approach).
  • Nuclear option, actual backend somewhere so the url can be just /2935239 and pull the song up. Would need to have some kind of netlify or heroku app running in this case.
  • Alternative -- maybe you could piggyback a public upload, like a gist? If you could start the tracker with ?gist=<gist url> then users could upload a song to a public gist and make a link to it like that. No database necessary in that case.
@KilledByAPixel
Copy link
Contributor

You could use JSON crush to share urls, the compression is actually better then zipping in most use cases.

https://github.com/KilledByAPixel/JSONCrush

@keithclark
Copy link
Owner

I agree. Song sharing could be easier to deal with.

  • I added a zip library to a recent release of the tracker for reporting compressed size, so Zip + URL encoding is an option, as is JSON crush. Constraining songs to 2K bytes after compression could cause problems though — especially if authors want to keep metadata and unused patterns.
  • I really don't want to add a backend to this project as it's another thing to maintain.
  • You can load a song into the tracker by passing ?url= in the URL (provided the server sends the correct CORS headers) — for example: https://keithclark.github.io/ZzFXM/tracker/?url=https://raw.githubusercontent.com/keithclark/ZzFXM/master/examples/songs/sanxion.js. I did this to allow authors to submit their open source songs to a ZzFXM repo I set up. It should with gists.

Plenty to think about.

@elliot-nelson
Copy link
Author

Ah, so probably anyone could push a song as a json file into any repo and load it with the URL option, right? If so that doesn't make it "easy" to share a song but you can make it easy for the recipient to play.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants