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

add reorganize button #15

Open
santolucito opened this issue Oct 11, 2021 · 2 comments
Open

add reorganize button #15

santolucito opened this issue Oct 11, 2021 · 2 comments
Labels
good first issue Good for newcomers

Comments

@santolucito
Copy link
Member

santolucito commented Oct 11, 2021

It can get difficult to keep track of all the tracks one is controlling at the same time. It would be nice to have a "reorganize" button that rearranged the code so that all lines of code that affected a particular track number were next to each other. For example

turn this code:

function genBeat(b, s, currentTimestep){

  b.track1vol = pattern((val,i) => 1 - (i % 2));
  //b.track1vol.splice(3,13,...Array(13).fill(0));
  b.track1dur = pattern((val,i) => 1);
  b.track6vol = pattern((val,i) => 1 % (2 - (i % 4)));
  //b.track6vol.splice(9,7,...Array(7).fill(0));
  
  b.track4dur[2] = 4;
  b.track3dur[6] = 3;
  b.track3vol = pattern((val,i) => 1 % (6 % (i - 2)));
  b.track3vol.splice(10,6,...Array(6).fill(0));
  b.track6dur = pattern((val,i) => (i+4) % 3);
  s.track6_thumb = 1 //currentTimestep/16;
 
  s.track4_thumb = Math.random()*0.3 + 0.7;
  return {beat:b, sliders:s};
};

into this code

function genBeat(b, s, currentTimestep){

  b.track1vol = pattern((val,i) => 1 - (i % 2));
  //b.track1vol.splice(3,13,...Array(13).fill(0));
  b.track1dur = pattern((val,i) => 1);

  b.track3dur[6] = 3;
  b.track3vol = pattern((val,i) => 1 % (6 % (i - 2)));
  b.track3vol.splice(10,6,...Array(6).fill(0));
  
  b.track4dur[2] = 4;
  s.track4_thumb = Math.random()*0.3 + 0.7;

  b.track6dur = pattern((val,i) => (i+4) % 3);
  s.track6_thumb = 1 //currentTimestep/16;
  b.track6vol = pattern((val,i) => 1 % (2 - (i % 4)));
  //b.track6vol.splice(9,7,...Array(7).fill(0));

  return {beat:b, sliders:s};
};
@santolucito santolucito added the good first issue Good for newcomers label Dec 23, 2021
@santolucito
Copy link
Member Author

probably this string manipulation should go here:

@santolucito
Copy link
Member Author

i think someone was working on this, but I don't remember who...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant