hydrogen-music / hydrogen

The advanced drum machine for Linux, macOS, and Windows
http://www.hydrogen-music.org
GNU General Public License v2.0
1.04k stars 173 forks source link

Add option to align notes to the current grid. #1878

Closed cme closed 10 months ago

cme commented 11 months ago

This can be used to automatically quantise notes already recorded or entered, and also can be used to change patterns to swung by selecting a triplet grid.

A straight 4/4 pattern...

image

Select 1/8T and hit 'align'

image

...and now it's swung!

image
theGreatWhiteShark commented 11 months ago

There is one thing I just noted (which is caused by the PR itself). Deduplication of notes is not triggered in all cases.

Steps to reproduce

  1. Set resolution to off
  2. Fill all notes of an instrument
  3. Set resolution to 1/4
  4. Align to grid
  5. Click into the Song Editor

Now, whenever one uses the Pattern Editor it does not deduplicate the notes automatically anymore.

cme commented 11 months ago

There is one thing I just noted (which is caused by the PR itself). Deduplication of notes is not triggered in all cases.

Steps to reproduce

1. Set resolution to `off`

2. Fill all notes of an instrument

3. Set resolution to `1/4`

4. Align to grid

5. Click into the Song Editor

Now, whenever one uses the Pattern Editor it does not deduplicate the notes automatically anymore.

I guess this only happens when using all-notes, rather than selected notes. SInce it's unexpected perhaps it's better to just make it a selection-only operation? Perhaps also disabling the menu option when there's no selection?

theGreatWhiteShark commented 11 months ago

I guess this only happens when using all-notes, rather than selected notes. SInce it's unexpected perhaps it's better to just make it a selection-only operation? Perhaps also disabling the menu option when there's no selection?

I would be very much in favor of making "randomize velocity" and "fill notes" selection-only operations and to move them into the context menu opening when right clicking the pattern editor. I think it is both quite helpful and more clear. With your recent Pattern Editor UX update these old per-instrument operations feel kinda out of place.

But in order to do so we have to slightly rethink mouse-based selection. When done using keyboard one can select arbitrary rectangle and could in general also provide operations to act on the empty space or whole area. But using the mouse only note selection is possible for now.

cme commented 10 months ago

I would be very much in favor of making "randomize velocity" and "fill notes" selection-only operations and to move them into the context menu opening when right clicking the pattern editor. I think it is both quite helpful and more clear. With your recent Pattern Editor UX update these old per-instrument operations feel kinda out of place.

But in order to do so we have to slightly rethink mouse-based selection. When done using keyboard one can select arbitrary rectangle and could in general also provide operations to act on the empty space or whole area. But using the mouse only note selection is possible for now.

Agreed, "randomize" should probably be a selection type operation. Perhaps some sort of "draw" type operation for "fill notes" might work?

theGreatWhiteShark commented 10 months ago

Agreed, "randomize" should probably be a selection type operation. Perhaps some sort of "draw" type operation for "fill notes" might work?

+1

But we do not need to have all of this in a single PR.

cme commented 10 months ago

But we do not need to have all of this in a single PR.

Aye. I've moved the randomisation into the pattern editor class and runs on selections now using the more generic note properties change UndoAction and deleted the redundant randomisation one. UndoActions still needs refactored, but not in this PR.

theGreatWhiteShark commented 10 months ago

Nice. I'll check it out tomorrow.

UndoActions still needs refactored, but not in this PR.

I'm doing a massive refactoring right now for #1849 (https://github.com/theGreatWhiteShark/hydrogen/tree/phil-current-drumkit). Unfortunately, I did not find a nice way to split it into smaller PRs without risking to give users a hard time who build from master in between.

It would be probably best to wait with the UndoAction refactoring until the other one is done.