-
-
Notifications
You must be signed in to change notification settings - Fork 682
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
p5.SoundLoop() #210
p5.SoundLoop() #210
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is awesome!! Reviewing this live on hangouts, just adding some notes
examples/sound_loop/sketch.js
Outdated
console.log('looper1 '+this.clock._nextTick); | ||
}, 1); | ||
|
||
looper2 = new p5.SoundLoop(function(time){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we should change this to be timeFromNow
to be clearer ?
examples/sound_loop/sketch.js
Outdated
|
||
looper2 = new p5.SoundLoop(function(time){ | ||
|
||
beatbox.play(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should pass timeFromNow
in as a parameter
examples/sound_loop/sketch.js
Outdated
d = color(50); | ||
// create a part with 8 spaces, where each space represents 1/16th note (default) | ||
looper1 = new p5.SoundLoop(function(time){ | ||
click.play(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pass in timeFromNow
src/soundLoop.js
Outdated
this.clock = new Clock({ | ||
'callback' : function(time) { | ||
var timeFromNow = time - p5sound.audiocontext.currentTime; | ||
if (timeFromNow > 0) {self.callback(timeFromNow);} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why would this be less than zero anyway? ah, @jvntf and I are testing together and found that this is the case when we load the page. Maybe worth adding a comment?
src/soundLoop.js
Outdated
p5.SoundLoop.prototype._calcFreq = function() { | ||
if (typeof this._interval === 'number') { | ||
this.musicalTimeMode = false; | ||
return this._bpm / 60 / this._interval * (this._timeSignature / 4); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it seems like this should just set the interval in seconds
A redesigned
p5.Looper
---based on discussions with @therewasaguy re: a sort of draw loop for sound.
a simpler version of the
p5.Phrase / p5.Part / p5.Score
ecosystemits just a loop! set an interval for how often a callback should be called.
use numerical notation to specify interval in seconds, or use ToneJS time notation which corresponds to the loopers BPM. Change the interval at any time and it will be reflected in the next iteration of the loop.
TODO: iteration counting / capping, clock syncing of multiple loops, triplets
p5.Looper
is based on Tone.Clock rather than Tone.Transport because it is a relatively simple application, and I thought it wouldn't need all the features of Transport. also, to include less code in the library rather than more.