{"action":"created","issue":{"url":"https://api.github.com/repos/hoch/canopy/issues/89","repository_url":"https://api.github.com/repos/hoch/canopy","labels_url":"https://api.github.com/repos/hoch/canopy/issues/89/labels{/name}","comments_url":"https://api.github.com/repos/hoch/canopy/issues/89/comments","events_url":"https://api.github.com/repos/hoch/canopy/issues/89/events","html_url":"https://github.com/hoch/canopy/issues/89","id":420520645,"node_id":"MDU6SXNzdWU0MjA1MjA2NDU=","number":89,"title":"No waveform rendered when using async calls in code","user":{"login":"chrislo","id":16707,"node_id":"MDQ6VXNlcjE2NzA3","avatar_url":"https://avatars0.githubusercontent.com/u/16707?v=4","gravatar_id":"","url":"https://api.github.com/users/chrislo","html_url":"https://github.com/chrislo","followers_url":"https://api.github.com/users/chrislo/followers","following_url":"https://api.github.com/users/chrislo/following{/other_user}","gists_url":"https://api.github.com/users/chrislo/gists{/gist_id}","starred_url":"https://api.github.com/users/chrislo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrislo/subscriptions","organizations_url":"https://api.github.com/users/chrislo/orgs","repos_url":"https://api.github.com/users/chrislo/repos","events_url":"https://api.github.com/users/chrislo/events{/privacy}","received_events_url":"https://api.github.com/users/chrislo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2019-03-13T14:10:24Z","updated_at":"2020-01-10T13:21:02Z","closed_at":null,"author_association":"NONE","body":"When I type the following code in Canopy: \r\n\r\n```\r\nasync function fetchData() {\r\n  const response    = await fetch('https://www.webaudioweekly.com/audio/1.wav');\r\n  const arrayBuffer = await response.arrayBuffer();\r\n  const audioBuffer = await context.decodeAudioData(arrayBuffer);\r\n\r\n  return audioBuffer;\r\n};\r\n\r\nfetchData().then((audioBuffer) => {\r\n  const bufferSource = context.createBufferSource();\r\n\r\n  bufferSource.buffer = audioBuffer;\r\n  bufferSource.connect(context.destination);\r\n\r\n  bufferSource.start();\r\n});\r\n```\r\n\r\nand hit the run button, no audio is played and no waveform is rendered. If I define `context = new AudioContext();`  in a JavaScript developer console and run the same code, I hear the audio as expected. This problem occurs in both FF65 and Chrome 72 (tested on OS X). \r\n\r\nDiscussing this with @hoch and @rtoy in the web audio slack channel, we think that the wrapping function may not work with `async` calls. \r\n\r\n@rtoy suggested one approach might be to have a function that needs explicity calling from user code to start the rendering. \r\n\r\n"},"comment":{"url":"https://api.github.com/repos/hoch/canopy/issues/comments/573032551","html_url":"https://github.com/hoch/canopy/issues/89#issuecomment-573032551","issue_url":"https://api.github.com/repos/hoch/canopy/issues/89","id":573032551,"node_id":"MDEyOklzc3VlQ29tbWVudDU3MzAzMjU1MQ==","user":{"login":"haywirez","id":14359218,"node_id":"MDQ6VXNlcjE0MzU5MjE4","avatar_url":"https://avatars3.githubusercontent.com/u/14359218?v=4","gravatar_id":"","url":"https://api.github.com/users/haywirez","html_url":"https://github.com/haywirez","followers_url":"https://api.github.com/users/haywirez/followers","following_url":"https://api.github.com/users/haywirez/following{/other_user}","gists_url":"https://api.github.com/users/haywirez/gists{/gist_id}","starred_url":"https://api.github.com/users/haywirez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haywirez/subscriptions","organizations_url":"https://api.github.com/users/haywirez/orgs","repos_url":"https://api.github.com/users/haywirez/repos","events_url":"https://api.github.com/users/haywirez/events{/privacy}","received_events_url":"https://api.github.com/users/haywirez/received_events","type":"User","site_admin":false},"created_at":"2020-01-10T13:21:02Z","updated_at":"2020-01-10T13:21:02Z","author_association":"NONE","body":"🤔 could be done by hacking `var footer = `` ` to start rendering after some manual trigger event \r\n\r\nhttps://github.com/hoch/canopy/blob/b2345f83014dc42c8af991f4f534adc67c909085/docs/spiral-elements/spiral-coder/code-renderer.js#L19"}}
{"actor":{"display_login":"haywirez"}}