Skip to content

Feature: Added new scales - #991

Merged
sapphire-arches merged 38 commits into
SynthstromAudible:communityfrom
soymonitus:monitus/new_scales
Jan 26, 2024
Merged

Feature: Added new scales#991
sapphire-arches merged 38 commits into
SynthstromAudible:communityfrom
soymonitus:monitus/new_scales

Conversation

@soymonitus

@soymonitus soymonitus commented Jan 15, 2024

Copy link
Copy Markdown
Collaborator
  • Make scale detector give preference to any previously set scale if the notes contained in the sequencer clips properly match the scale (usefull for when you disable scale mode and then enable it again, you don’t want your scale to change because Deluge detected the majorness or minorness of it) => this is useful to protect 5-notes scales to be undesirably upgraded to a 7-note scale.
  • Modified Roli Lumi code to also cycle through transpositions of its supported scales, because some Deluge scales are equivalent to Lumi scales if you transpose them. So now we cycle through the 12 possible transpositions of a scale, updating root note in Lumi in case it is different from Deluge

TODO:

  • Fix bug when creating a new song and is initialized with a scale with less than 7 notes, root notes appear repeated till they fill 7 rows
  • Move scales with less than 7 notes to a community feature flag, so the transposing behavior is only removed if you include those => changed to not need feature flag as now all scales are transposed between each other

Make scale detector give preference to any previously set scale if the notes contained in the sequencer clips properly match the scale (usefull for when you disable scale and then enable it again, you don’t want your scale to change because Deluge detected the majorness or minorness of it), useful to protect 5-notes scales to be upgraded to a 7-note scale
@soymonitus
soymonitus marked this pull request as draft January 15, 2024 20:01
@soymonitus soymonitus changed the title Added new scales [Draft] Added new scales Jan 15, 2024
@soymonitus soymonitus changed the title [Draft] Added new scales Added new scales Jan 16, 2024
@soymonitus
soymonitus marked this pull request as ready for review January 16, 2024 23:29
@soymonitus

Copy link
Copy Markdown
Collaborator Author

Ready for review!

@mweigt

mweigt commented Jan 17, 2024

Copy link
Copy Markdown
Contributor

Removed the behavior of transposing all notes when you cycle through scales. As we now have scales with less than 7 notes, and could even have scales with 8 notes in the future, it is unfeasible to keep this "transposing" feature. Now, when you cycle through scales, the notes already entered remain in the same position (not transposed), and get hidden from the sequencer if they don't belong to the newly selected scale.

Hmm, I think having invisible notes (which, I presume would still get played) in the sequencer could be quite confusing...

Just as a thought - How about coloring out-of-scale notes differently? Conceptually like notes that are not on the current zoom level's timing grid, but of course not using the same color as for time-shifted notes - the obvious choice would be the middle color between the adjacent notes, but the color difference might be too subtle to see.

@soymonitus

Copy link
Copy Markdown
Collaborator Author

I need to fix a bug when creating a new song initialized with a less-than-7-notes scale.

@soymonitus

soymonitus commented Jan 17, 2024

Copy link
Copy Markdown
Collaborator Author

Removed the behavior of transposing all notes when you cycle through scales. As we now have scales with less than 7 notes, and could even have scales with 8 notes in the future, it is unfeasible to keep this "transposing" feature. Now, when you cycle through scales, the notes already entered remain in the same position (not transposed), and get hidden from the sequencer if they don't belong to the newly selected scale.

Hmm, I think having invisible notes (which, I presume would still get played) in the sequencer could be quite confusing...

Just as a thought - How about coloring out-of-scale notes differently? Conceptually like notes that are not on the current zoom level's timing grid, but of course not using the same color as for time-shifted notes - the obvious choice would be the middle color between the adjacent notes, but the color difference might be too subtle to see.

I checked with other members and they found that possibility to have notes not be transposed when changing scale to be a plus.

If I keep the old transposing behavior, it would be totally impossible to change from a scale to another scale with fewer notes because then it is not clear which rows in the octave are transposed to which rows in the new octave set. Imagine you have notes in all the notes within an octave of a 7-note scale, and then you change to a blues scale (6-notes), what do I do with the extra row? I cannot delete it, and I cannot quantize and merge with another row, that would be worse. Hence the option to not transpose at all.
With the old inflexible implementation, as all scales are 7-notes you can safely do a conversion of all notes to new notes, the root note stays the same, the first note after the root note becomes the first note after the root note of the new scale, and so on. There is a 1:1 conversion.

When you create a song you would normally choose your scale at the beginning. If you ever want to change your scale, it would be up to you to edit your melody to the new notes. It happens that if you go out of scale mode, then move some notes up or down, when you press the scale button again, the Deluge will guess the new scale based on the notes present in the sequencer so it is not a big deal.

@mweigt

mweigt commented Jan 17, 2024

Copy link
Copy Markdown
Contributor

Sorry, my post was unclear, I not referrin to

the notes already entered remain in the same position (not transposed)

For which I understand the motivation when there are scales with different number of notes.

But I was referring to:

get hidden from the sequencer if they don't belong to the newly selected scale.

Which I understand as: The notes are still there, but as they are not in the current scale, they are not visible in the sequencer, but are audible. This, I would find very confusing. I hear notes playing, but I can not see them - unless I change out of scale mode, or into a scale that contains them, and then they suddenly pop up out of nowhere?

Thus, the idea to still display the out-of-scale notes, in an adjacent note row of the scale, but mark them by a different color (just as out-of-timing notes are not hidden, but displayed on the nearest grid pad in a special color). This way, they could still be seen, and edited, even when not belonging to the scale. I think this would be a valuable addition, even with the existing scales, as it would allow staying in scale mode, while occasionally "borrowing" a note from out-of scale (which is how a lot of music is composed).

@soymonitus
soymonitus marked this pull request as draft January 17, 2024 09:29
@soymonitus soymonitus changed the title Added new scales [Draft] Added new scales Jan 17, 2024
@mweigt

mweigt commented Jan 17, 2024

Copy link
Copy Markdown
Contributor

To be even more annoying (Sorry!):

As we now have scales with less than 7 notes, and could even have scales with 8 notes in the future, it is unfeasible to keep this "transposing" feature. Now, when you cycle through scales, the notes already entered remain in the same position (not transposed)

What if there were two options available to the user (mabye discerned by holding shift):
a) Only allow changing to scales that have the same number of notes as the current one, and transposing notes accordingly
b) Allow changing to any scale, but not transposing

I think both have their uses, but a) is one of those happy-accident machines that I would strongly prefer not to lose! Writing a melody or harmony and then changing scales is just so much fun!

Important point:

This is definitely easier to implement than my idea with the colored off-scale notes!
b) is what you just implemented, and
a) is the old Deluge behaviour plus categorizing scales by number of notes...

@soymonitus
soymonitus marked this pull request as ready for review January 19, 2024 12:50
@soymonitus

soymonitus commented Jan 19, 2024

Copy link
Copy Markdown
Collaborator Author

@PaulFreund @m-m-adams @m0r172 I have revamped the implementation to allow for intelligent/conditional transposition. No more need for community feature setting.
All scales are ordered in descending order, first the 7-note scales, then the 6-note scales, then the 5-note scales. The default scale in settings is saved with offsets for these 3 groups so we can add more 7 and 6 note scales in between in the future with backwards compatibility.
As you cycle through scales, the notes present in clips are taken into account to allow to go from a scale to another one with fewer notes, and you can only go to that one if there are not more notes than it can fit. If you for example are in the BLUES scale (6 notes) and click the Shift+ scale button to go to PENTATONIC, you will go there if you have entered notes in just 5 of the 6 rows (among all clips). If you are occupying all rows, you will omit all 5-note scales and clicking Shift+ scale will take you to the start of the list (Major).

@sapphire-arches sapphire-arches left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 minor style nit and maybe something we can improve on the flash storage, otherwise this looks OK architecturally.

}
FlashStorage::defaultScale = v;
}
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style nit: newline here

Comment thread src/deluge/storage/flash_storage.cpp Outdated
defaultKeyMenu.upper = buffer[58];

defaultScale = buffer[59];
defaultScale = buffer[148];

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should read the old location and leave a tombstone value (e.g. 0xff), using the new location if the old location contains the tombstone.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, I'm assuming you're moving locations to have a larger datatype? But that isn't necessary for now so maybe finding a way to re-use the existing location would be ideal

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about checking for firmware version? The thing is that RANDOM and NONE are adjacent to the existing scales so that doesn't allow us to insert more scales in the middle. Now that I moved Random and None to the end (254 and 255) to have free space for new scales, I need to use a different FlashStorage slot as if we use the existing one, and a user loads the official firmware on top of the community one, he will get rubbish from the presetScaleNotes array, pointing to bad memory places. I added different locations for 7, 6 and 5 note scales as then we can add more scales in the future, have them in order, and have the saved flashstorage be still valid when you upgrade firmware. I will add extra code to check for out of bounds indexes to reset it back to 0, in case the user downgrades to a previous community version with less scales.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To avoid crashing the official firmware we could consider the selection "NONE" as a tombstone value for the old slot. So if the user goes back to official firmware they will have None as selected default scale, if they change it to something else (like Minor or Dorian or whatever), and then later install the community firmware again, we recover that value again to the new slot, and write None again in the old slot

- Small formatting nit
- Import old scale value when reading settings. Write a tombstone value to it so it is not read anymore (will be “NONE”)
@soymonitus

Copy link
Copy Markdown
Collaborator Author

@sapphire-arches I have added code to import the old value into the new slot. I decided to use the scale NONE as the detected tombstone value, to avoid crashing official firmware if you downgrade.

@soymonitus soymonitus changed the title Added new scales Feature: Added new scales Jan 23, 2024
@sapphire-arches
sapphire-arches added this pull request to the merge queue Jan 26, 2024
Merged via the queue into SynthstromAudible:community with commit e85eec9 Jan 26, 2024
@soymonitus
soymonitus deleted the monitus/new_scales branch January 26, 2024 08:33
tastycode pushed a commit to tastycode/DelugeFirmware that referenced this pull request Jul 3, 2024
* Added new scales

Make scale detector give preference to any previously set scale if the notes contained in the sequencer clips properly match the scale (usefull for when you disable scale and then enable it again, you don’t want your scale to change because Deluge detected the majorness or minorness of it), useful to protect 5-notes scales to be upgraded to a 7-note scale

* Fix typo

* Clean names

* Remove similar scales to make them be 16

* dbt formt

* Fix to avoid preferring Other Scale when coming back to scale mode

* Don’t transpose notes when cycling through scales

* chore change comments

* Allow Lumi code to search for scales that might be equivalent but are transposed

* Lumi: Search all transpositions in an octave

* Update preset name

* And comment

* and scale notes

* dbt format

* Refactoring

* Fix typo

* Fix bug when creating new song and the scale was less than 7 notes

* dbt format

* Lots of fixes

Added runtime flag for enabling uneven length scales.
Bring back transposing scales notes when cycling through scales, if the runtime flag is off (default setting and default official behavior)
If the flag is On, we include the 6-note and 5-note scales in the list, and transposing scales notes is disabled when cycling through scales

* Use a new byte from flash storage for the Default Scale

as we now save RANDOM as 254 and NONE as 255, to leave space for future scales, and loading the default scale set from this build, from a official build can totally screw the note rows

* Remove feature flag

* Allow for backwards compatibility

* Implemented adaptative transposition between scales. If the new cycled scale cannot fit the number of notes from the clip, then you cycle to the beginning of the list

* nit

* Feedback from sapphire-arches

- Small formatting nit
- Import old scale value when reading settings. Write a tombstone value to it so it is not read anymore (will be “NONE”)

* Also import the old RANDOM scale index properly, and simplify logic

* Fix merge compile issues

* Dbt format

* Remove magic number
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants