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

p5.SoundLoop() #210

Merged
merged 5 commits into from
Aug 17, 2017
Merged

p5.SoundLoop() #210

merged 5 commits into from
Aug 17, 2017

Conversation

jvntf
Copy link
Contributor

@jvntf 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 mentioned this pull request Aug 4, 2017
@jvntf jvntf changed the title p5.SoundLoop() WIP p5.SoundLoop() Aug 8, 2017
Copy link
Member

@therewasaguy therewasaguy left a 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

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

looper2 = new p5.SoundLoop(function(time){
Copy link
Member

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 ?


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

beatbox.play();
Copy link
Member

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

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();
Copy link
Member

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);}
Copy link
Member

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);
Copy link
Member

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

@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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants