jsrmath / sharp11

Music theory multitool with a jazz focus
BSD 2-Clause "Simplified" License
335 stars 16 forks source link

Custom scales or integer scales? #10

Open DavidAPowers opened 6 years ago

DavidAPowers commented 6 years ago

I know I could easily hack the scale list, but being able to use arbitrary scale would make this even more useful. For example, the augmented scale has another version [m2 3 4 aug5 6].

It would also be quite useful to be able to deal with pitches as integers, for example a 9 note scale [0 1 3 4 5 7 8 9 11]

I'm willing to contribute, if that's useful.

jsrmath commented 6 years ago

Hi David,

Thanks for the feedback! I'm on vacation right now so can't look at this too extensively, but I like the idea of being able to load one's own scales. It gets tricky, because there are a couple of other things, like scale aliases and scale precedence, that are handled separately, so that all would need to be streamlined somehow to easily accommodate new scales.

There's also the issue of where these scales are declared. I think the best way to do it would be to have a function on the scale module withCustomScales that returns a new instance of the scale module to avoid having it be a mutation. Getting this right with everything else would be non-trivial. I might work on this at some point, but I'm not sure when. If you're feeling inspired and would like to give it a go, that would be great, but I tend to be a bit picky when it comes to stylistic things.

As for your second comment, the issue here is Sharp11 takes a very strict approach when it comes to spelling, so integer pitches don't fully specify a note. For example, from C is 6 an F# or a Gb?

DavidAPowers commented 6 years ago

Hi, regarding the second issue, from the point of view of doing more interesting theoretical operations on scales or harmonies, I would strongly suggest that you want a module that represents pitches as integers. And if you like a functional programming style a set or array of integers is quite easy to manipulate. Such a module could be added to the codebase with an adapter to take string input, and that would enable a larger set of theoretical operations to be performed. I understand this might not be of interest to you, but I was interested in doing some generative or computer assisted composition. If you did want to add some new functionality, I would be willing to help.

jsrmath commented 6 years ago

There is certainly a lot to be done in the realm of generative composition using numerical pitch classes. Working that into the current Sharp11 ecosystem, which is geared towards Western/jazz music theory, would be possible but challenging. My suggestion would be this. If you find features of Sharp11 to be useful to you, include it in your project and develop on top of it. If you find yourself thinking that you've written modules that are well suited to being part of the core Sharp11 library and are interested in merging, we could talk then. You also might be interested in checking out sharp11-improv if you haven't already.