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

update inline examples (#388) #403

Merged

Conversation

therewasaguy
Copy link
Member

@therewasaguy therewasaguy commented Jan 3, 2020

So far, some examples use soundFile.play() or oscillator.start() rather than a potentially redundant call to userStartAudio(). It might be worth that redundant call, because the difference between methods that call "start" on a WebAudio node (thus enabling audio on a user gesture) and those that do not is pretty obfuscated...

@therewasaguy
Copy link
Member Author

therewasaguy commented Jan 3, 2020

One potential improvement would be to wrap the text in a conditional like

if (getAudioContext().state !== 'running') {
  text('tap to play', width/2, 20);
}

Or

var tapped = false;

function setup() {
  cnv = createCanvas();
  cnv.mousePressed(toggleSound);
}

function draw() {
  if (!tapped) {
    text('tap to play', width/2, 20);
  }
}

function toggleSound() {
  tapped = true;
  // make noise !
}

or, maybe there is a less verbose way...

@therewasaguy therewasaguy changed the title [WIP] update inline examples (#388) update inline examples (#388) Jan 6, 2020
@therewasaguy
Copy link
Member Author

This may be worth discussing (just updated) but I am going to merge and if anybody is inspired to iterate on examples from here, please feel free!!

So far, some examples use soundFile.play() or oscillator.start() rather than a potentially redundant call to userStartAudio(). It might be worth that redundant call, because the difference between methods that call "start" on a WebAudio node (thus enabling audio on a user gesture) and those that do not is pretty obfuscated...

@therewasaguy therewasaguy merged commit 9760dd0 into master Jan 6, 2020
therewasaguy added a commit to processing/p5.js that referenced this pull request Jan 6, 2020
- update inline examples: processing/p5.js-sound#403
- p5.SoundFile: stop() won't stop a soundfile loop https://github.com/processing/p5.js-sound/pull/401
- p5.SoundFile: addCue() not triggering function calls https://github.com/processing/p5.js-sound/pull/371
- p5.SoundFile: jump() only called if soundfile is playing processing/p5.js-sound#404
- p5.SoundFile: save() bugfix processing/p5.js-sound#406
therewasaguy added a commit to processing/p5.js that referenced this pull request Jan 6, 2020
- improved inline documentation - all examples start audio on user gesture processing/p5.js-sound#403
- AudioWorklet replaces the deprecated ScriptProcessorNode (when available) in p5.SoundRecorder, p5.Amplitude, and p5.SoundFile, as part of @oshoham's GSoC project https://github.com/processing/p5.js/blob/master/developer_docs/project_wrapups/orenshoham_gsoc_2019.md
processing/p5.js-sound#369
processing/p5.js-sound#373
- p5 library compiled with webpack so it looks a little different and we had to remove comments that were tripping up YUIDoc here in the p5.js repo

- p5.SoundFile: stop() won't stop a soundfile loop https://github.com/processing/p5.js-sound/issues/401
- p5.SoundFile: addCue() not triggering function calls https://github.com/processing/p5.js-sound/issues/371
- p5.SoundFile: jump() only called if soundfile is playing processing/p5.js-sound#404
- p5.SoundFile: save() bugfix processing/p5.js-sound#406
- remove bad console call (processing/p5.js-sound#378)
@montoyamoraga montoyamoraga deleted the inline-examples/ensure-audio-context-has-started branch May 5, 2020 05:38
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

Successfully merging this pull request may close these issues.

1 participant