Introduces two function families for introducing chromaticism in melodies #1097
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context
The contributions of this pull request are described in detail in an article submitted to ICLC 2025. The primary goal of this pull request is to make the related code available to reviewers in context, so that they can manipulate it and test it.
Content
This introduces two families of functions that aim at facilitating the use of chromaticism in melodies.
chromatiseBy
function, that introduces chromatic notes in between the anchor notes given in a pattern. The number of chromatic notes inserted (potentially 0, for no chromaticism, or a negative number, for a descending movement) is a patternable parameter.scaleMod
andscaleMods
functions.scaleMod
is a variant of thescale
function that takes a supplementary functional[a] -> [a]
parameter. This parameter is used to transform scales (represented as numbers lists), and allows to functionally transform the current scale.scaleMods
has a similar role but takes a list of functions rather than a single function.Other functions in this family include
getScaleMod
(used to buildscaleMod
the same waygetScale
is used to buildscale
), andraiseDegree
(s
) andlowerDegree
(s
) (meant to be passed as parameters toscaleMod
(s
), in order to raise/lower one or a range of degrees in a scale by a semitone).Merging
Besides the usual code reviews and implementation considerations, I am not entirely convinced by my naming choices and I think they should be discussed before merging.
scaleMod
is short for "scale modification", but themod
suffix sounds a little bit too much like "modulo" to my ears (especially given that thewhenmod
function exists). Any suggestions for a more Haskell-idiomatic suffix are very welcome.chromatiseBy
is fine enough in my opinion, but there might be some debate between a British vs an American-style spelling.