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

Merged
merged 5 commits into from Aug 17, 2017

Conversation

Projects
None yet
2 participants
@jvntf
Copy link
Contributor

jvntf commented Aug 4, 2017

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 ecosystem
its 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.

@jvntf jvntf referenced this pull request Aug 4, 2017

Closed

p5.Looper WIP #209

@jvntf jvntf changed the title p5.SoundLoop() WIP p5.SoundLoop() Aug 8, 2017

@therewasaguy
Copy link
Member

therewasaguy left a comment

this is awesome!! Reviewing this live on hangouts, just adding some notes

console.log('looper1 '+this.clock._nextTick);
}, 1);

looper2 = new p5.SoundLoop(function(time){

This comment has been minimized.

@therewasaguy

therewasaguy Aug 9, 2017

Member

maybe we should change this to be timeFromNow to be clearer ?


looper2 = new p5.SoundLoop(function(time){

beatbox.play();

This comment has been minimized.

@therewasaguy

therewasaguy Aug 9, 2017

Member

we should pass timeFromNow in as a parameter

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();

This comment has been minimized.

@therewasaguy

therewasaguy Aug 9, 2017

Member

pass in timeFromNow

this.clock = new Clock({
'callback' : function(time) {
var timeFromNow = time - p5sound.audiocontext.currentTime;
if (timeFromNow > 0) {self.callback(timeFromNow);}

This comment has been minimized.

@therewasaguy

therewasaguy Aug 9, 2017

Member

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?

p5.SoundLoop.prototype._calcFreq = function() {
if (typeof this._interval === 'number') {
this.musicalTimeMode = false;
return this._bpm / 60 / this._interval * (this._timeSignature / 4);

This comment has been minimized.

@therewasaguy

therewasaguy Aug 9, 2017

Member

it seems like this should just set the interval in seconds

@jvntf jvntf force-pushed the jvntf:soundLoop branch from 0a5e6db to dd82572 Aug 15, 2017

@therewasaguy therewasaguy merged commit 2644e0c into processing:master Aug 17, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment