adamrenklint / bap

A toolkit for making beats and composing sequences with Javascript and Web Audio
MIT License
115 stars 6 forks source link

remove all notes to add new/refresh note #60

Closed benoitwimart closed 6 years ago

benoitwimart commented 6 years ago

Hi,

1/ How can I remove all notes without a for() ?

 for (let i = 0; i < pattern.channel(1).rawNotes.models.length; i++) {
        pattern.channel(1).rawNotes.remove(pattern.channel(1).rawNotes.models[0].cid);
 }

2/ Is it possible to create a note obj ? change his position and auto refresh the pattern ?

3/ when I remove all notes with my loop, I add note to my pattern pattern.channel(1).add() note cid are start from the last cid (I have 4 notes but first cid is note-124…), I am doing something wrong ?

4/ I will make a small French tutorial in few weeks ;¬)

adamrenklint commented 6 years ago
  1. There's currently no way to remove all the notes without a loop
  2. Yes, when you change a note's position, the change is live immediately
  3. No, nothing wrong - the CIDs just keep incrementing for each called constructor
  4. Awesome! 😀