-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
arpeggiator sorted mode fixed #7025
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
arpeggiator sorted mode fixed #7025
Conversation
|
Hi! Testing this now (sorry for the long waiting time). Thank you so much for taking care of this issue! It seem to work really well but the arpeggiator has a lot of functions now so it's starting to get really finicky to test. While testing this PR I discovered a bug that I introduced with the 'Repeats' function. This has been fixed in #7007 together with the original bug which that PR takes care of. I think it's better to merge that PR first and then rebase this PR so we can test this one some more with two less bugs to worry about. Are you OK with this? |
This comment was marked as outdated.
This comment was marked as outdated.
What does this mean for me? If it isn't too difficult, then sure! (I do not have this branch locally currently) |
|
I suspect it's a simple rebase. I can push the changes to your branch if you like. |
|
Do what you think is the best solution here. I will try to rebase soon. |
|
OK - The plan is:
|
7ba3a8f to
ccb230f
Compare
|
I think i have rebased. You can merge #7007 if I'm correct. |
That looks correct. I'll allow some time for feedback on that PR first. A day or two. |
I went with merging just my changes from #7007. This keeps your original commits so we can more easily test for regressions. |
|
Edit: nope |
28a10d4 to
30b28db
Compare
|
I have rebased, and changed your changes. This should be tested because unfortunately I do not remember my changes in great detail. There seems to be a display bug when sorted mode is enabled and multiple notes are pressed. This bug makes the pressed notes light up incorrectly (while not being played). |
|
In this test project from issue #2606 you can see the problems with Sync mode over more than one note. It has two identical arpeggios but one inverted so the sound cancels out unless one of the tracks skips a note. The last 6th of the sequence is the one with Sync mode over two notes. Turn up the tempo and enjoy! |
|
What are you trying to say? Would you rather me fix that issue as well? And the display issue I talked about? If not, I think this is ready for merge. |
No, you're welcome to, but I mentioned above that it looks like at least one of the demo projects was fixed by this commit so there is a connection. I'm a bit tired now so I'm happy to stick with just this issue. I've tested it with a bunch of arpeggios and they are almost all possible to compute ahead what the result will be. Almost all. This doesn't seem to be true for when you have a note that is looped before it's end so that it will overlap itself. I don't think it's reasonable to cover everything and this is an edge case. Just seeing the same result over and over again is fine. |
|
Fixes #4491 |
Veratil
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only other thing is perhaps it would be better to pull out all the range + sortOffset into a new variable so it's not repeated over and over and over and over. :)
|
Fixed the sorting algorithm and added more comments. |
Interesting, I see what you're trying to do but I don't think this is ready for merge. Some quick observations.
I think the envelope part is probably better to bud off to it's own PR. |
I reverted the changes. Looking back on this, I completely agree with you. |
|
I've tested it again but it doesn't seem to behave properly. The current implementation seem to be octave-piano-arp, referring to @DomClark from his analysis of the arpeggiator in #6499. Borrowed from #6499 (comment) Here are some different ways the notes (C-F-A) could be arpeggiated on.
Project used in testing: arpsorttest.mmp.txt |
|
Fixed, I really hope the arp is working as intended now. |
zonkmachine
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great and tests fine. I'm approving this and keep testing it ahead of the final word from @DomClark
DomClark
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this PR can be simplified a bit. Firstly, I would introduce the variable const auto arpMode = static_cast<ArpMode>(m_arpModeModel.value());, to avoid repeating that expression every time you want to check the mode. Then, I would do the following:
- The
notMinIndexbits can be replaced with an early return. I would checkarpType == ArpMode::Sort && _n != cnphv.first()just before the declaration ofchord_table, and return if it's true. I think this is a more obvious (and a bit more efficient) way to ensure only the first note drives the sorted arpeggio processing. - Rather than introducing
offsetRange, and replacingrangewith it, I would put the appropriate value intorangein the first place. I'd rename the originalrangetosingleNoteRange(or something like that), and then defineconst auto range = arpType == ArpMode::Sort ? singleNoteRange * cnphv.size() : singleNoteRange;. Thentotal_rangecan be removed too. This will simplify the diff a bit, and is a bit clearer as a variable name (I'm not sure what the "offset" refers to in "offsetRange"). - You can use a modulo operation to find which step of the chord you're at, in the same way you do to find which octave you're in. Then you don't need to build a list of notes in a separate vector, and can just sort
cnphvin-place. The note computation will end up looking something like this:See how the octave-arp-piano order becomes obvious now. The octave is the first quotient, the arp index the second, and the piano roll index the final remainder.const auto octaveDiv = std::div(cur_arp_idx, total_chord_size); const auto octave = octaveDiv.quot; const auto arpDiv = std::div(octaveDiv.rem, cnphv.size()); const auto arpIndex = arpDiv.quot; const auto pianoRollIndex = arpDiv.rem; sub_note_key = cnphv[pianoRollIndex]->key() + chord_table.chords()[selected_arp][arpIndex] + octave * KeysPerOctave;
Smart idea, I didn't think about that. |
DomClark
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good to me, although I haven't tested it myself.
|
@szeli1 Thank you for coding this, and for your patience in the review. Top notch work! This is a great step for the arpeggiator and for lmms-1.3 |

closes #6499
closes #4491
with this change the arpeggiator with sorted mode enabled will cycle through all of the active (currently playing) note's chords in order without skipping notes or randomly playing other ones.
this works by combining all of the chord's keys in an array and then playing it back as one single larger chord (sorted as suggested).