Skip to content

Commit

Permalink
Merge branch 'master' of ssh://github.com/mrjoshida/p5.js-sound
Browse files Browse the repository at this point in the history
* 'master' of ssh://github.com/mrjoshida/p5.js-sound:
  rebuild lib
  dispose of ConvolverNode before resetting buffer (processing#321)
  rebuild lib with reference example fix processing#320
  move loadSound call to preload
  prevent crashes during completion of callbacks on disposed SoundFiles
  0.3.9
  add soundfile.save example
  add `save()` and `getBlob()` methods to SoundFile. Move .wav conversion to helpers.js (processing#315)
  Added saveSoundToBlob() to soundRecorder.js
  Document properties of AudioIn
  update master limiter - sharp knee
  monosynth: remove unused _isOn
  monosynth: remove unused filter, patch velocity
  Missed this fragment during the renaming
  corrected formatting by replacing tabs with four spaces
  fixed issue: processing/p5.js-sound#297
  • Loading branch information
Josh Caldwell committed Sep 30, 2018
2 parents 30b1cf4 + 4016d11 commit 108cb04
Show file tree
Hide file tree
Showing 13 changed files with 548 additions and 237 deletions.
10 changes: 10 additions & 0 deletions examples/soundfile_remove_cue/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<head>
<script language="javascript" type="text/javascript" src="../../lib/p5.js"></script>

<script language="javascript" type="text/javascript" src="../../lib/addons/p5.dom.js"></script>

<script language="javascript" type="text/javascript" src="../../lib/p5.sound.js"></script>

<script language="javascript" type="text/javascript" src="sketch.js"></script>

</head>
41 changes: 41 additions & 0 deletions examples/soundfile_remove_cue/sketch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
function setup() {
background(0);
noStroke();
fill(255);
textAlign(CENTER);
text('click to play', width/2, height/2);

mySound = loadSound('../files/beat.mp3');

// schedule calls to changeText
var firstCueId = mySound.addCue(0.50, changeText, "hello" );
mySound.addCue(1.00, changeText, "p5" );
var thirdCueId = mySound.addCue(1.50, changeText, "what" );
mySound.addCue(2.00, changeText, "do" );
mySound.addCue(2.50, changeText, "you" );
mySound.addCue(3.00, changeText, "want" );
mySound.addCue(4.00, changeText, "to" );
mySound.addCue(5.00, changeText, "make" );
mySound.addCue(6.00, changeText, "?" );

//remove the first cue
mySound.removeCue(firstCueId);

//remove the third cue
mySound.removeCue(thirdCueId);
}

function changeText(val) {
background(0);
text(val, width/2, height/2);
}

function mouseClicked() {
if (mouseX > 0 && mouseX < width && mouseY > 0 && mouseY < height) {
if (mySound.isPlaying() ) {
mySound.stop();
} else {
mySound.play();
}
}
}
2 changes: 1 addition & 1 deletion fragments/before.frag
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* Triangle, Square and Sawtooth waveforms. Base class of
* <a href="#/p5.Noise">p5.Noise</a> and <a href="#/p5.Pulse">p5.Pulse</a>.
* <br/>
* <a href="#/p5.Env"><b>p5.Env</b></a>: An Envelope is a series
* <a href="#/p5.Envelope"><b>p5.Envelope</b></a>: An Envelope is a series
* of fades over time. Often used to control an object's
* output gain level as an "ADSR Envelope" (Attack, Decay,
* Sustain, Release). Can also modulate other parameters.<br/>
Expand Down
Loading

0 comments on commit 108cb04

Please sign in to comment.