Resuscitate Freesound? - #2438
Draft
emlyn wants to merge 6 commits into
Draft
Conversation
Contributor
|
Just a quick note about the requirement to prevent the token from being visible in cleartext, Ardour just released version 7.0 and has the token in their source code (and I mean even in a compiled language it'll usually still be plain text, just somewhere within the binary) Ref: Ardour/ardour@9fe0a4f4#diff-fe5be98b9f63b941e3f44fc26c56ae18a69f30a51f7672d49001f2c200660a6eR73-R74 |
Contributor
Author
|
@lilyinstarlight that's good to know, I guess Freesound are not too strict with enforcing the terms. In that case maybe it would be fine even keeping the token in the Ruby source code. |
added 6 commits
March 28, 2023 09:35
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is just #2360 rebased onto the
new maindev branch. I've copied the description and my comments below.I was poking around the Freesound API, and realised it should be possible to make it work again in Sonic Pi.
I reverted the commits that removed Freesound support, and then modified the downloading code to use the v2 API to get the sample information. In that info there are links to the previews, so I download the high quality .ogg preview. This is all done with just an API token for authentication.
To show how/that it works, I made a quick screen cast that shows it downloading and caching a sample on the first run, then playing it once it's cached.
There are a number of remaining issues to be ironed out, but I think there's enough here to prove that it can be made to work. The things I see that need to be sorted out are:
sampleto play the freesound sample with that ID, but integers now have a different meaning, so you have to usesample freesound_path(1234), which is a bit verbose.Maybe it should just be renamed
freesound(and we do away with the currentfreesoundfunction)?nnn.wav,nnn.flacandnnn.oggand use the first one it finds?)use_freesound_tokenfunction to set the token to authenticate with freesound because the terms of use don't allow publishing the tokens. Users could sign up for a token and set it in theirinit.rbfile. But there could also be a default token compiled into release binaries, as long as it's not easily accessible by users that would be allowed (see here).@samaaron what are your thoughts on this?
I realised that since Ruby is not compiled, you can't really hide an API token in the release binary, so it might not be so easy to comply with the Freesound API terms. I guess it might be OK if the downloading is moved into a separate (compiled) binary that is called from the Ruby code?
@samaaron is this something that you would want back in Sonic Pi? I seem to remember reading that it was originally removed because the Freesound API changed so that token auth was no longer possible (but I don't remember where I saw that, so maybe I'm misremembering), and that now seems to no longer be the case.
From my reading it seems that as long as the token is not visible in cleartext it should comply with the Freesound terms. That means that the component that actually builds the url and does the download would have to be moved to a compiled language, with Sonic Pi's Freesound token injected at build time. If I implement something like that, would this be acceptable to merge into Sonic Pi?