I want to make an arpeggiator that tracks the current midi keys that are down and plays them in the order they were pressed, and removes them from the pattern when they are released. Basically loop through steps and play the current position in the list of current notes with makenote
. I started trying to make this with list
objects and it doesn't work well. Often keys stay "stuck" or will not register they were pressed. Is there a better way to accomplish this goal? Here is what I have. arp-help.pd
is the example. Any suggestions on making it work are greatly appreciated.
-
current keydown arpeggiator
-
Lists can be difficult to operate when you need to delete items from them on the go. You can use [list-find] to identify and [list-delete] to remove items one by one (both from the list-abs library). This works, though it's not very efficient as each object has to iterate through the list.
A better way might be to write the values to an array, or even to a text object. Arrays will work the fastest, but text might be best in this case because you can search for the items you want to remove. So if you're using a recent version of Vanilla, [text search] and [text delete] are probably your best bet. You can then use [text set] to add items and [text get] to retrieve them (in place of your [list-nth]).
Looking at your patch, I would also guess that part of the problem has to do with order of operations. The [o] right after the metro and the [arp] sub-patch both have two connections coming out of the outlets, but which one gets sent first? The patch won't work if you get the order wrong. Use [trigger] to define the order, and you might find that you've fixed the problem.
-
Yeh, I was thinking I should combine the bang outlets by just inputting the current step (instead of a bang.) I suspected your advice, but I appreciate the confirmation. I will report back if I get it working.
-
I would do it with linked lists, it's not simple to do though!
-
What are linked lists? I liked the idea of using the new
text
, as I am already using a fairly new vanilla. I built this arpeggiator withtext
objects. It seems to work much better, but there is still a pause when it loops around. Am I usingtext sequencer
incorrectly, or is there a better way to use this?
-
I fixed it with a bang to step, which seems a bit hacky, but it works.
-
It's not perfect, but here is a video of it working pretty well:
-
Seems like you are getting there…. I was not aware of the [text] object before…….
In case it's useful to you:
The idea of linked lists is that you would have 2 arrays -
1 storing the note values
1 storing a pointer to the next value to be playedfor example if your arrays are
NOTE and POINTER
when the player presses C you might store
60 in NOTE (0) & 0 in POINTER(0).
if the player adds E then you would store:
64 NOTE(1) & 0 in POINTER (1) & 1 in POINTER(0)so each time the player adds the nth note to the arpeggio, you store the note in NOTE (n) and you store a 0 in POINTER (n), and you store n in POINTER (n-1)
If the player releases a key then you just have to update the POINTER array so that the value BEFORE the released key now points to the value AFTER the released key. you don't have to bother tidying up the NOTE array until all keys have been released.
So you would search for a member of NOTE that matches the released key.
if you call that the nth member, then all you have to do is set POINTER(n-1) to the same value as POINTER(n).This would also definitely be a useful technique if you wanted to do an up/down arpeggiator where the player can add and remove notes.
-
Thanks so much for this instructions! I had no idea how to achieve it, but I just followed it through and it really is working like a charm! Hope this topic is at all still interessiting for anybody. Well, here's my result (Ialso incorporated velocity):
Now I'm scratching my head over, how to achieve the up/down mode of the arpeggiator. Any Tipps on that? Do I need another array for the notes, so that they are read from the nore array, that's already there, sortet and written into a new array? No, seems not very elegant to me...