{"action":"created","issue":{"url":"https://api.github.com/repos/excaliburjs/Excalibur/issues/810","repository_url":"https://api.github.com/repos/excaliburjs/Excalibur","labels_url":"https://api.github.com/repos/excaliburjs/Excalibur/issues/810/labels{/name}","comments_url":"https://api.github.com/repos/excaliburjs/Excalibur/issues/810/comments","events_url":"https://api.github.com/repos/excaliburjs/Excalibur/issues/810/events","html_url":"https://github.com/excaliburjs/Excalibur/pull/810","id":228376831,"number":810,"title":"Audio profile first draft","user":{"login":"andrewmbyrd","id":18648941,"avatar_url":"https://avatars2.githubusercontent.com/u/18648941?v=3","gravatar_id":"","url":"https://api.github.com/users/andrewmbyrd","html_url":"https://github.com/andrewmbyrd","followers_url":"https://api.github.com/users/andrewmbyrd/followers","following_url":"https://api.github.com/users/andrewmbyrd/following{/other_user}","gists_url":"https://api.github.com/users/andrewmbyrd/gists{/gist_id}","starred_url":"https://api.github.com/users/andrewmbyrd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrewmbyrd/subscriptions","organizations_url":"https://api.github.com/users/andrewmbyrd/orgs","repos_url":"https://api.github.com/users/andrewmbyrd/repos","events_url":"https://api.github.com/users/andrewmbyrd/events{/privacy}","received_events_url":"https://api.github.com/users/andrewmbyrd/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2017-05-12T18:47:53Z","updated_at":"2017-05-19T01:58:46Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/excaliburjs/Excalibur/pulls/810","html_url":"https://github.com/excaliburjs/Excalibur/pull/810","diff_url":"https://github.com/excaliburjs/Excalibur/pull/810.diff","patch_url":"https://github.com/excaliburjs/Excalibur/pull/810.patch"},"body":"Begins to deal with #804 \r\n\r\n##NOT A COMPLETE REQUEST\r\n- I've made a shot at implementing the sound profiles. The build so far was just to test that I could control volume while the song was playing - no actual user input is configured yet, and I've only got it working for the loop audio file in the sandbox.\r\n\r\nI've used the [cubic bezier curve equation](https://en.wikipedia.org/wiki/B%C3%A9zier_curve#Cubic_B.C3.A9zier_curves) in lines 610-640 to change volume as the song is playing, based on 4 possible \"points\". (points usually require two components, but since there is no x and y with respect to volume - only time and volume - I've omitted the independent variable of time) \r\n\r\nDoing it this way seems really computation hungry - maybe it's best to only update the volume 4 or 5 times throughout the course of the sound? Of course this will kill a lot of the smoothness of volume transition.\r\n\r\nDoes the `playWithProfile` function idea work well in this context? It's a bit of a repeat of the `play` function, but it is doing a very different thing.\r\n\r\nPlease let me know your thoughts\r\n"},"comment":{"url":"https://api.github.com/repos/excaliburjs/Excalibur/issues/comments/302588291","html_url":"https://github.com/excaliburjs/Excalibur/pull/810#issuecomment-302588291","issue_url":"https://api.github.com/repos/excaliburjs/Excalibur/issues/810","id":302588291,"user":{"login":"eonarheim","id":612071,"avatar_url":"https://avatars1.githubusercontent.com/u/612071?v=3","gravatar_id":"","url":"https://api.github.com/users/eonarheim","html_url":"https://github.com/eonarheim","followers_url":"https://api.github.com/users/eonarheim/followers","following_url":"https://api.github.com/users/eonarheim/following{/other_user}","gists_url":"https://api.github.com/users/eonarheim/gists{/gist_id}","starred_url":"https://api.github.com/users/eonarheim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eonarheim/subscriptions","organizations_url":"https://api.github.com/users/eonarheim/orgs","repos_url":"https://api.github.com/users/eonarheim/repos","events_url":"https://api.github.com/users/eonarheim/events{/privacy}","received_events_url":"https://api.github.com/users/eonarheim/received_events","type":"User","site_admin":false},"created_at":"2017-05-19T01:58:46Z","updated_at":"2017-05-19T01:58:46Z","body":"@andrewmbyrd Actually I think you have a point about the volume over time problem, the easing functions, as is, are not designed for this type of continuous curve given a bunch of points. The cubic bezier calculation sounds like the right thing the more I think about it. Also `Util/EasingFunctions` sounds like the best place for the implementation. The intent originally was to specify a list of points (points of volume) and do dynamic volume interpolation, which a bezier curve would work perfectly.\r\n\r\nAs for recalculating the volume, I agree this would be computationally prohibitive. We could hook into the `ex.Sound.load` routines and front load the calcuation and cache it at loader time inside the sound object. That way you don't pay the penalty when you play the sound, the users expect to wait when they see the loading bar.\r\n\r\nThis way we would only need to ever recalculate the points of the curve if a new profile was provided to the `ex.Sound`\r\n\r\nWe could assume cached points at 16ms timestep when being precalculated (which would be the fastest it could change in a 60fps based update anyway). If that turns out to be to much memory we could just sample the bezier curve at larger time steps and save those points and during play time linear interpolate between sampled points where appropriate. I bet the human ear wont be able to tell the difference... maybe...\r\n\r\nSomething like this? Where the red lines are interpolated between sample points of the \"true\" bezier\r\n![image](https://cloud.githubusercontent.com/assets/612071/26230013/6b3d348e-3c0b-11e7-9d54-3da167f9cbb1.png)\r\n\r\nFor this spec, I think just confirming that the logical volume value changes over time as we would expect. If we want to do a visual test to confirm with our ears like we did with the `wasTouching`\r\n"}}
{"actor":{"display_login":"eonarheim"}}