ISF Logo   IS Forum
Forum Index Register Members List Events Mark Forums Read Help

Go Back   International Skeptics Forum » General Topics » History, Literature, and the Arts
 


Welcome to the International Skeptics Forum, where we discuss skepticism, critical thinking, the paranormal and science in a friendly but lively way. You are currently viewing the forum as a guest, which means you are missing out on discussing matters that are of interest to you. Please consider registering so you can gain full use of the forum features and interact with other Members. Registration is simple, fast and free! Click here to register today.
Tags music theory

Reply
Old 17th February 2018, 11:29 AM   #161
calebprime
moleman
 
calebprime's Avatar
 
Join Date: Jul 2006
Posts: 11,822
Now a key concept, contour. This can mean anything from a melody as an abstract pattern of Up and Down, to a numbered ranking of the notes for higher and lower.

Contour is key because it's an alternative to being too literal about your series.

Plus, it's actually precise, if thought of as a ranking system. One series can have the same contour as another -- and here's the important thing -- but the total span or range determines the strength of the connection: the smaller the range, the stronger the connection.

In other words, I can make any arbitary pitch-classes have the same contour, but not in a limited space.

The every-other system will show you, in the spacing of the columns, how tight the contour resemblances can be, and so how good the every-other self-sim is. If you mentally fit the column of the every-other series into an ascending chord/scale, the more compact the chord/scale, the tighter and better the contour-connections between the lines of the square. Again, Mallalieu is as compact as it gets.

Mallalieu is perfect, and every line has the same potential contour as every other, within the smallest possible space.

Contour is as powerful perceptually as specific intervals, if not more so. An out-of tune rendering of any song with the right overall contours is still recognizable.

Code:
C,  A,  C#, F,  E,  Bb, Ab, Eb, D,  B,  G,  F#
A,  F,  Bb, Eb, B,  F#, C,  C#, E,  Ab, D,  G
F,  Eb, F#, C#, Ab, G,  A,  Bb, B,  C,  E,  D
Eb, C#, G,  Bb, C,  D,  F,  F#, Ab, A,  B,  E
C#, Bb, D,  F#, A,  E,  Eb, G,  C,  F,  Ab, B
Bb, F#, E,  G,  F,  B,  C#, D,  A,  Eb, C,  Ab
F#, G,  B,  D,  Eb, Ab, Bb, E,  F,  C#, A,  C
G,  D,  Ab, E,  C#, C,  F#, B,  Eb, Bb, F,  A
D,  E,  C,  B,  Bb, A,  G,  Ab, C#, F#, Eb, F
E,  B,  A,  Ab, F#, F,  D,  C,  Bb, G,  C#, Eb
B,  Ab, F,  C,  G,  Eb, E,  A,  F#, D,  Bb, C#
Ab, C,  Eb, A,  D,  C#, B,  F,  G,  E,  F#, Bb
With today's series, it would be natural to play C,A,C#,F,E with a compact contour such as C3,A2,C#3,F3,E3, that is, 1,0,2,4,3. How small a span can I make the next line fit into that contour? The original span of that fragment was 8. A, F, Bb, Eb, B,, the next line, fits into a span of 10. Not excellent, but still possible to exploit the resemblance.

We need some slack in the columns, because otherwise there is only one series, Mallalieu, and that would be boring.

Power residue series of the type I've been trying tend to have a good first-part of the left-most column, then the second part tends to be sort of random. Again, the better the system, the smaller the span you can fit the whole column in in one direction. (Upward arpeggio.)

I've already generated what would be the best columns, expanding from the smallest (Mallalieu) to 7 times that size. Sadly, this is not a short-cut to generating the best and most interesting self-similar series.

Last edited by calebprime; 17th February 2018 at 12:07 PM.
calebprime is online now   Quote this post in a PM   Nominate this post for this month's language award Copy a direct link to this post Reply With Quote Back to Top
Old 17th February 2018, 01:33 PM   #162
calebprime
moleman
 
calebprime's Avatar
 
Join Date: Jul 2006
Posts: 11,822
We've discussed half of our dual (2) properties. That half has been regular spacing with irregular or inexact similarity.

The other half would be exact similarity with irregular spacing. We want series that just happen to have both properties.

Why? To see if there are any, and how many, and whether they are a good pool of series to compose with.

As far as I know, having one set of properties is logically independent of having the other set.

Again, with both sets of properties, a row then becomes interesting for its other properties such as cells, potential contours, harmonic direction or its lack, number and disposition of intervals, and possibly even some ineffable qualities -- you're not sure why, you just like it.

So let's look at the second set of properties -- exact with irregular spacing.

I've posted many lousy and quite a few so-so spacing diagrams.

The goal here is to find a nice tight regular spacing, then to turn the problem over to the computer to see if there is a family of other series that has the same property. This process is remarkably clear: If you get your permutation numbers wrong, you never get any result at all. Otherwise it quite dependably turns up some other series.

That way, our search for series at least turns up whole families, which greatly extends our powers: We can search among those, again, for something we like.

We're looking for a tight pattern with at most one big hole.

This is the usual mixed success. Patterns with more regularity are more exploitable for the process of motivic expansion or interpolation this technique offers, but this will suffice for illustration.

We find a possible solution with this series down a minor third, or p/9, and to make it start on C, we rotate to the 7th note (starting on 0.)

Our pattern is then 7,0,4,6,10,2,9,11,3,8,5,1.
Code:
.....................7..8..9..10.11.0..1..2..3..4..5..6
p/9/7:...............C  B  Ab E  Eb A  F# Bb D  C# G  F  
.....................c..............a...........c#....f...
..............................e...........bb..............
...........................ab....eb..........d............
........................b..........................g......
.......................................f#.................
Musically, how do we feel about this as a potential interpolation to the notes of our series? Could we add them gradually, as harmonies, or embellishments? Yes. When we're done interpolating, of course, we're back to a version of our row, except down a minor third.

How this works as a permutation when I return.

Last edited by calebprime; 17th February 2018 at 01:59 PM.
calebprime is online now   Quote this post in a PM   Nominate this post for this month's language award Copy a direct link to this post Reply With Quote Back to Top
Old 17th February 2018, 02:33 PM   #163
calebprime
moleman
 
calebprime's Avatar
 
Join Date: Jul 2006
Posts: 11,822
The way the application that 69dodge wrote works is that you enter the second line of a 2-line permutation, where the first line is 0 through 11, inclusive.

Code:
0	1	2	3	4	5	6	7	8	9	10	11
7	0	4	6	10	2	9	11	3	8	5	1
This means, 0 goes to 7, 7 goes to 11, 11 goes to 1, which goes back to 0. 2 goes to 4, 4 goes to 10, 10 goes to 5, which goes back to 2. 3 goes to 6, 6 to 9, 9 to 8, back to 3.

In one-line notation, this would be:

(0 7 11 1) (2 4 10 5) (3 6 9 8).

But that is to confuse things, because we don't need "complete orbits" here. I've been confusing my terms if I said this -- I really just meant that we need a complete transposition pattern with a tight-enough map with a consistent transposition.

What this really is saying is, when we measure the difference between position 0 of our transposition and the 7th note, can we find a consistent interval with this pattern?

I'm explaining this part rather worse than the other parts, because I'm a little vague about it and haven't thought it through. This is recent. At least it works. That is, the series it will find below will all have that self-similarity with that permutation pattern.

There seem to be 32 other solutions here at this perm. Let's pick one and see if the self-similarity pattern at the minor 3rd works with the same spacing, as it ought to.

Code:
P) permutation: 7,0,4,6,10,2,9,11,3,8,5,1
C) center interval of self-similarity: 3
I) invert test (use sums instead of differences): off
O) minimum number of occurrences of center: 10
D) maximum deviation from center: 11
S) maximum sum of all deviations: 12
F) fixed-position notes: 0:0
E) excluded cells within range: 
R) excluded intervals within range: 
A) filter original solution: on
B) filter permuted solution: off
X) permutation depth: 2
N) number of solutions to print: 5000
W) wrap: on

1) perform new full search
2) search within results of last full search
9) quit

enter choice: 1
working...
0 9 1 2 4 10 5 3 11 8 7 6 - 12 0 0
0 9 1 5 4 10 8 3 2 11 7 6 - 12 0 0
0 9 1 8 4 10 11 3 5 2 7 6 - 12 0 0
0 9 1 11 4 10 2 3 8 5 7 6 - 12 0 0
0 9 2 1 5 11 4 3 10 7 8 6 - 12 0 0
0 9 2 4 5 11 7 3 1 10 8 6 - 12 0 0
0 9 2 7 5 11 10 3 4 1 8 6 - 12 0 0
0 9 2 10 5 11 1 3 7 4 8 6 - 12 0 0
0 9 4 2 7 1 5 3 11 8 10 6 - 12 0 0
0 9 4 5 7 1 8 3 2 11 10 6 - 12 0 0
0 9 4 8 7 1 11 3 5 2 10 6 - 12 0 0
0 9 4 11 7 1 2 3 8 5 10 6 - 12 0 0
0 9 5 1 8 2 4 3 10 7 11 6 - 12 0 0
0 9 5 4 8 2 7 3 1 10 11 6 - 12 0 0
0 9 5 7 8 2 10 3 4 1 11 6 - 12 0 0
0 9 5 10 8 2 1 3 7 4 11 6 - 12 0 0
0 9 7 2 10 4 5 3 11 8 1 6 - 12 0 0
0 9 7 5 10 4 8 3 2 11 1 6 - 12 0 0
0 9 7 8 10 4 11 3 5 2 1 6 - 12 0 0
0 9 7 11 10 4 2 3 8 5 1 6 - 12 0 0
0 9 8 1 11 5 4 3 10 7 2 6 - 12 0 0
0 9 8 4 11 5 7 3 1 10 2 6 - 12 0 0
0 9 8 7 11 5 10 3 4 1 2 6 - 12 0 0
0 9 8 10 11 5 1 3 7 4 2 6 - 12 0 0
0 9 10 2 1 7 5 3 11 8 4 6 - 12 0 0
0 9 10 5 1 7 8 3 2 11 4 6 - 12 0 0
0 9 10 8 1 7 11 3 5 2 4 6 - 12 0 0
0 9 10 11 1 7 2 3 8 5 4 6 - 12 0 0
0 9 11 1 2 8 4 3 10 7 5 6 - 12 0 0
0 9 11 4 2 8 7 3 1 10 5 6 - 12 0 0
0 9 11 7 2 8 10 3 4 1 5 6 - 12 0 0
0 9 11 10 2 8 1 3 7 4 5 6 - 12 0 0
found 32 solutions.

Picking this one arbitrarily: 0 9 10 5 1 7 8 3 2 11 4 6 - 12 0 0

as we can see, the pattern at the minor 3rd is the same. If we happen to like our pattern
now we have many more series that also follows that pattern.

Code:
0	1	2	3	4	5	6	7	8	9	10	11
7	0	4	6	10	2	9	11	3	8	5	1

.....................7..8..9..10.11.0..1..2..3..4..5..6
p/9/7:...............C  B  Ab E  Eb A  F# Bb D  C# G  F  
.....................c..............a...........c#....f...
..............................e...........bb..............
...........................ab....eb..........d............
........................b..........................g......
.......................................f#.................


Here's our new example:

p/0/0:...............C  A  Bb F  C# G  Ab Eb D  B  E  F# 


p/9/7:...............C  B  Ab C# Eb A  F# G  D  Bb E  F  
.....................C..............a...........bb....f..
..............................c#..........g..............
...........................ab....eb..........d...........
........................b..........................e.....
.......................................f#

Last edited by calebprime; 17th February 2018 at 02:41 PM.
calebprime is online now   Quote this post in a PM   Nominate this post for this month's language award Copy a direct link to this post Reply With Quote Back to Top
Old 18th February 2018, 04:52 AM   #164
calebprime
moleman
 
calebprime's Avatar
 
Join Date: Jul 2006
Posts: 11,822
A few general words before getting back to cases.

First of all, if you want to discuss techniques for composition, you're in a diffferent conversation, with different intent, than program notes or music criticism for the public. George Bernard Shaw's parody of a musical analysis of Hamlet's soliloquy is funny but it's not the point. If you want to talk about nuts and bolts, you use the best language you can for that.

Now, traditional terms of harmonic analysis are fairly creaky by now and often cumbersome when they mean much at all. Using them almost makes thinking more difficult rather than easier.

So the best people speak a mixed pidgin. This should not cause confusion because all parties are presumably visualizing things properly in some notation, or on some fretboard, and hearing the result either out loud or internally in their imaginations. (I once knew an overbearing behaviourist (is there any other kind?) who insisted that this "internal hearing" was impossible. So much for Beethoven.)

You know enough about figured bass, counterpoint, jazz, and atonal theory to be able to jump back and forth between terms. Maybe you add a knowledge of frequency ratios and modes to the mix, as do I.

But whatever it is we're studying -- whether fugue or 12-tone music, we need technical terms to be able to communicate, and from the outside this may look like jargon.

Jargon should be reduced as much as possible to simpler terms with more obvious meanings. And some errors must be avoided, such as referring to pitch-sets by their Forte numbers, instead of just naming them directly: 0134 is all you need. You don't need to know what number Forte assigned to it -- that's a completely arbitrary, meaningless number. You might as well call 0134 "Fred" for all the good Forte numbers do.

Contrast this with the language of ratios, which are the more beautiful for embodying the relationship they name. A 3/2 ratio is a much, much more insightful name for a "perfect fifth". But you should know both, if you want that level of insight.

Moleman, has, in recent years, ventured above ground long enough to buy much of the latest crop of books on serialism.

I'll mention three of them.

Moderately inspiring: __Twelve Tone Music in America__ -- Strauss.
__The Twelve-Tone Music of Luigi Dallappiccola__ Alegant

Moderately uninspiring: __Serialism__ Arnold Whittall.


The first two inspire because they are mainly the accounts of the personal techniques arrived at by individual composers. Dallappiccola had some interest in permutation.

The Whittall book is poor fodder for a composer because it's too concerned with all the fads and "issues" and politics and rhetoric; and historical discussions like this for some reason never seem to be informed by a discerning taste. Only self-proclaimed cultural conservatives ever seem to want to introduce notions of taste or limits. Historians have to be as interested in all the extravagent ******** of Stockhausen. (Who wasn't always bad, but his serial music is indifferent, and his concrete stuff far better.)

This relates to the effect of too much history on the composer. You can't, as a composer, take on the whole history of music and solve its problems once and for all. Believe me, I've met a number of young composers who have tried. Feeling the weight of history too much leads to Dada and other b.s.

Instead, you need to be informed, and then you need to choose some sustainable way of working that's congenial for you.

What I find pitiful is some of the reports of young composers who employ this or that novel homegrown frivolous technique -- simply because they were too ignorant to take on board what generations of previous composers have learned. That makes for cute press and shallow music.

But enough. This thread is about cases and techniques for finding them. Any further general discussion should go elsewhere.

Somehow, remain a composer without ignoring or being crushed by history.

Last edited by calebprime; 18th February 2018 at 04:55 AM.
calebprime is online now   Quote this post in a PM   Nominate this post for this month's language award Copy a direct link to this post Reply With Quote Back to Top
Old 18th February 2018, 06:13 AM   #165
calebprime
moleman
 
calebprime's Avatar
 
Join Date: Jul 2006
Posts: 11,822
I dislike cars and everything they've led to. Get rid of cars and guns (and beef for good measure) and you've gotten rid of a large chunk of stupid in our society. I love a good steak.

All the more reason to name today's series Four on the Floor.

The previous posts having provided explanation, maybe this will be clear to some by now:

Code:
Four on the Floor

C,  E,  F,  Ab, Eb, A,  B,  C#, Bb, G,  F#, D
E,  Ab, A,  C#, G,  D,  C,  F,  Eb, B,  Bb, F#
Ab, C#, D,  F,  B,  F#, E,  A,  G,  C,  Eb, Bb
C#, F,  F#, A,  C,  Bb, Ab, D,  B,  E,  G,  Eb
F,  A,  Bb, D,  E,  Eb, C#, F#, C,  Ab, B,  G
A,  D,  Eb, F#, Ab, G,  F,  Bb, E,  C#, C,  B
D,  F#, G,  Bb, C#, B,  A,  Eb, Ab, F,  E,  C
F#, Bb, B,  Eb, F,  C,  D,  G,  C#, A,  Ab, E
Bb, Eb, C,  G,  A,  E,  F#, B,  F,  D,  C#, Ab
Eb, G,  E,  B,  D,  Ab, Bb, C,  A,  F#, F,  C#
G,  B,  Ab, C,  F#, C#, Eb, E,  D,  Bb, A,  F
B,  C,  C#, E,  Bb, F,  G,  Ab, F#, Eb, D,  A

column: 4,4,5,4,4,5,4,4,5,4,4,1






C,  E,  F,  Ab, Eb, A,  B,  C#, Bb, G,  F#, D
Ab, C,  C#, E,  B,  F,  G,  A,  F#, Eb, D,  Bb
G,  B,  C,  Eb, Bb, E,  F#, Ab, F,  D,  C#, A
E,  Ab, A,  C,  G,  C#, Eb, F,  D,  B,  Bb, F#
A,  C#, D,  F,  C,  F#, Ab, Bb, G,  E,  Eb, B
Eb, G,  Ab, B,  F#, C,  D,  E,  C#, Bb, A,  F
C#, F,  F#, A,  E,  Bb, C,  D,  B,  Ab, G,  Eb
B,  Eb, E,  G,  D,  Ab, Bb, C,  A,  F#, F,  C#
D,  F#, G,  Bb, F,  B,  C#, Eb, C,  A,  Ab, E
F,  A,  Bb, C#, Ab, D,  E,  F#, Eb, C,  B,  G
F#, Bb, B,  D,  A,  Eb, F,  G,  E,  C#, C,  Ab
Bb, D,  Eb, F#, C#, G,  A,  B,  Ab, F,  E,  C


0   1   2   3   4   5   6   7   8   9   10  11
E,  Ab, A,  C,  G,  C#, Eb, F,  D,  B,  Bb, F#
................................d...........f#...
................g.......................bb.......
....................c#..............b............
........a...............eb.......................
....ab......................f....................
e...........c

3,0,7,1,6,2,9,5,10,4,11,8,

M) modulus: 12
P) permutation: 3,0,7,1,6,2,9,5,10,4,11,8
C) center interval of self-similarity: 4
I) invert test (use sums instead of differences): off
O) minimum number of occurrences of center: 10
D) maximum deviation from center: 11
S) maximum sum of all deviations: 12
F) fixed-position notes: 0:0
E) excluded cells within range: 
R) excluded intervals within range: 
A) filter original solution: on
B) filter permuted solution: off
X) permutation depth: 2
N) number of solutions to print: 5000
W) wrap: on

1) perform new full search
2) search within results of last full search
9) quit

enter choice: 1
working...
0 8 1 4 2 9 6 5 3 10 7 11 - 12 0 0
0 8 1 4 2 9 6 5 7 10 11 3 - 12 0 0
0 8 1 4 2 9 6 5 11 10 3 7 - 12 0 0
0 8 1 4 3 9 7 5 2 11 6 10 - 12 0 0
0 8 1 4 3 9 7 5 6 11 10 2 - 12 0 0
0 8 1 4 3 9 7 5 10 11 2 6 - 12 0 0
0 8 1 4 6 9 10 5 3 2 7 11 - 12 0 0
0 8 1 4 6 9 10 5 7 2 11 3 - 12 0 0
0 8 1 4 6 9 10 5 11 2 3 7 - 12 0 0
0 8 1 4 7 9 11 5 2 3 6 10 - 12 0 0
0 8 1 4 7 9 11 5 6 3 10 2 - 12 0 0
0 8 1 4 7 9 11 5 10 3 2 6 - 12 0 0
0 8 1 4 10 9 2 5 3 6 7 11 - 12 0 0
0 8 1 4 10 9 2 5 7 6 11 3 - 12 0 0
0 8 1 4 10 9 2 5 11 6 3 7 - 12 0 0
0 8 1 4 11 9 3 5 2 7 6 10 - 12 0 0
0 8 1 4 11 9 3 5 6 7 10 2 - 12 0 0
0 8 1 4 11 9 3 5 10 7 2 6 - 12 0 0
0 8 2 4 1 10 5 6 3 9 7 11 - 12 0 0
0 8 2 4 1 10 5 6 7 9 11 3 - 12 0 0
0 8 2 4 1 10 5 6 11 9 3 7 - 12 0 0
0 8 2 4 3 10 7 6 1 11 5 9 - 12 0 0
0 8 2 4 3 10 7 6 5 11 9 1 - 12 0 0
0 8 2 4 3 10 7 6 9 11 1 5 - 12 0 0
0 8 2 4 5 10 9 6 3 1 7 11 - 12 0 0
0 8 2 4 5 10 9 6 7 1 11 3 - 12 0 0
0 8 2 4 5 10 9 6 11 1 3 7 - 12 0 0
0 8 2 4 7 10 11 6 1 3 5 9 - 12 0 0
0 8 2 4 7 10 11 6 5 3 9 1 - 12 0 0
0 8 2 4 7 10 11 6 9 3 1 5 - 12 0 0
0 8 2 4 9 10 1 6 3 5 7 11 - 12 0 0
0 8 2 4 9 10 1 6 7 5 11 3 - 12 0 0
0 8 2 4 9 10 1 6 11 5 3 7 - 12 0 0
0 8 2 4 11 10 3 6 1 7 5 9 - 12 0 0
0 8 2 4 11 10 3 6 5 7 9 1 - 12 0 0
0 8 2 4 11 10 3 6 9 7 1 5 - 12 0 0
0 8 3 4 1 11 5 7 2 9 6 10 - 12 0 0
0 8 3 4 1 11 5 7 6 9 10 2 - 12 0 0
0 8 3 4 1 11 5 7 10 9 2 6 - 12 0 0
0 8 3 4 2 11 6 7 1 10 5 9 - 12 0 0
0 8 3 4 2 11 6 7 5 10 9 1 - 12 0 0
0 8 3 4 2 11 6 7 9 10 1 5 - 12 0 0
0 8 3 4 5 11 9 7 2 1 6 10 - 12 0 0
0 8 3 4 5 11 9 7 6 1 10 2 - 12 0 0
0 8 3 4 5 11 9 7 10 1 2 6 - 12 0 0
0 8 3 4 6 11 10 7 1 2 5 9 - 12 0 0
0 8 3 4 6 11 10 7 5 2 9 1 - 12 0 0
0 8 3 4 6 11 10 7 9 2 1 5 - 12 0 0
0 8 3 4 9 11 1 7 2 5 6 10 - 12 0 0
0 8 3 4 9 11 1 7 6 5 10 2 - 12 0 0
0 8 3 4 9 11 1 7 10 5 2 6 - 12 0 0
0 8 3 4 10 11 2 7 1 6 5 9 - 12 0 0
0 8 3 4 10 11 2 7 5 6 9 1 - 12 0 0
0 8 3 4 10 11 2 7 9 6 1 5 - 12 0 0
0 8 5 4 2 1 6 9 3 10 7 11 - 12 0 0
0 8 5 4 2 1 6 9 7 10 11 3 - 12 0 0
0 8 5 4 2 1 6 9 11 10 3 7 - 12 0 0
0 8 5 4 3 1 7 9 2 11 6 10 - 12 0 0
0 8 5 4 3 1 7 9 6 11 10 2 - 12 0 0
0 8 5 4 3 1 7 9 10 11 2 6 - 12 0 0
0 8 5 4 6 1 10 9 3 2 7 11 - 12 0 0
0 8 5 4 6 1 10 9 7 2 11 3 - 12 0 0
0 8 5 4 6 1 10 9 11 2 3 7 - 12 0 0
0 8 5 4 7 1 11 9 2 3 6 10 - 12 0 0
0 8 5 4 7 1 11 9 6 3 10 2 - 12 0 0
0 8 5 4 7 1 11 9 10 3 2 6 - 12 0 0
0 8 5 4 10 1 2 9 3 6 7 11 - 12 0 0
0 8 5 4 10 1 2 9 7 6 11 3 - 12 0 0
0 8 5 4 10 1 2 9 11 6 3 7 - 12 0 0
0 8 5 4 11 1 3 9 2 7 6 10 - 12 0 0
0 8 5 4 11 1 3 9 6 7 10 2 - 12 0 0
0 8 5 4 11 1 3 9 10 7 2 6 - 12 0 0
0 8 6 4 1 2 5 10 3 9 7 11 - 12 0 0
0 8 6 4 1 2 5 10 7 9 11 3 - 12 0 0
0 8 6 4 1 2 5 10 11 9 3 7 - 12 0 0
0 8 6 4 3 2 7 10 1 11 5 9 - 12 0 0
0 8 6 4 3 2 7 10 5 11 9 1 - 12 0 0
0 8 6 4 3 2 7 10 9 11 1 5 - 12 0 0
0 8 6 4 5 2 9 10 3 1 7 11 - 12 0 0
0 8 6 4 5 2 9 10 7 1 11 3 - 12 0 0
0 8 6 4 5 2 9 10 11 1 3 7 - 12 0 0
0 8 6 4 7 2 11 10 1 3 5 9 - 12 0 0
0 8 6 4 7 2 11 10 5 3 9 1 - 12 0 0
0 8 6 4 7 2 11 10 9 3 1 5 - 12 0 0
0 8 6 4 9 2 1 10 3 5 7 11 - 12 0 0
0 8 6 4 9 2 1 10 7 5 11 3 - 12 0 0
0 8 6 4 9 2 1 10 11 5 3 7 - 12 0 0
0 8 6 4 11 2 3 10 1 7 5 9 - 12 0 0
0 8 6 4 11 2 3 10 5 7 9 1 - 12 0 0
0 8 6 4 11 2 3 10 9 7 1 5 - 12 0 0
0 8 7 4 1 3 5 11 2 9 6 10 - 12 0 0
0 8 7 4 1 3 5 11 6 9 10 2 - 12 0 0
0 8 7 4 1 3 5 11 10 9 2 6 - 12 0 0
0 8 7 4 2 3 6 11 1 10 5 9 - 12 0 0
0 8 7 4 2 3 6 11 5 10 9 1 - 12 0 0
0 8 7 4 2 3 6 11 9 10 1 5 - 12 0 0
0 8 7 4 5 3 9 11 2 1 6 10 - 12 0 0
0 8 7 4 5 3 9 11 6 1 10 2 - 12 0 0
0 8 7 4 5 3 9 11 10 1 2 6 - 12 0 0
0 8 7 4 6 3 10 11 1 2 5 9 - 12 0 0
0 8 7 4 6 3 10 11 5 2 9 1 - 12 0 0
0 8 7 4 6 3 10 11 9 2 1 5 - 12 0 0
0 8 7 4 9 3 1 11 2 5 6 10 - 12 0 0
0 8 7 4 9 3 1 11 6 5 10 2 - 12 0 0
0 8 7 4 9 3 1 11 10 5 2 6 - 12 0 0
0 8 7 4 10 3 2 11 1 6 5 9 - 12 0 0
0 8 7 4 10 3 2 11 5 6 9 1 - 12 0 0
0 8 7 4 10 3 2 11 9 6 1 5 - 12 0 0
0 8 9 4 2 5 6 1 3 10 7 11 - 12 0 0
0 8 9 4 2 5 6 1 7 10 11 3 - 12 0 0
0 8 9 4 2 5 6 1 11 10 3 7 - 12 0 0
0 8 9 4 3 5 7 1 2 11 6 10 - 12 0 0
0 8 9 4 3 5 7 1 6 11 10 2 - 12 0 0
0 8 9 4 3 5 7 1 10 11 2 6 - 12 0 0
0 8 9 4 6 5 10 1 3 2 7 11 - 12 0 0
0 8 9 4 6 5 10 1 7 2 11 3 - 12 0 0
0 8 9 4 6 5 10 1 11 2 3 7 - 12 0 0
0 8 9 4 7 5 11 1 2 3 6 10 - 12 0 0
0 8 9 4 7 5 11 1 6 3 10 2 - 12 0 0
0 8 9 4 7 5 11 1 10 3 2 6 - 12 0 0
0 8 9 4 10 5 2 1 3 6 7 11 - 12 0 0
0 8 9 4 10 5 2 1 7 6 11 3 - 12 0 0
0 8 9 4 10 5 2 1 11 6 3 7 - 12 0 0
0 8 9 4 11 5 3 1 2 7 6 10 - 12 0 0
0 8 9 4 11 5 3 1 6 7 10 2 - 12 0 0
0 8 9 4 11 5 3 1 10 7 2 6 - 12 0 0
0 8 10 4 1 6 5 2 3 9 7 11 - 12 0 0
0 8 10 4 1 6 5 2 7 9 11 3 - 12 0 0
0 8 10 4 1 6 5 2 11 9 3 7 - 12 0 0
0 8 10 4 3 6 7 2 1 11 5 9 - 12 0 0
0 8 10 4 3 6 7 2 5 11 9 1 - 12 0 0
0 8 10 4 3 6 7 2 9 11 1 5 - 12 0 0
0 8 10 4 5 6 9 2 3 1 7 11 - 12 0 0
0 8 10 4 5 6 9 2 7 1 11 3 - 12 0 0
0 8 10 4 5 6 9 2 11 1 3 7 - 12 0 0
0 8 10 4 7 6 11 2 1 3 5 9 - 12 0 0
0 8 10 4 7 6 11 2 5 3 9 1 - 12 0 0
0 8 10 4 7 6 11 2 9 3 1 5 - 12 0 0
0 8 10 4 9 6 1 2 3 5 7 11 - 12 0 0
0 8 10 4 9 6 1 2 7 5 11 3 - 12 0 0
0 8 10 4 9 6 1 2 11 5 3 7 - 12 0 0
0 8 10 4 11 6 3 2 1 7 5 9 - 12 0 0
0 8 10 4 11 6 3 2 5 7 9 1 - 12 0 0
0 8 10 4 11 6 3 2 9 7 1 5 - 12 0 0
0 8 11 4 1 7 5 3 2 9 6 10 - 12 0 0
0 8 11 4 1 7 5 3 6 9 10 2 - 12 0 0
0 8 11 4 1 7 5 3 10 9 2 6 - 12 0 0
0 8 11 4 2 7 6 3 1 10 5 9 - 12 0 0
0 8 11 4 2 7 6 3 5 10 9 1 - 12 0 0
0 8 11 4 2 7 6 3 9 10 1 5 - 12 0 0
0 8 11 4 5 7 9 3 2 1 6 10 - 12 0 0
0 8 11 4 5 7 9 3 6 1 10 2 - 12 0 0
0 8 11 4 5 7 9 3 10 1 2 6 - 12 0 0
0 8 11 4 6 7 10 3 1 2 5 9 - 12 0 0
0 8 11 4 6 7 10 3 5 2 9 1 - 12 0 0
0 8 11 4 6 7 10 3 9 2 1 5 - 12 0 0
0 8 11 4 9 7 1 3 2 5 6 10 - 12 0 0
0 8 11 4 9 7 1 3 6 5 10 2 - 12 0 0
0 8 11 4 9 7 1 3 10 5 2 6 - 12 0 0
0 8 11 4 10 7 2 3 1 6 5 9 - 12 0 0
0 8 11 4 10 7 2 3 5 6 9 1 - 12 0 0
0 8 11 4 10 7 2 3 9 6 1 5 - 12 0 0

found 162 solutions.
===============================================================================

Last edited by calebprime; 18th February 2018 at 06:14 AM.
calebprime is online now   Quote this post in a PM   Nominate this post for this month's language award Copy a direct link to this post Reply With Quote Back to Top
Old 18th February 2018, 09:54 AM   #166
calebprime
moleman
 
calebprime's Avatar
 
Join Date: Jul 2006
Posts: 11,822
There's some work to be done reconciling the various finds and getting rid of dupes and near-dupes.

But today's insight is that I ought to look much harder at these groups of solutions that the computer is finding. They all seem to be based on the same column.

For a given good column, collect and analyze the other solutions! They're not just extra gravy.
calebprime is online now   Quote this post in a PM   Nominate this post for this month's language award Copy a direct link to this post Reply With Quote Back to Top
Old 18th February 2018, 10:06 AM   #167
calebprime
moleman
 
calebprime's Avatar
 
Join Date: Jul 2006
Posts: 11,822
Good idea.

The 2 best series from the previous group of 162, all with excellent columns:

Code:
C,  Ab, Db, E,  Bb, A,  D,  F,  B,  F#, Eb, G
Ab, E,  A,  F,  F#, G,  C,  Db, Bb, D,  B,  Eb
E,  F,  G,  Db, D,  Eb, Ab, A,  F#, C,  Bb, B
F,  Db, Eb, A,  C,  B,  E,  G,  D,  Ab, F#, Bb
Db, A,  B,  G,  Ab, Bb, F,  Eb, C,  E,  D,  F#
A,  G,  Bb, Eb, E,  F#, Db, B,  Ab, F,  C,  D
G,  Eb, F#, B,  F,  D,  A,  Bb, E,  Db, Ab, C
Eb, B,  D,  Bb, Db, C,  G,  F#, F,  A,  E,  Ab
B,  Bb, C,  F#, A,  Ab, Eb, D,  Db, G,  F,  E
Bb, F#, Ab, D,  G,  E,  B,  C,  A,  Eb, Db, F
F#, D,  E,  C,  Eb, F,  Bb, Ab, G,  B,  A,  Db
D,  C,  F,  Ab, B,  Db, F#, E,  Eb, Bb, G,  A


C,  Ab, Db, E,  G,  A,  B,  F,  D,  Eb, F#, Bb
Ab, E,  A,  F,  Eb, Bb, C,  Db, G,  B,  D,  F#
E,  F,  Bb, Db, B,  F#, Ab, A,  Eb, C,  G,  D
F,  Db, F#, A,  C,  D,  E,  Bb, B,  Ab, Eb, G
Db, A,  D,  Bb, Ab, G,  F,  F#, C,  E,  B,  Eb
A,  Bb, G,  F#, E,  Eb, Db, D,  Ab, F,  C,  B
Bb, F#, Eb, D,  F,  B,  A,  G,  E,  Db, Ab, C
F#, D,  B,  G,  Db, C,  Bb, Eb, F,  A,  E,  Ab
D,  G,  C,  Eb, A,  Ab, F#, B,  Db, Bb, F,  E
G,  Eb, Ab, B,  Bb, E,  D,  C,  A,  F#, Db, F
Eb, B,  E,  C,  F#, F,  G,  Ab, Bb, D,  A,  Db
B,  C,  F,  Ab, D,  Db, Eb, E,  F#, G,  Bb, A

And don't neglect to consider any of the lines in these squares as potential series!


-- Slight correction! The columns are not the same, but they're all based on 4 groups of augmented chords, so they're all at least pretty good, I think. Further research needed.

Last edited by calebprime; 18th February 2018 at 10:09 AM.
calebprime is online now   Quote this post in a PM   Nominate this post for this month's language award Copy a direct link to this post Reply With Quote Back to Top
Old 19th February 2018, 03:03 AM   #168
calebprime
moleman
 
calebprime's Avatar
 
Join Date: Jul 2006
Posts: 11,822
Before resuming that strand, I'm going to post some "can".

--Notes can be repeated.

--The series can be any length.

--The series can be mapped onto any pitch material.

--Non-canonic transformations (other than upside-down, shift, backwards, rotate) can be used

--Series can be combined in any way: Either to create a composite of all pitches ("the aggregate" -- to choose a bit of pompous jargon) or to do the opposite.

-------------------------

This license may be starting to sound a little like "anything goes, therefore let's all indulge in group improv, mutual wanking, or a big food-fight."


No, only computers, and Joe Morris in __Perpetual Frontier__ seem incapable of understanding. A "true" composer is someone who makes something of her freedom, something constructive. Stravinsky wrote some pieces with very short series. He seized his own freedom -- that's one of the many reasons he was good. There's a long tradition for writing with motives (series). It's called counterpoint.


There are consequences. If you're simply using "unordered collections" -- that is, treating your series like a scale-source, then you're not really using the series as a series. Nothing morally wrong with that, it's just missing a dimension, precisely the dimension of meaning offered by ordering.

You're free to do nothing and lie about it, or puff it up.

What complicates this clarity in real life is that everyone, but especially insecure composition students, wants to puff up her work and herself. You'd almost never hear another composer -- especially not a student -- admit that he had written a piece that was trivial from the motivic point of view. Such a student would probably suffer a nervous breakdown with that kind of self-doubt.

And, of course, every generation throws a hero up the pop charts.

We have to endure these little stories of personal triumph over orthodoxy, how Phil Glass studied with Boulanger, suffered under the iron fist of serial orthodoxy, and then courageously found his True Way.

Ok, Phil, but if I'd written the music you've written, I'd be very, very discouraged and sad about myself. To each his own, indeed.

Last edited by calebprime; 19th February 2018 at 03:10 AM.
calebprime is online now   Quote this post in a PM   Nominate this post for this month's language award Copy a direct link to this post Reply With Quote Back to Top
Old 19th February 2018, 03:43 AM   #169
calebprime
moleman
 
calebprime's Avatar
 
Join Date: Jul 2006
Posts: 11,822
Originally Posted by calebprime View Post
There's some work to be done reconciling the various finds and getting rid of dupes and near-dupes.

But today's insight is that I ought to look much harder at these groups of solutions that the computer is finding. They all seem to be based on the same column.

For a given good column, collect and analyze the other solutions! They're not just extra gravy.
Originally Posted by calebprime View Post
Good idea.

The 2 best series from the previous group of 162, all with excellent columns:

...

And don't neglect to consider any of the lines in these squares as potential series!


-- Slight correction! The columns are not the same, but they're all based on 4 groups of augmented chords, so they're all at least pretty good, I think. Further research needed.
Here are the intervals, mod12, of the first 6 of the 162 series in that list. This should suffice.

8,8,1,8,8,2,8,8,11,8,8,6
8,8,1,8,8,6,8,8,7,8,8,6
8,8,1,8,8,10,8,8,3,8,8,6
8,8,1,8,8,1,8,8,1,8,8,5
8,8,1,8,8,5,8,8,9,8,8,5
8,8,1,8,8,9,8,8,5,8,8,5


Without looking at each series by itself, it's not possible to know in advance which of these variations will make the best self-similarity. Here we want the numbers to be as close to 8 as consistently as possible, so this one is one of the better ones of the six: 8,8,1,8,8,6,8,8,7,8,8,6.


Long story short: Now, in this process, I'll examine some of these "extra" series. The two I posted upthread were unusually good from the pov of self-similarity, because both had something like 6 versions of good self-sim of the second type. The problem is that because the columns are not the same, the self-sim of the first type can suffer or disappear.
calebprime is online now   Quote this post in a PM   Nominate this post for this month's language award Copy a direct link to this post Reply With Quote Back to Top
Old 19th February 2018, 04:48 AM   #170
calebprime
moleman
 
calebprime's Avatar
 
Join Date: Jul 2006
Posts: 11,822
The list of distinct series has been cleaned up and reconciled. A few series that were too close to the others have been removed.

There are currently 41 distinct series with some self-similar properties in our collection.

Code:
                                       modulus: 12
         wolf intervals (between any two notes): ()
                     display multiple spellings: #f
    acceptable error when naming scales (cents): 0
                                     sort order: (rotation packing)
             abbreviated multiple-column output: #t
                                  output format: numbers
                       number of output columns: 3
                                     row length: 12
                                      bad cells: ()
                    maximum number of bad cells: 0
                                     good cells: ()
                   minimum number of good cells: 0
      bad intervals (between consecutive notes): ()
                maximum number of bad intervals: 0
     good intervals (between consecutive notes): ()
               minimum number of good intervals: 0
          minimum number of different intervals: 1
   maximum number of same consecutive intervals: 9
             self-equivalence filter - standard: #f
                   self-equivalence filter - 5m: #f
              self-equivalence filter tolerance: 0
                         remove near-duplicates: #t
                       near-duplicate tolerance: 4
         wrap when counting cells and intervals: #t
      virtual row length, for computing spacing: 12
                                   motif length: 1
     look for standard transformations of motif: #t
           look for 5m transformations of motif: #f
                                minimum spacing: 1
                                maximum spacing: 9
minimum number of violations of min/max spacing: 0
maximum number of violations of min/max spacing: 9
                     minimum number of 1-spaces: 0
                     maximum number of 1-spaces: 9
  minimum number of occurrences of motif in row: 0
                    wrap when computing spacing: #t
              maximum number of rows to display: 2000
               file of results to search within: /Users/calebmorgan/Desktop/MOFs and Searches/canon.txt

finding rows....done

number of rows found: 41

removing near-duplicates...done

number of rows remaining: 41

mof6B*                       mallalieu                    Double Aug                   
(0 1 3 9 4 7 11 2 10 5 8 6)  (0 1 4 2 9 5 11 3 8 10 7 6)  (0 1 5 9 2 8 7 11 3 10 4 6)  

AIS#12                       E for Effort                 Melvin-Lieben                
(0 1 7 2 4 8 6 3 11 5 10 9)  (0 1 7 2 10 8 4 3 6 11 5 9)  (0 1 9 2 4 10 8 3 6 5 7 11)  

5p equals                    Five Large                   Degenerate                   
(0 1 9 6 11 4 8 2 10 5 7 3)  (0 2 3 9 10 6 7 1 5 8 4 11)  (0 2 5 4 10 7 11 6 9 1 3 8)  

Too Tuesday                  La La Land                   (0 2 9 5 6 11 10 7 4 8 3 1)  
(0 2 8 4 5 10 1 6 3 7 9 11)  (0 2 9 4 1 11 5 7 10 3 8 6)                               

Usual Suspect                Octopussy                    Approved                     
(0 3 2 6 4 5 10 9 11 7 1 8)  (0 3 4 6 11 7 9 1 8 2 5 10)  (0 3 7 6 4 10 8 9 2 11 5 1)  

Q-tips                       row 1*                       Jejune                       
(0 3 8 4 7 9 1 6 5 10 2 11)  (0 3 8 10 7 11 5 1 4 2 9 6)  (0 3 10 7 8 1 4 2 6 11 9 5)  

Malevich the Jewel Thief     Old Fiends                   Ni of '73                    
(0 4 2 7 1 5 9 11 8 6 3 10)  (0 4 5 8 3 9 10 1 11 7 6 2)  (0 4 6 10 7 3 11 1 8 2 5 9)  

Gathering Ladma              Four-Nest                    CovFEfe                      
(0 4 7 8 1 11 9 3 10 5 6 2)  (0 4 10 6 1 2 7 8 11 3 9 5)  (0 5 4 10 1 9 7 3 8 6 11 2)  

Big Fockin' Deal             Donnie Wallboard             BC Perm                      
(0 5 8 10 4 1 11 3 7 9 2 6)  (0 5 11 10 8 4 6 3 7 1 2 9)  (0 7 2 1 4 9 5 8 6 10 3 11)  

Billy's Childe               Mu-tation                    o26/o27                      
(0 7 3 2 5 10 6 9 1 8 11 4)  (0 7 4 2 11 1 6 10 9 5 3 8)  (0 7 5 3 9 1 6 10 11 4 2 8)  

Cigar Bed                    Renuzit                      FlyTown                      
(0 7 9 11 4 2 5 10 8 6 1 3)  (0 8 2 3 5 10 7 11 6 1 4 9)  (0 8 5 3 6 1 7 11 10 2 4 9)  

Obvious Childe               Say I'm Sick                 mof3                         
(0 8 7 4 9 5 3 10 11 1 2 6)  (0 9 1 6 11 10 5 3 2 8 4 7)  (0 9 2 5 4 11 8 1 7 3 6 10)  

Big Cad                      Compromising Adult           First Example                
(0 9 2 6 1 11 7 3 4 10 5 8)  (0 9 4 3 6 11 10 8 2 7 1 5)  (0 10 2 3 6 7 4 1 9 11 5 8)  

Loose Girlfriend             Nigel's Amp                                               
(0 10 2 7 11 9 4 3 1 8 5 6)  (0 10 4 8 7 3 1 6 11 5 9 2)

Last edited by calebprime; 19th February 2018 at 04:51 AM.
calebprime is online now   Quote this post in a PM   Nominate this post for this month's language award Copy a direct link to this post Reply With Quote Back to Top
Old 19th February 2018, 09:11 AM   #171
calebprime
moleman
 
calebprime's Avatar
 
Join Date: Jul 2006
Posts: 11,822
I was thinking about wasting one's mental energies on fools, and how that is like bleeding out. A waste of one's life force.

Which provides the name of today's series: Roger "Gnocco" LeDuc

This has tested as distinct.

The generation is explained this post, next post I'll delve into the series.

Code:
C2,D#2,G2,B2,E3,A3,C#4,F#4,A#4,D5,F5,G#5


0 3 7 11 4 9 1 6 10 2 5 8

0 3 4 7 2 9 8 11 10 5 6 1


0,  3,  4,  7,  2,  9,  8,  11, 10, 5,  6,  1
3,  7,  9,  11, 5,  1,  0,  4,  2,  8,  10, 6
7,  11, 1,  4,  8,  6,  3,  9,  5,  0,  2,  10
11, 4,  6,  9,  0,  10, 7,  1,  8,  3,  5,  2
4,  9,  10, 1,  3,  2,  11, 6,  0,  7,  8,  5
9,  1,  2,  6,  7,  5,  4,  10, 3,  11, 0,  8
1,  6,  5,  10, 11, 8,  9,  2,  7,  4,  3,  0
6,  10, 8,  2,  4,  0,  1,  5,  11, 9,  7,  3
10, 2,  0,  5,  9,  3,  6,  8,  4,  1,  11, 7
2,  5,  3,  8,  1,  7,  10, 0,  9,  6,  4,  11
5,  8,  7,  0,  6,  11, 2,  3,  1,  10, 9,  4
8,  0,  11, 3,  10, 4,  5,  7,  6,  2,  1,  9


Roger "Gnocco" LeDuc

C,  Eb, E,  G,  D,  A,  Ab, B,  Bb, F,  F#, C#
Eb, G,  A,  B,  F,  C#, C,  E,  D,  Ab, Bb, F#
G,  B,  C#, E,  Ab, F#, Eb, A,  F,  C,  D,  Bb
B,  E,  F#, A,  C,  Bb, G,  C#, Ab, Eb, F,  D
E,  A,  Bb, C#, Eb, D,  B,  F#, C,  G,  Ab, F
A,  C#, D,  F#, G,  F,  E,  Bb, Eb, B,  C,  Ab
C#, F#, F,  Bb, B,  Ab, A,  D,  G,  E,  Eb, C
F#, Bb, Ab, D,  E,  C,  C#, F,  B,  A,  G,  Eb
Bb, D,  C,  F,  A,  Eb, F#, Ab, E,  C#, B,  G
D,  F,  Eb, Ab, C#, G,  Bb, C,  A,  F#, E,  B
F,  Ab, G,  C,  F#, B,  D,  Eb, C#, Bb, A,  E
Ab, C,  B,  Eb, Bb, E,  F,  G,  F#, D,  C#, A

Code:
number of rows remaining: 42

mof6B*                       mallalieu                    Double Aug                   
(0 1 3 9 4 7 11 2 10 5 8 6)  (0 1 4 2 9 5 11 3 8 10 7 6)  (0 1 5 9 2 8 7 11 3 10 4 6)  

AIS#12                       E for Effort                 Melvin-Lieben                
(0 1 7 2 4 8 6 3 11 5 10 9)  (0 1 7 2 10 8 4 3 6 11 5 9)  (0 1 9 2 4 10 8 3 6 5 7 11)  

5p equals                    Five Large                   Degenerate                   
(0 1 9 6 11 4 8 2 10 5 7 3)  (0 2 3 9 10 6 7 1 5 8 4 11)  (0 2 5 4 10 7 11 6 9 1 3 8)  

Too Tuesday                  La La Land                   (0 2 9 5 6 11 10 7 4 8 3 1)  
(0 2 8 4 5 10 1 6 3 7 9 11)  (0 2 9 4 1 11 5 7 10 3 8 6)                               

(0 3 1 6 10 4 8 9 5 2 11 7)  Usual Suspect                Octopussy                    
                             (0 3 2 6 4 5 10 9 11 7 1 8)  (0 3 4 6 11 7 9 1 8 2 5 10)  

Roger Gnocco LeDuc           Approved                     Q-tips                       
(0 3 4 7 2 9 8 11 10 5 6 1)  (0 3 7 6 4 10 8 9 2 11 5 1)  (0 3 8 4 7 9 1 6 5 10 2 11)  

row 1*                       Jejune                       Malevich the Jewel Thief     
(0 3 8 10 7 11 5 1 4 2 9 6)  (0 3 10 7 8 1 4 2 6 11 9 5)  (0 4 2 7 1 5 9 11 8 6 3 10)  

Old Fiends                   mof3                         Ni of '73                    
(0 4 5 8 3 9 10 1 11 7 6 2)  (0 4 6 3 8 11 10 5 2 7 1 9)  (0 4 6 10 7 3 11 1 8 2 5 9)  

Gathering Ladma              Four-Nest                    CovFEfe                      
(0 4 7 8 1 11 9 3 10 5 6 2)  (0 4 10 6 1 2 7 8 11 3 9 5)  (0 5 4 10 1 9 7 3 8 6 11 2)  

Big Fockin' Deal             Donnie Wallboard             BC Perm                      
(0 5 8 10 4 1 11 3 7 9 2 6)  (0 5 11 10 8 4 6 3 7 1 2 9)  (0 7 2 1 4 9 5 8 6 10 3 11)  

Billy's Childe               Mu-tation                    o26/o27                      
(0 7 3 2 5 10 6 9 1 8 11 4)  (0 7 4 2 11 1 6 10 9 5 3 8)  (0 7 5 3 9 1 6 10 11 4 2 8)  

Cigar Bed                    Renuzit                      FlyTown                      
(0 7 9 11 4 2 5 10 8 6 1 3)  (0 8 2 3 5 10 7 11 6 1 4 9)  (0 8 5 3 6 1 7 11 10 2 4 9)  

Obvious Childe               Say I'm Sick                 Big Cad                      
(0 8 7 4 9 5 3 10 11 1 2 6)  (0 9 1 6 11 10 5 3 2 8 4 7)  (0 9 2 6 1 11 7 3 4 10 5 8)  

First Example                Loose Girlfriend             Nigel's Amp                  
(0 10 2 3 6 7 4 1 9 11 5 8)  (0 10 2 7 11 9 4 3 1 8 5 6)  (0 10 4 8 7 3 1 6 11 5 9 2)
calebprime is online now   Quote this post in a PM   Nominate this post for this month's language award Copy a direct link to this post Reply With Quote Back to Top
Old 19th February 2018, 11:41 AM   #172
calebprime
moleman
 
calebprime's Avatar
 
Join Date: Jul 2006
Posts: 11,822
I've said previously that we use some displays to give us information, and that another benefit of the displays is that this information might be something that didn't occur to us immediately via intuition.

For example, the not-very-interesting example of Gershwin studying with Schillinger and from that realizing that he could derive one of his second themes from the inversion. The notion of the inversion gave him a solution.

Now, if some mysterious patron called and offered me millions of dollars to compose a piece with the row I've called "Gnocco", I'd want to work up the series with every possible variation that seemed to relate. The every-other square provides some variations that are, really, different series, but different series bound together in a system of simple relations.

With "Gnocco", contiguous 4-note chords are not to my taste -- they have the ultradissonant cluster 012. Here I've highlighted two 4-note chords containing an 012.

C, Eb, E, G, D, A, Ab, B, Bb, F, F#, C#

C, Eb, E, G, D, A, Ab, B, Bb, F, F#, C#


But if I like this as a member of the every-other square system, and I do, there are two different series available to me:

G, B, C#, E, Ab, F#, Eb, A, F, C, D, Bb
B, E, F#, A, C, Bb, G, C#, Ab, Eb, F, D


Where all the contiguous 4-note groups including wrap-around have no 012.

Again, whether this is "allowed" depends on whether you as composer can honestly say you hear a connection, and you're interested in these kinds of connections.

---------------
Oh, another can: You can use as small fragments of the series as you want. You're a grownup. There are trade-offs.
---------------

I have a tiresome interlocuter in mind from my teaching days, and he might feign astonishment. About those 012's, he would say, you can always get around that by...(passing-tones, voice-leading, registral separation, harmonic indifferentism, all the stupid responses). Right. You can't treat the original series as a robust automatic source of pretty 4-note harmonies. That's the simple point. This kid had the arrogance but not the ear. We will never hear from him again, or at least I hope not. I can't recall his name, which is fine. I remember the arguments. There were plenty of really talented students at NEC among the poseurs, and he wasn't one of them.

---------------

A very simple immediate application of the series is a sort of dragging-out of the harmonies by combining it with versions of the same series in a chorale or array-like structure.

Here are two, two "double canons". Many a piece of music has been based on something worse than just this:

Code:
r/6/11:..............F# G  C  B  E  F  D  Eb Ab C# Bb A  
r/6/0:...............G  C  B  E  F  D  Eb Ab C# Bb A  F# 
p/0/1:...............Eb E  G  D  A  Ab B  Bb F  F# C# C  
p/0/0:...............C  Eb E  G  D  A  Ab B  Bb F  F# C# 

r/6/11:..............F# G  C  B  E  F  D  Eb Ab C# Bb A  
r/6/10:..............A  F# G  C  B  E  F  D  Eb Ab C# Bb 
p/0/11:..............C# C  Eb E  G  D  A  Ab B  Bb F  F# 
p/0/0:...............C  Eb E  G  D  A  Ab B  Bb F  F# C#

Last edited by calebprime; 19th February 2018 at 11:56 AM.
calebprime is online now   Quote this post in a PM   Nominate this post for this month's language award Copy a direct link to this post Reply With Quote Back to Top
Old 20th February 2018, 03:18 AM   #173
calebprime
moleman
 
calebprime's Avatar
 
Join Date: Jul 2006
Posts: 11,822
0 3 1 6 5 4 11 9 2 8 10 7 -- name: Kix R 4 Trids

(From the joke, the punchline of which was: "Silly Rabbi, Kicks are for Trids!").

https://www.youtube.com/watch?v=U7ea6fx9SPQ

It's distinct to 4 places:

Code:
number of rows found: 43

removing near-duplicates...done

number of rows remaining: 43

mof6B*                       mallalieu                    Double Aug                   
(0 1 3 9 4 7 11 2 10 5 8 6)  (0 1 4 2 9 5 11 3 8 10 7 6)  (0 1 5 9 2 8 7 11 3 10 4 6)  

AIS#12                       E for Effort                 Melvin-Lieben                
(0 1 7 2 4 8 6 3 11 5 10 9)  (0 1 7 2 10 8 4 3 6 11 5 9)  (0 1 9 2 4 10 8 3 6 5 7 11)  

5p equals                    Five Large                   Degenerate                   
(0 1 9 6 11 4 8 2 10 5 7 3)  (0 2 3 9 10 6 7 1 5 8 4 11)  (0 2 5 4 10 7 11 6 9 1 3 8)  

Too Tuesday                  La La Land                   (0 2 9 5 6 11 10 7 4 8 3 1)  
(0 2 8 4 5 10 1 6 3 7 9 11)  (0 2 9 4 1 11 5 7 10 3 8 6)                               

Kix R 4 Trids                (0 3 1 6 10 4 8 9 5 2 11 7)  Usual Suspect                
(0 3 1 6 5 4 11 9 2 8 10 7)                               (0 3 2 6 4 5 10 9 11 7 1 8)  

Octopussy                    Roger Gnocco LeDuc           Approved                     
(0 3 4 6 11 7 9 1 8 2 5 10)  (0 3 4 7 2 9 8 11 10 5 6 1)  (0 3 7 6 4 10 8 9 2 11 5 1)  

Q-tips                       row 1*                       Jejune                       
(0 3 8 4 7 9 1 6 5 10 2 11)  (0 3 8 10 7 11 5 1 4 2 9 6)  (0 3 10 7 8 1 4 2 6 11 9 5)  

Malevich the Jewel Thief     Old Fiends                   mof3                         
(0 4 2 7 1 5 9 11 8 6 3 10)  (0 4 5 8 3 9 10 1 11 7 6 2)  (0 4 6 3 8 11 10 5 2 7 1 9)  

Ni of '73                    Gathering Ladma              Four-Nest                    
(0 4 6 10 7 3 11 1 8 2 5 9)  (0 4 7 8 1 11 9 3 10 5 6 2)  (0 4 10 6 1 2 7 8 11 3 9 5)  

CovFEfe                      Big Fockin' Deal             Donnie Wallboard             
(0 5 4 10 1 9 7 3 8 6 11 2)  (0 5 8 10 4 1 11 3 7 9 2 6)  (0 5 11 10 8 4 6 3 7 1 2 9)  

BC Perm                      Billy's Childe               Mu-tation                    
(0 7 2 1 4 9 5 8 6 10 3 11)  (0 7 3 2 5 10 6 9 1 8 11 4)  (0 7 4 2 11 1 6 10 9 5 3 8)  

o26/o27                      Cigar Bed                    Renuzit                      
(0 7 5 3 9 1 6 10 11 4 2 8)  (0 7 9 11 4 2 5 10 8 6 1 3)  (0 8 2 3 5 10 7 11 6 1 4 9)  

FlyTown                      Obvious Childe               Say I'm Sick                 
(0 8 5 3 6 1 7 11 10 2 4 9)  (0 8 7 4 9 5 3 10 11 1 2 6)  (0 9 1 6 11 10 5 3 2 8 4 7)  

Big Cad                      First Example                Loose Girlfriend             
(0 9 2 6 1 11 7 3 4 10 5 8)  (0 10 2 3 6 7 4 1 9 11 5 8)  (0 10 2 7 11 9 4 3 1 8 5 6)  

Nigel's Amp                                                                            
(0 10 4 8 7 3 1 6 11 5 9 2)

I've settled into a more-or-less systematic search. Rows that are distinct enough are getting harder and harder to find, which is why this title is a variation on "Kicks", because indeed, they keep getting harder to find.

https://www.youtube.com/watch?v=mOKZaDj4vxY (Paul Revere & t.r.) Some remarkable rhythm-git playing on this track!


Next post, I'll work this series up a little.

Last edited by calebprime; 20th February 2018 at 03:21 AM.
calebprime is online now   Quote this post in a PM   Nominate this post for this month's language award Copy a direct link to this post Reply With Quote Back to Top
Old 20th February 2018, 05:08 AM   #174
calebprime
moleman
 
calebprime's Avatar
 
Join Date: Jul 2006
Posts: 11,822
C, Eb, Db, Gb, F, E, B, A, D, Ab, Bb, G name: Kix R 4 Trids


I'll just use this series to make one point.

You can, of course, treat what look like chromatic passing-tones as exactly that, chromatic passing-tones; which, because they merely serve to bridge a gap between two more-important points, have no harmonic or structural weight.

You can strike them out:

C, Eb, Db, Gb, F, E, B, A, D, Ab, Bb, G

Which then chunks to: C,Eb,Db,Gb,E (C octotonic) and
E,D,Ab,Bb,G (E or G octotonic).

This makes for a pleasing and non-gnarly alternation of two related chords, if you like.

I'd like a big sign with a big red stripe through it: Modes of Limited Transposition

The French have their parochial stupidities, just as we do, I suppose.

Last edited by calebprime; 20th February 2018 at 05:11 AM.
calebprime is online now   Quote this post in a PM   Nominate this post for this month's language award Copy a direct link to this post Reply With Quote Back to Top
Old 20th February 2018, 08:25 AM   #175
calebprime
moleman
 
calebprime's Avatar
 
Join Date: Jul 2006
Posts: 11,822
I'm being surprised by how slight differences in the first stage turn into seemingly larger musical differences. It seems unpredictable what rows will be dupes of others. I like this one. I call it: Caress the Trees...Tendentiously

Code:
C2,D2,D#2,E2,F2,F#2,G2,G#2,A2,A#2,B2,C#3

0 2 3 4 5 6 7 8 9 10 11 1

0 2 5 3 10 6 1 4 9 11 8 7


0,  2,  5,  3,  10, 6,  1,  4,  9,  11, 8,  7
2,  3,  6,  4,  11, 7,  0,  5,  10, 1,  9,  8
3,  4,  7,  5,  1,  8,  2,  6,  11, 0,  10, 9
4,  5,  8,  6,  0,  9,  3,  7,  1,  2,  11, 10
5,  6,  9,  7,  2,  10, 4,  8,  0,  3,  1,  11
6,  7,  10, 8,  3,  11, 5,  9,  2,  4,  0,  1
7,  8,  11, 9,  4,  1,  6,  10, 3,  5,  2,  0
8,  9,  1,  10, 5,  0,  7,  11, 4,  6,  3,  2
9,  10, 0,  11, 6,  2,  8,  1,  5,  7,  4,  3
10, 11, 2,  1,  7,  3,  9,  0,  6,  8,  5,  4
11, 1,  3,  0,  8,  4,  10, 2,  7,  9,  6,  5
1,  0,  4,  2,  9,  5,  11, 3,  8,  10, 7,  6





C,  D,  F,  Eb, Bb, Gb, Db, E,  A,  B,  Ab, G
D,  Eb, Gb, E,  B,  G,  C,  F,  Bb, Db, A,  Ab
Eb, E,  G,  F,  Db, Ab, D,  Gb, B,  C,  Bb, A
E,  F,  Ab, Gb, C,  A,  Eb, G,  Db, D,  B,  Bb
F,  Gb, A,  G,  D,  Bb, E,  Ab, C,  Eb, Db, B
Gb, G,  Bb, Ab, Eb, B,  F,  A,  D,  E,  C,  Db
G,  Ab, B,  A,  E,  Db, Gb, Bb, Eb, F,  D,  C
Ab, A,  Db, Bb, F,  C,  G,  B,  E,  Gb, Eb, D
A,  Bb, C,  B,  Gb, D,  Ab, Db, F,  G,  E,  Eb
Bb, B,  D,  Db, G,  Eb, A,  C,  Gb, Ab, F,  E
B,  Db, Eb, C,  Ab, E,  Bb, D,  G,  A,  Gb, F
Db, C,  E,  D,  A,  F,  B,  Eb, Ab, Bb, G,  Gb

Caress the Trees...Tendentiously

C,  D,  F,  Eb, Bb, Gb, Db, E,  A,  B,  Ab, G
Bb, C,  Eb, Db, Ab, E,  B,  D,  G,  A,  Gb, F
G,  A,  C,  Bb, F,  Db, Ab, B,  E,  Gb, Eb, D
A,  B,  D,  C,  G,  Eb, Bb, Db, Gb, Ab, F,  E
D,  E,  G,  F,  C,  Ab, Eb, Gb, B,  Db, Bb, A
Gb, Ab, B,  A,  E,  C,  G,  Bb, Eb, F,  D,  Db
B,  Db, E,  D,  A,  F,  C,  Eb, Ab, Bb, G,  Gb
Ab, Bb, Db, B,  Gb, D,  A,  C,  F,  G,  E,  Eb
Eb, F,  Ab, Gb, Db, A,  E,  G,  C,  D,  B,  Bb
Db, Eb, Gb, E,  B,  G,  D,  F,  Bb, C,  A,  Ab
E,  Gb, A,  G,  D,  Bb, F,  Ab, Db, Eb, C,  B
F,  G,  Bb, Ab, Eb, B,  Gb, A,  D,  E,  Db, C
calebprime is online now   Quote this post in a PM   Nominate this post for this month's language award Copy a direct link to this post Reply With Quote Back to Top
Old 21st February 2018, 02:51 AM   #176
calebprime
moleman
 
calebprime's Avatar
 
Join Date: Jul 2006
Posts: 11,822
(0 4 2 7 6 5 1 10 3 9 11 8)
(0 4 2 7 8 6 3 10 5 11 1 9)
(0 2 5 3 10 6 1 4 9 11 8 7)
(0 2 7 4 1 8 5 6 11 3 10 9)
(0 3 11 6 10 2 4 9 8 1 7 5)


These are the new, distinct series, not yet named or worked up.

A little more on the last one, I think I'll call it Reality Check.


Code:
C2,D#2,F#2,A2,B2,D3,F3,G3,G#3,A#3,C#4,E4

0 3 6 9 11 2 5 7 8 10 1 4

0 3 11 6 10 2 4 9 8 1 7 5         distinct 

Reality Check

0,  3,  11, 6,  10, 2,  4,  9,  8,  1,  7,  5
3,  6,  2,  9,  1,  5,  0,  11, 10, 4,  8,  7
6,  9,  5,  11, 4,  7,  3,  2,  1,  0,  10, 8
9,  11, 7,  2,  0,  8,  6,  5,  4,  3,  1,  10
11, 2,  8,  5,  3,  10, 9,  7,  0,  6,  4,  1
2,  5,  10, 7,  6,  1,  11, 8,  3,  9,  0,  4
5,  7,  1,  8,  9,  4,  2,  10, 6,  11, 3,  0
7,  8,  4,  10, 11, 0,  5,  1,  9,  2,  6,  3
8,  10, 0,  1,  2,  3,  7,  4,  11, 5,  9,  6
10, 1,  3,  4,  5,  6,  8,  0,  2,  7,  11, 9
1,  4,  6,  0,  7,  9,  10, 3,  5,  8,  2,  11
4,  0,  9,  3,  8,  11, 1,  6,  7,  10, 5,  2


C,  Eb, B,  F#, Bb, D,  E,  A,  Ab, Db, G,  F
Eb, F#, D,  A,  Db, F,  C,  B,  Bb, E,  Ab, G
F#, A,  F,  B,  E,  G,  Eb, D,  Db, C,  Bb, Ab
A,  B,  G,  D,  C,  Ab, F#, F,  E,  Eb, Db, Bb
B,  D,  Ab, F,  Eb, Bb, A,  G,  C,  F#, E,  Db
D,  F,  Bb, G,  F#, Db, B,  Ab, Eb, A,  C,  E
F,  G,  Db, Ab, A,  E,  D,  Bb, F#, B,  Eb, C
G,  Ab, E,  Bb, B,  C,  F,  Db, A,  D,  F#, Eb
Ab, Bb, C,  Db, D,  Eb, G,  E,  B,  F,  A,  F#
Bb, Db, Eb, E,  F,  F#, Ab, C,  D,  G,  B,  A
Db, E,  F#, C,  G,  A,  Bb, Eb, F,  Ab, D,  B
E,  C,  A,  Eb, Ab, B,  Db, F#, G,  Bb, F,  D



Reality Check

C,  Eb, B,  F#, Bb, D,  E,  A,  Ab, Db, G,  F
A,  C,  Ab, Eb, G,  B,  Db, F#, F,  Bb, E,  D
Db, E,  C,  G,  B,  Eb, F,  Bb, A,  D,  Ab, F#
F#, A,  F,  C,  E,  Ab, Bb, Eb, D,  G,  Db, B
D,  F,  Db, Ab, C,  E,  F#, B,  Bb, Eb, A,  G
Bb, Db, A,  E,  Ab, C,  D,  G,  F#, B,  F,  Eb
Ab, B,  G,  D,  F#, Bb, C,  F,  E,  A,  Eb, Db
Eb, F#, D,  A,  Db, F,  G,  C,  B,  E,  Bb, Ab
E,  G,  Eb, Bb, D,  F#, Ab, Db, C,  F,  B,  A
B,  D,  Bb, F,  A,  Db, Eb, Ab, G,  C,  F#, E
F,  Ab, E,  B,  Eb, G,  A,  D,  Db, F#, C,  Bb
G,  Bb, F#, Db, F,  A,  B,  E,  Eb, Ab, D,  C
calebprime is online now   Quote this post in a PM   Nominate this post for this month's language award Copy a direct link to this post Reply With Quote Back to Top
Old 21st February 2018, 09:05 AM   #177
calebprime
moleman
 
calebprime's Avatar
 
Join Date: Jul 2006
Posts: 11,822
I did not know that!


Turns out it's some kinda 6-row cycle if you do the transformation repeatedly, output to input:

0 3 6 9 11 2 5 8 10 1 4 7

0 3 11 6 1 2 7 9 10 4 8 5 not distinct

0 3 1 11 4 2 5 6 10 8 9 7 You can keep scrambling without rep!

0 3 4 1 8 2 7 11 10 9 6 5

0 3 8 4 9 2 5 1 10 6 11 7

0 3 9 8 6 2 7 4 10 11 1 5

0 3 6 9 11 2 5 8 10 1 4 7 we've cycled around to the beginning

Further research needed to see if these later rows are good for anything.

Last edited by calebprime; 21st February 2018 at 09:06 AM.
calebprime is online now   Quote this post in a PM   Nominate this post for this month's language award Copy a direct link to this post Reply With Quote Back to Top
Old 21st February 2018, 09:18 AM   #178
calebprime
moleman
 
calebprime's Avatar
 
Join Date: Jul 2006
Posts: 11,822
current version of Microtonal Scales, I'm calling it Names.


To run this, download the Dr. Racket system, then do a 'create executable' under the Racket? pull-down window.



Code:
#lang racket/gui

(require racket/gui/base
         racket/random
;         racket/unsafe/ops
         (only-in rnrs/base-6 mod)
;         (only-in framework finder:get-file
;                            finder:put-file)
         )

(define-namespace-anchor namespace-anchor)
(define the-namespace (namespace-anchor->namespace namespace-anchor))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;(define-setting modulus 24)
;(define-setting length-min 5)  ; minimum number of notes in scale
;(define-setting length-max 8)  ; maximum number of notes in scale
;
;; wolf intervals, between any two notes in scale
;(define-setting wolves '(13 15))
;
;(define-setting wolf-max 5)  ; this many wolves are ok, but no more
;
;(define-setting distance-2-min 1) ; minimum difference between any 2 consecutive notes in scale
;(define-setting distance-3-min 3) ; minimum difference between the lowest and highest notes
;                                  ;   of any 3 consecutive notes in scale
;; never use these notes
;(define-setting bad-notes '(1 13 23))
;
;; Scale must not contain any of these cells.
;; Each cell is specified as a list of numbers.
;; The first number is the range, i.e., the number
;; of consecutive notes in the scale that are
;; considered together when checking for the presence
;; of the cell.  The rest of the numbers in the list
;; are the notes of the cell. 
;(define-setting bad-cells '((3 0 3 4)))
;
;; only these intervals are allowed between consecutive notes in scale
;; (but if the list is empty, all intervals are allowed)
;(define-setting allowed-intervals '(1 3 5))
;
;; #t : scale must contain at least one of each allowed interval
;; #f : scale need not contain every allowed interval
;(define-setting require-all-allowed-intervals #t)
;
;; #t : don't display scale if adding any note to it results in some other displayed scale
;; #f : do
;(define-setting require-completeness #t)
;
;; if you don't care about balance, set both balance-in-min and balance-out-min to 0
;(define-setting balance-notes '(0 2 4 6 8 10 12 14 16 18 20 22))
;(define-setting balance-in-min  1)  ; at least this many notes in scale must come from balance-notes
;(define-setting balance-out-min 3)  ; at least this many notes in scale must come from outside balance-notes
;
;; #t : display multiple spellings if they're all equally good
;; #f : never display more than one spelling
;(define-setting multiple-spellings #f)
;
;; if more than this number of scales are found,
;; don't display them by default
;(define-setting scales-max 100)
;
;; allowed values are: length packing wolves balance distance rotation
;; any number of them, in any order
;; earlier ones are more important than later ones
;; any of them may be immediately followed by an asterisk to indicate reverse order
;; for example, length* means longer first instead of the usual shorter first
;(define-setting sort-order '(packing))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(define settings '())

; the (set! symbol ...) is to convince the compiler that the variable is not constant,
; so that it can be changed later by copy-settings-from-gui-to-vars.
(define-syntax-rule (define-setting symbol label type default)
  (begin
    (define symbol 'whatever)
    (set! symbol 'whatever)
    (set! settings (cons (list 'symbol label 'type default) settings))))

(define setting-symbol first)
(define setting-label second)
(define setting-type third)
(define setting-default fourth)

(define-setting modulus                       "modulus:"                                         number       "24")
(define-setting wolves                        "wolf intervals (between any two notes):"          list         "13 15")
(define-setting multiple-spellings            "display multiple spellings:"                      boolean      #f)
(define-setting scale-tolerance               "acceptable error when naming scales (cents):"     number       "0")
(define-setting sort-order                    "sort order:"                                      list         "length rotation wolves packing")
(define-setting multi-column                  "abbreviated multiple-column output:"              boolean      #f)
(define-setting output-format                 "output format:"                                   choice       '("numbers" "letters" "intervals" "keyboard"))
(define-setting column-count                  "number of output columns:"                        number       "3")

(define-setting keyboard-notes-raw            "keyboard notes:"                                  list         "")
(define-setting first-note                    "first note of scale:"                             number       "0")
(define-setting length-min                    "minimum scale length:"                            number       "6")
(define-setting length-max                    "maximum scale length:"                            number       "8")
(define-setting wolf-min                      "minimum number of wolves:"                        number       "0")
(define-setting wolf-max                      "maximum number of wolves:"                        number       "1")
(define-setting bad-cells-raw                 "bad cells:"                                       list-of-list "(4 0 1 2)")
(define-setting bad-cell-max                  "maximum number of bad cells:"                     number       "0")
(define-setting good-cells-raw                "good cells:"                                      list-of-list "")
(define-setting good-cell-min                 "minimum number of good cells:"                    number       "0")
(define-setting distance-2-min                "minimum interval between consecutive notes:"      number       "2")
(define-setting distance-3-min                "minimum interval between alternate notes:"        number       "5")
(define-setting require-completeness          "require completeness:"                            boolean      #t)
(define-setting bad-intervals                 "bad intervals (between consecutive notes):"       list         "")
(define-setting bad-interval-max              "maximum number of bad intervals:"                 number       "0")
(define-setting good-intervals                "good intervals (between consecutive notes):"      list         "")
(define-setting good-interval-min             "minimum number of good intervals:"                number       "0")
(define-setting allowed-intervals             "allowed intervals between consecutive notes:"     list         "")
(define-setting require-all-allowed-intervals "require all allowed intervals:"                   boolean      #f)
(define-setting required-notes                "required notes:"                                  list         "")
(define-setting forbidden-notes               "forbidden notes:"                                 list         "1 13 15 23")
(define-setting balance-notes                 "balance notes:"                                   list         "0 2 4 6 8 10 12 14 16 18 20 22")
(define-setting balance-in-min                "minimum number of notes from balance:"            number       "1")
(define-setting balance-out-min               "minimum number of notes not from balance:"        number       "1")
(define-setting scales-max                    "maximum number of scales to display:"             number       "100")

(define-setting scale-contents2               "scale:"                                           string       "")
(define-setting scale-interpretation          "scale is specified as:"                           choice       '("notes" "intervals" "name"))
(define-setting reorder-notes                 "put notes in order before looking up name:"       boolean      #t)
(define-setting display-supersets             "display all known supersets of scale:"            boolean      #f)

(define-setting scale-contents3               "scale:"                                           list         "0")
(define-setting common-notes                  "allowed common notes:"                            list         "")
(define-setting max-additional-common-notes   "maximum number of additional common notes:"       number       "0")
(define-setting complement-source             "source of possible complements:"                  choice       '("the scale above" "all named scales"))

(define-setting motif                         "motif:"                                           list         "")
(define-setting multiplier-special            "evenly spaced multiplier:"                        boolean      #f)
(define-setting multiplier                    "multiplier:"                                      list         "0")
(define-setting multiplicand-order            "order of multiplication:"                         choice       '("motif times multiplier" "multiplier times motif" "both"))
(define-setting from-cycle                    "map from cycle:"                                  list         "1")
(define-setting to-cycle                      "map to cycle:"                                    list         "1")
(define-setting mm-order                      "order of operations:"                             choice       '("map, then multiply" "multiply, then map"))
(define-setting identify-results              "identify results:"                                boolean      #f)
(define-setting from-table                    "map from table:"                                  list-box     '())
(define-setting to-table                      "map to table:"                                    list-box     '())

(define-setting row-length                    "row length:"                                      number       "12")
(define-setting mof-bad-cells-raw             "bad cells:"                                       list-of-list "")
(define-setting mof-bad-cell-max              "maximum number of bad cells:"                     number       "0")
(define-setting mof-good-cells-raw            "good cells:"                                      list-of-list "")
(define-setting mof-good-cell-min             "minimum number of good cells:"                    number       "0")
(define-setting mof-bad-intervals             "bad intervals (between consecutive notes):"       list         "")
(define-setting mof-bad-interval-max          "maximum number of bad intervals:"                 number       "0")
(define-setting mof-good-intervals            "good intervals (between consecutive notes):"      list         "")
(define-setting mof-good-interval-min         "minimum number of good intervals:"                number       "0")
(define-setting distinct-interval-min         "minimum number of different intervals:"           number       "")
(define-setting interval-repetition-max       "maximum number of same consecutive intervals:"    number       "")
(define-setting self-eq-standard              "self-equivalence filter - standard:"              boolean      #t)
(define-setting self-eq-5m                    "self-equivalence filter - 5m:"                    boolean      #f)
(define-setting self-eq-tolerance             "self-equivalence filter tolerance:"               number       "0")
(define-setting filter-duplicates             "remove near-duplicates:"                          boolean      #f)
(define-setting duplicate-tolerance           "near-duplicate tolerance:"                        number       "0")
(define-setting wrap-row                      "wrap when counting cells and intervals:"          boolean      #t)
(define-setting spacing-row-length            "virtual row length, for computing spacing:"       number       "13")
(define-setting motif-length                  "motif length:"                                    number       "12")
(define-setting standard-transforms           "look for standard transformations of motif:"      boolean      #t)
(define-setting 5m-transforms                 "look for 5m transformations of motif:"            boolean      #f)
(define-setting spacing-min                   "minimum spacing:"                                 number       "")
(define-setting spacing-max                   "maximum spacing:"                                 number       "")
(define-setting spacing-error-min             "minimum number of violations of min/max spacing:" number       "0")
(define-setting spacing-error-max             "maximum number of violations of min/max spacing:" number       "0")
(define-setting 1-space-min                   "minimum number of 1-spaces:"                      number       "0")
(define-setting 1-space-max                   "maximum number of 1-spaces:"                      number       "0")
(define-setting motif-min                     "minimum number of occurrences of motif in row:"   number       "")
(define-setting wrap-spacing                  "wrap when computing spacing:"                     boolean      #t)
(define-setting rows-max                      "maximum number of rows to display:"               number       "100")
(define-setting results-file                  "file of results to search within:"                string       "")

(set! settings (reverse settings))

(define (padding str len)
  (make-string (- len (string-length str))
               #\space))

(define (setting-length s)
  (string-length (setting-label s)))

(define (display-setting s len)
  (let ((label (setting-label s)))
    (display (padding label len))
    (display label))
  (display #\space)
  (display (eval (setting-symbol s) the-namespace)))

(define first-setting
  (vector 'modulus 'keyboard-notes-raw 'scale-contents2 'scale-contents3 'motif 'row-length 'the-end))

(define (get-settings tab)
  (define (not-yet n)
    (lambda (s) (not (eq? (setting-symbol s) (vector-ref first-setting n)))))
  (takef (dropf settings (not-yet tab))
         (not-yet (+ 1 tab))))

(define (display-settings tab)
  (let* ((ss (append (get-settings 0) (get-settings tab)))
         (len (apply max (map setting-length ss))))
    (for-each (lambda (s)
                  (display-setting s len)
                  (newline))
                ss)
    (newline)))

(define gui-fields (make-hash))

(define the-frame (new frame% (label "microtonal scales")))

(define the-tabs (new tab-panel%
                      (parent the-frame)
                      (choices '("common" "generate" "identify" "complement" "mmm" "mof"))
                      (callback (lambda (tp e)
                                  (send tp change-children
                                        (lambda (x)
                                          (case (send tp get-selection)
                                            ((0) (list common-panel))
                                            ((1) (list generate-panel))
                                            ((2) (list identify-panel))
                                            ((3) (list complement-panel))
                                            ((4) (list mmm-panel))
                                            ((5) (list mof-panel)))))))))

(send the-tabs set-selection 1)

(define (make-tab-panel show?)
  (new vertical-panel%
       (parent the-tabs)
       (style (if show? '() '(deleted)))))

(define (make-tab-pane p)
  (new horizontal-pane%
       (parent p)))

(define common-panel     (make-tab-panel #f))
(define generate-panel   (make-tab-panel #t))
(define identify-panel   (make-tab-panel #f))
(define complement-panel (make-tab-panel #f))
(define mmm-panel        (make-tab-panel #f))
(define mof-panel        (make-tab-panel #f))

(define common-pane     (make-tab-pane common-panel))
(define generate-pane   (make-tab-pane generate-panel))
(define identify-pane   (make-tab-pane identify-panel))
(define complement-pane (make-tab-pane complement-panel))
(define mmm-pane        (make-tab-pane mmm-panel))
(define mof-pane        (make-tab-pane mof-panel))

(define (make-column p (subcolumn #f))
  (let* ((column (new vertical-pane%
                      (parent p)
                      (border (if subcolumn 0 5))))
         (column-top (new horizontal-pane%
                          (parent column)
                          (stretchable-height subcolumn))))
    (let ((labels (new vertical-pane%
                       (parent column-top)
                       (stretchable-width #f)))
          (fields (new vertical-pane%
                       (parent column-top)
                       (alignment '(left center)))))
      (list column labels fields))))

(define column-whole first)
(define column-labels second)
(define column-fields third)

(define column-0-0 (make-column common-pane))
(define column-0-1 (make-column common-pane))
(define column-1-0 (make-column generate-pane))
(define column-1-1 (make-column generate-pane))
(define column-2   (make-column identify-pane))
(define column-3   (make-column complement-pane))
(define column-4-0a (make-column mmm-pane))
(define column-4-0b (make-column (column-whole column-4-0a) #t))
(define column-4-1 (make-column mmm-pane))
(define column-5-0 (make-column mof-pane))
(define column-5-1 (make-column mof-pane))

(define-values (check-box-height text-field-height choice-height)
  (let ((frame (new frame% (label "test"))))
    (let ((cb (new check-box% (parent frame) (label "")))
          (tf (new text-field% (parent frame) (label #f)))
          (ch (new choice% (parent frame) (label #f) (choices '("hi")))))
      (let ((cb-margin (send cb vert-margin))
            (tf-margin (send tf vert-margin))
            (ch-margin (send ch vert-margin)))
        (let-values (((dummy1 cb-height) (send cb get-graphical-min-size))
                     ((dummy2 tf-height) (send tf get-graphical-min-size))
                     ((dummy3 ch-height) (send ch get-graphical-min-size)))
          (let ((max-height (max (+ cb-margin cb-height)
                                 (+ tf-margin tf-height)
                                 (+ ch-margin ch-height))))
            (values (- max-height cb-margin)
                    (- max-height tf-margin)
                    (- max-height ch-margin))))))))

(define (add-gui-field setting column)
  (let ((labels-pane (column-labels column))
        (fields-pane (column-fields column)))
    (let* ((field-label (new message%
                             (parent (new pane%
                                          (parent labels-pane)
                                          (alignment '(right center))))
                             (label (setting-label setting))))
           (field-class (case (setting-type setting)
                          ((boolean)                         check-box%)
                          ((number string list list-of-list) text-field%)
                          ((choice)                          choice%)
                          ((list-box)                        list-box%)))
           (the-field (cond
                        ((eq? field-class check-box%) (new check-box%
                                                           (parent fields-pane)
                                                           (label "")
                                                           (min-height check-box-height)))
                        ((eq? field-class text-field%) (new text-field%
                                                            (parent fields-pane)
                                                            (label #f)
                                                            (min-height text-field-height)))
                        ((eq? field-class choice%) (new choice%
                                                        (parent fields-pane)
                                                        (label #f)
                                                        (choices (setting-default setting))
                                                        (min-height choice-height)))
                        ((eq? field-class list-box%) (new list-box%
                                                         (parent fields-pane)
                                                         (label #f)
                                                         (style '(multiple))
                                                         (choices (setting-default setting)))))))
      (when (member field-class (list check-box% text-field%))
        (send the-field set-value (setting-default setting)))
      (hash-set! gui-fields (setting-symbol setting) the-field))))

(let recur ((ss settings)
            (col column-0-0))
  (when (pair? ss)
    (let ((s (car ss)))
      (add-gui-field s col)
      (recur (cdr ss) (case (setting-symbol s)
                        ((column-count)      column-1-0)
                        ((good-cell-min)     column-1-1)
                        ((scales-max)        column-2)
                        ((display-supersets) column-3)
                        ((complement-source) column-4-0a)
                        ((identify-results)  column-4-0b)
                        ((to-table)          column-5-0)
                        ((wrap-row)          column-5-1)
                        (else                col))))))

(define (make-help-field col txt)
  (let ((help-field (new text-field%
                         (parent (column-whole col))
                         (label #f)
                         (style '(multiple))
                         (enabled #f))))
    (send help-field set-value txt)))

(make-help-field column-0-1 "Sort order may be any combination of:\n\n   length packing wolves\n   balance distance rotation\n\nAny of them may be immediately followed by an asterisk, in which case the usual order will be reversed.  For example, length* means longer scales will come first, instead of shorter ones.")

(make-help-field column-1-0 "Each cell is written as a parenthesized list of numbers.  The first number is the number of consecutive notes of the scale being considered within which the cell must be found if it is to count.  The rest of the numbers are the notes of the cell.")

(make-help-field column-4-1 "The fields 'map from cycle' and 'map to cycle' can each contain one, two, or three numbers.  One number means just that number.  Two numbers means all numbers between the two (including the two).  Three numbers means all numbers you get by starting from the first and repeatedly adding the third until reaching the second.\n\nIf 'evenly spaced multiplier' is unchecked, the 'multiplier' field should contain the list of pitches to be multiplied by the motif.  If checked, the 'multiplier' field indirectly represents a list of pitches.  It should contain three numbers: the first pitch of the list, the spacing between successive pitches, and the number of pitches.")

(define (nesting-level x)
  (cond
    ((pair? x) (+ 1 (nesting-level (car x))))
    ((null? x) 1)
    (else 0)))

(define (increase-nesting-level str n)
  (string-append (make-string n #\( )
                 str
                 (make-string n #\) )))

(define (nest str n)
  (let ((x (read (open-input-string str))))
    (if (eof-object? x)
        (if (zero? n) 0 '())
        (read (open-input-string (increase-nesting-level str (- n (nesting-level x))))))))

(define (nest-appropriately val type)
  (case type
    ((string boolean
      choice list-box)    val)
    ((number)       (nest val 0))
    ((list)         (nest val 1))
    ((list-of-list) (nest val 2))))  

(define (get-field-value sym)
  (let ((f (hash-ref gui-fields sym)))
    (cond
      ((is-a? f choice%)         (send f get-string-selection))
      ((is-a? f list-box%)       (send f get-selections))
      ((or (is-a? f text-field%)
           (is-a? f check-box%)) (send f get-value)))))

(define (set-list-box-selections box ns)
  (if (null? ns)
      (when (positive? (send box get-number))
        (send box set-selection 0)
        (send box select 0 #f))
      (begin
        (send box set-selection (car ns))
        (for-each (lambda (n) (send box select n))
                  (cdr ns)))))

(define (set-field-value sym val)
  (let ((f (hash-ref gui-fields sym)))
    (cond
      ((is-a? f choice%)         (send f set-string-selection val))
      ((is-a? f list-box%)       (set-list-box-selections f val))
      ((or (is-a? f text-field%)
           (is-a? f check-box%)) (send f set-value val)))))

(define (copy-settings-from-gui-to-vars)
  (for-each (lambda (s)
              (let* ((sym (setting-symbol s))
                     (val (nest-appropriately (get-field-value sym) (setting-type s))))
                (eval `(set! ,sym ',val) the-namespace)))
            settings))

(define (get-data-from-gui)
  (map (lambda (s)
         (let ((sym (setting-symbol s)))
           (list sym (get-field-value sym))))
       settings))

(define (set-gui-from-data data)
  (for-each (lambda (x)
              (set-field-value (car x) (cadr x)))
            data))

; writer is a function of one argument, an output port, and writes stuff to it
(define (save-to-file writer)
  (let ((file (put-file)))
    (when file
      (call-with-output-file file writer #:mode 'text #:exists 'replace))))

; reader is a function of one argument, an input port, and reads stuff from it
(define (load-from-file reader)
  (let ((file (get-file)))
    (when file
      (call-with-input-file file reader))))

(define (write-list lst p)
  (displayln "(" p)
  (for-each (lambda (x) (writeln x p))
            lst)
  (displayln ")" p))

(define (save-settings-to-file)
  (save-to-file (lambda (p) (write-list (get-data-from-gui) p))))

(define (load-settings-from-file)
  (load-from-file (lambda (p) (set-gui-from-data (read p)))))

(define (write-results p)
  (write-list settings-in-use p)
  (write-list found-scales p))  

(define (normalize-results-path path)
  (path->string (simple-form-path path)))

(define (set-loaded-results-path path set-results-file)
  (let ((s (normalize-results-path path)))
    (set! loaded-results-path s)
    (when set-results-file
      (set-field-value 'results-file s))))

(define (read-results path button-pressed)
  (call-with-input-file path
    (lambda (p)
      (let ((data (read p)))
        (when button-pressed
          (set-gui-from-data data)))
      (set! loaded-results (read p))))
  (set-loaded-results-path path button-pressed))

(define (save-results-to-file)
  (save-to-file write-results))

(define (load-results-from-file)
  (let ((file (get-file)))
    (when file
      (read-results file #t))))

(define (save-and-load-results)
  (let ((file (put-file)))
    (when file
      (call-with-output-file file write-results #:mode 'text #:exists 'replace)
      (set-gui-from-data settings-in-use)
      (set! loaded-results found-scales)
      (set-loaded-results-path file #t))))

(define (clear-results)
  (set-field-value 'results-file "")
  (set! loaded-results '())
  (set! loaded-results-path ""))

(define please-stop #f)

(define stop-buttons '())

(define (set-going-state b)
  (for-each (lambda (button) (send button enable b))
            stop-buttons)
  (for-each (lambda (button) (send button enable (not b)))
            other-buttons))

(define (make-go-button p f)
  (new button%
       (parent p)
       (label "go")
       (callback (lambda (b e)
                   (set-going-state #t)
                   (set! please-stop #f)
                   (thread (lambda ()
                             (dynamic-wind
                              (lambda () 'whatever)
                              f
                              (lambda () (set-going-state #f)))))))))

(define (make-stop-button p)
  (let ((button  (new button%
                      (parent p)
                      (label "stop")
                      (enabled #f)
                      (callback (lambda (b e)
                                  (set! please-stop #t))))))
    (set! stop-buttons (cons button stop-buttons))
    button))

(define (make-buttons-pane p)
  (new horizontal-pane%
       (parent p)
       (alignment '(center center))
       (border 5)
       (stretchable-height #f)))

(define buttons-pane-0 (make-buttons-pane common-panel))

(define save-settings-button (new button%
                                  (parent buttons-pane-0)
                                  (label "save settings")
                                  (callback (lambda (b e)
                                              (save-settings-to-file)))))

(define load-settings-button (new button%
                                  (parent buttons-pane-0)
                                  (label "load settings")
                                  (callback (lambda (b e)
                                              (load-settings-from-file)))))

(define buttons-pane-1 (make-buttons-pane generate-panel))

(define generate-go-button (make-go-button buttons-pane-1 (lambda () (generate))))
(define generate-stop-button (make-stop-button buttons-pane-1))

(define buttons-pane-2 (make-buttons-pane identify-panel))

(define identify-button (new button%
                             (parent buttons-pane-2)
                             (label "identify")
                             (callback (lambda (b e)
                                         (set! please-stop #f)
                                         (thread identify)))))

(define list-button (new button%
                         (parent buttons-pane-2)
                         (label "list")
                         (callback (lambda (b e)
                                     (thread list-known-scales)))))

(define buttons-pane-3 (make-buttons-pane complement-panel))

(define complement-button (new button%
                               (parent buttons-pane-3)
                               (label "complement")
                               (callback (lambda (b e)
                                           (set! please-stop #f)
                                           (thread complement)))))

(define buttons-pane-4 (make-buttons-pane mmm-panel))

(define mmm-button (new button%
                        (parent buttons-pane-4)
                        (label "mmm")
                        (callback (lambda (b e)
                                    (set! please-stop #f) ; necessary if display-scales gets called
                                    (thread mmm)))))

(define buttons-pane-5 (make-buttons-pane mof-panel))

(define save-results-button (new button%
                                 (parent buttons-pane-5)
                                 (label "save results")
                                 (callback (lambda (b e)
                                             (save-results-to-file)))))

(define load-results-button (new button%
                                 (parent buttons-pane-5)
                                 (label "load results")
                                 (callback (lambda (b e)
                                             (load-results-from-file)))))

(define save-load-button (new button%
                              (parent buttons-pane-5)
                              (label "save and load results")
                              (callback (lambda (b e)
                                          (save-and-load-results)))))

(define clear-results-button (new button%
                                  (parent buttons-pane-5)
                                  (label "clear results")
                                  (callback (lambda (b e)
                                              (clear-results)))))

(define mof-go-button (make-go-button buttons-pane-5 (lambda () (mof))))
(define mof-stop-button (make-stop-button buttons-pane-5))

(define other-buttons (list save-settings-button
                            load-settings-button
                            generate-go-button
                            identify-button
                            list-button
                            complement-button
                            mmm-button
                            save-results-button
                            load-results-button
                            save-load-button
                            clear-results-button
                            mof-go-button))

; A note is represented as a nonnegative integer less than modulus.

; A scale is represented as a list of notes.  As it's being built,
;   it's in decreasing order.  Once it's complete, it's reversed
;   into increasing order before being added to 'found-scales'.
;   (Sort of.  See function note-comparer.)

(define found-scales '())   ; initially empty list, onto which scales are consed as they are found
(define allowed-notes '())  ; notes that may be included in a scale
(define bad-cells '())      ; bad cells, after being preprocessed
(define good-cells '())     ; good cells, after being preprocessed
(define keyboard-notes '())
(define keyboard #f)        ; vector, of length modulus, mapping notes to keyboard keys

(define (interval a b)
  (modulo (- b a) modulus))

; transpose note n by k, where modulus is m
(define (transpose-note m n k)
  (modulo (+ n k) m))

; transpose scale s by k, where modulus is m
(define (transpose-scale m s k)
  (map (lambda (n) (transpose-note m n k))
       s))

; invert note n, where modulus is m
(define (invert-note m n)
  (modulo (- n) m))

; invert scale s, where modulus is m
(define (invert-scale m s)
  (map (lambda (n) (invert-note m n))
       s))

(define (invert-scale-m s)
  (invert-scale modulus s))

(define note-names
  '#(("A"              )  ;  0
     ("A+"  "A#-" "Bb-")  ;  1
     ("A#"  "Bb"       )  ;  2
     ("A#+" "Bb+" "B-" )  ;  3
     ("B"              )  ;  4
     ("B+"  "C-"       )  ;  5
     ("C"              )  ;  6
     ("C+"  "C#-" "Db-")  ;  7
     ("C#"  "Db"       )  ;  8
     ("C#+" "Db+" "D-" )  ;  9
     ("D"              )  ; 10
     ("D+"  "D#-" "Eb-")  ; 11
     ("D#"  "Eb"       )  ; 12
     ("D#+" "Eb+" "E-" )  ; 13
     ("E"              )  ; 14
     ("E+"  "F-"       )  ; 15
     ("F"              )  ; 16
     ("F+"  "F#-" "Gb-")  ; 17
     ("F#"  "Gb"       )  ; 18
     ("F#+" "Gb+" "G-" )  ; 19
     ("G"              )  ; 20
     ("G+"  "G#-" "Ab-")  ; 21
     ("G#"  "Ab"       )  ; 22
     ("G#+" "Ab+" "A-" )  ; 23
))

; A name code represents, e.g., F#+, as
; a list of three numbers, one for the F,
; one for the # and one for the +.
;
;  first number: A through G are 0 through 6, respectively.
; second number: b is -1, # is +1, none is 0.
;  third number: - is -1, + is +1, none is 0.

(define code-values
  '((#\A . 0)
    (#\B . 1)
    (#\C . 2)
    (#\D . 3)
    (#\E . 4)
    (#\F . 5)
    (#\G . 6)))

; assumes name is properly capitalized
; i.e., first letter is capital, rest aren't
(define (name->code name)
  (let ((lst (string->list name)))
    (let ((letter (car lst))
          (accidentals (cdr lst)))
      (list
        (cdr (assoc letter code-values))
        (cond
          ((member #\b accidentals) -1)
          ((member #\# accidentals) +1)
          (else 0))
        (cond
          ((member #\- accidentals) -1)
          ((member #\+ accidentals) +1)
          (else 0))))))

(define (code->name code)
  (let ((x (car code))
        (y (cadr code))
        (z (caddr code)))
    (string-append
      (string (car (list-ref code-values x)))
      (case y
        ((-1) "b")
        ((+1) "#")
        (else ""))
      (case z
        ((-1) "-")
        ((+1) "+")
        (else "")))))

; same structure as note-names, i.e. vector of lists,
; except with each name replaced by the corresponding code
(define name-codes
  (vector-map (lambda (name-list) (map name->code name-list))
    note-names))

(define note-values
  '((#\A .  0)
    (#\B .  4)
    (#\C .  6)
    (#\D . 10)
    (#\E . 14)
    (#\F . 16)
    (#\G . 20)
    (#\# .  2)
    (#\b . -2)
    (#\+ .  1)
    (#\- . -1)))

(define (string->note s)
  (apply +
    (map (lambda (c) (cdr (assoc c note-values)))
         (let ((cs (string->list s)))
           (cons (char-upcase (car cs))
             (map char-downcase (cdr cs)))))))

(define (minimum less xs)
  (foldl (lambda (x m) (if (less x m) x m))
    (car xs) (cdr xs)))

; returns a function that compares two lists lexicographically,
;   returning true if the first precedes the second.
; corresponding elements of the lists are compared using 'less'.
(define (comparer less)
  (letrec ((f (lambda (a b)
                (or (and (null? a) (pair? b))
                    (and (pair? a) (pair? b)
                         (or (less (car a) (car b))
                             (and (not (less (car b) (car a)))
                                  (f (cdr a) (cdr b)))))))))
    f))

(define (sorter key less)
  (lambda (lst)
    (sort lst less #:key key #:cache-keys? #t)))

(define (rotate-scale m s)
  (let ((t (append (cdr s) (list (car s)))))
    (transpose-scale m t (- (car t)))))

; list of rotations of scale
; scale itself is the first one
(define (all-rotations m scale)
  (let recur ((n (- (length scale) 1))
              (rs (list (rotate-scale m scale))))
    (if (zero? n)
        rs
        (recur (- n 1) (cons (rotate-scale m (car rs)) rs)))))

(define (all-rotations-m scale)
  (all-rotations modulus scale))

(define (least-rotation m scale)
  (minimum (comparer <) (all-rotations m scale)))

(define (least-rotation-m scale)
  (least-rotation modulus scale))

(define (scale-sorter x)
  (case x
    ((length)    (sorter length <))
    ((length*)   (sorter length >))
    ((packing)   (sorter values (comparer <)))
    ((packing*)  (sorter values (comparer >)))
    ((wolves)    (sorter count-all-wolves <))
    ((wolves*)   (sorter count-all-wolves >))
    ((balance)   (sorter count-balance-out <))
    ((balance*)  (sorter count-balance-out >))
    ((distance)  (sorter least-distance-3 <))
    ((distance*) (sorter least-distance-3 >))
    ((rotation)  (sorter least-rotation-m (comparer <)))
    ((rotation*) (sorter least-rotation-m (comparer >)))
    (else (string-append "I don't know how to sort by " (symbol->string x) "."))))

; name of scale followed by its intervals
(define scale-list-1
  '(
    ("Whole-Tone"              2 2 2 2 2 2)
    ("Augmented 1-3"           1 3 1 3 1 3)
    ("Lydian"                  2 2 2 1 2 2 1)
    ("Harmonic Major"          1 3 1 2 2 1 2)
    ("Harmonic Minor"          2 1 2 2 1 3 1)
    ("Ascending Melodic Minor" 2 1 2 2 2 2 1)
    ("Octatonic-Diminished"    1 2 1 2 1 2 1 2)
    ("Rast"                    4 3 3 4 4 3 3)
    ("Dastgah-e Chahargah"     3 5 2 4 3 5 2)
    ("Sikah Baladi"            3 4 3 4 3 4 3)
    ("Nahfat"                  3 3 4 4 4 2 4)
;   ("Mahur"                   4 3 3 4 4 4 2)
    ("Saba"                    3 3 2 6 2 4 4)
    ("Sabr Jadid"              3 3 2 6 2 6 2)
    ("Suznak"                  4 3 3 4 2 6 2)
;   ("Qarjighar"               3 3 4 2 6 2 4)
;   ("Hizam"                   3 4 2 6 2 4 3)
    ("Nawa"                    2 4 4 4 3 3 4)
    ("Higaz-kar"               2 5 3 4 2 5 3)
    ("Dastgah"                 3 5 2 4 2 4 4)
;   ("Naghmeh Esfahan"         4 2 4 4 3 5 2)
    ("Aug-ara"                 3 6 1 5 2 6 1)
    ("Buselik"                 4 1 5 4 2 6 2)
    ("Neuter"                  4 2 6 2 2 5 3)
    ("Ushaq&Yi"                4 3 3 4 4 2 4)
;   ("Su'ar"                   3 4 4 2 4 4 3)
;   ("Ushaq Masri"             4 2 4 4 3 3 4)
;   ("'Ushshaq Turki"          3 3 4 4 2 4 4)
;   ("Jahargah"                4 4 2 4 4 3 3)
    ("Daniel"                  4 4 2 3 1 4 6)
    ("Oceans Eleven HF2"       3 4 4 3 5 2 3)
    ("Oceans Eleven Tropicana" 3 4 4 3 3 2 5)
    ("Oceans Eleven Squeeze"   5 2 4 3 3 2 5)
    ("Cicada Climbs Wall"      8 3 3 2 5 3)
    ("Cicada Sox Six"          8 3 3 2 3 5)
    ("Cal's Hex 3437"          3 4 3 7 4 3)
    ("Cal's Hex 3433"          3 3 4 7 3 4)
    ("Cal's Hex 3434"          3 4 3 4 3 7)  
    ("31 LYDIAN GROUP"         5 5 5 3 5 5 3)
    ("31 No-Wolf 7-of-Oct"     3 5 2 6 2 8 5)
    ("31 Harmonic Major"       5 5 3 5 3 7 3)
    ("31 Harmonic Major2"      5 5 3 5 2 8 3)
    ("31 Melodic Minor Up"     3 5 5 5 5 3 5)
    ("31 Harmonic Minor"       5 3 5 5 3 7 3)
    ("Kanakangi-0125789"       1 1 3 2 1 1 3)
    ("Ratnangi-012578T"        1 1 3 2 1 2 2)
    ("Ganamurti-0124679"       1 1 2 2 1 2 3)
    ("Vanaspati-012579T"       1 1 3 2 2 1 2)
    ("Manavati-012579E"        1 1 3 2 2 2 1)
    ("Tanarupi-01257TE"        1 1 3 2 3 1 1)
    ("Senavati-0135789"        1 2 2 2 1 1 3)
    ("Dhenuka-013578B"         1 2 2 2 1 3 1)
    ("Kokilapriya-013579B"     1 2 2 2 2 2 1)
    ("Rupavati-01357TE"        1 2 2 2 3 1 1)
    ("Gayak-0145789"           1 3 1 2 1 1 3)
    ("Mayam-014578E"           1 3 1 2 1 3 1)
    ("Hatak-01457TE"           1 3 1 2 3 1 1)
    ("Varu-02357TE"            2 1 2 2 3 1 1)
    ("Nagan-02457TE"           2 2 1 2 3 1 1)
    ("Yaga-0345789"            3 1 1 2 1 1 3)
    ("Gangey-034578E"          3 1 1 2 1 3 1)
    ("Chalanata-03457TE"       3 1 1 2 3 1 1)
    ("Salagam-0126789"         1 1 4 1 1 1 3)
    ("Jalarn-012678T"          1 1 4 1 1 2 2)
    ("Jhala-012678E"           1 1 4 1 1 3 1)
    ("Navam-012679T"           1 1 4 1 2 1 2)
    ("Pavani-012679E"          1 1 4 1 2 1 2)
    ("Rhagu-01267TE"           1 1 4 1 3 1 1)
    ("Sadvid-013679T"          1 2 3 1 2 1 2)
    ("Suvarn-013679E"          1 2 3 1 2 2 1)
    ("Dvya-01367TE"            1 2 3 1 3 1 1)
    ("Dhava-0146789"           1 3 2 1 1 1 3)
    ("Naman-014678T"           1 3 2 1 1 2 2)
    ("Sucha-0346789"           3 1 2 1 1 1 3)
    ("Jioti-034678T"           3 1 2 1 1 2 2)
    ("Target"                  4 3 4 3 5 2 3)
    ("Nice"                    3 2 5 7 4 3)
    ("118-Harmonic11L"         20 18 16 15 14 12 23)
    ("118-Mu-Trane11"          20 18 16 15 49)
    ("Mu-Trane11qt"            4 4 3 3 10)
    ("WideLydian190"           34 34 34 10 34 34 10)
    ("HybridLydian190"         33 33 33 11 33 33 14)
    ("MedLydian190"            32 32 32 15 32 32 15)
    ("5LimJI-Lydian190"        32 33 28 18 32 29 18)
    ("NarrowLydian190"         30 30 30 20 30 30 20)
    ("Large Dorian 136"        24 8 16 8 24 24 8 24)
    ("Melodic Minor 136"       23 10 23 24 23 20 13)
    ("Harmonic171 8-15"        29 26 24 21 20 18 17 16)
    ("Harmonic 7n 171 8-14"    29 26 24 21 20 18 33)
    ("Harmonic 6n 171 8-14"    29 26 24 21 38 33)
    ("5-note Equal"            1 1 1 1 1)
    ("7-note Equal"            1 1 1 1 1 1 1)
    ("8-note Equal"            1 1 1 1 1 1 1 1)
    ("9-note Equal"            1 1 1 1 1 1 1 1 1)
    ("10-note Equal"           1 1 1 1 1 1 1 1 1 1)
    ("11-note Equal"           1 1 1 1 1 1 1 1 1 1 1)
    ("12-note Equal"           1 1 1 1 1 1 1 1 1 1 1 1)
    ("17-note Equal"           1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1)
    ("19-note Equal"           1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1)
    ))

; name of scale, then its modulus, then its notes
(define scale-list-2
  '(
    ("row 9" 12  0  3 11  2 10  8  5  1  4  9  6  7)
    ("row 8" 12  0  3  6  2  9  4  5 11 10  8  1  7)
    ("row 7" 12  0  2  8 11  7  3  4 10  9  6  1  5)
    ("row 6" 12  0  1  8 10  7  5  2  9 11  6  3  4)
    ("row 5" 12  0 10  6  9  5  2 11  8  7  4  1  3)
    ("row 4" 12  0  8  5  7  4  1 10  6  9  3 11  2)
    ("row 3" 12  0  9  2  6  4 10 11  5  7  3  8  1)
    ("row 2" 12  0  6  3  5  2 11  8  4  7  1  9 10)
    ("row 1" 12  0  4  1  3  8 11  5  2  9  7 10  6)
    
    ("mof8"  12  0  4 11  6  8  2  3  5  7 10  1  9)
    ("mof7"  12  0  4 11  5  8  1  3 10  7  9  6  2)
    ("mof6A" 12  0  4 10  5  8  1  2 11  6  9  7  3)
    ("mof6B" 12  0  4  9  6  8  2  1 11  5 10  7  3)
    ("mof5"  12  0  4  7  5  8  1 11  6  3  9  2 10)
    ("mof4A" 12  0  4  7  2  8 10 11  5  3  6  1  9)
    ("mof4B" 12  0  4  7  2  8 10 11  1  3  6  9  5)
    ("mof3"  12  0  4  6  3  8 11 10  5  2  7  1  9)
    ("mof2A" 12  0  4  1 10  8  6  5 11  9  2  7  3)
    ("mof2B" 12  0  4  1 10  8  6  5  3  9  2 11  7)

    ("mallalieu" 12 0 1 4 2 9 5 11 3 8 10 7 6)
    ("Obvious Childe" 12 0 8 7 4 9 5 3 10 11 1 2 6)
    ("Double Aug" 12 0 1 5 9 2 8 7 11 3 10 4 6)
    ("AIS#12" 12 0 1 7 2 4 8 6 3 11 5 10 9)
    ("E for Effort" 12 0 1 7 2 10 8 4 3 6 11 5 9)
    ("Melvin-Lieben" 12 0 1 9 2 4 10 8 3 6 5 7 11)
    ("5p equals" 12 0 1 9 6 11 4 8 2 10 5 7 3)
    ("Five Large" 12 0 2 3 9 10 6 7 1 5 8 4 11)
    ("Degenerate" 12 0 2 5 4 10 7 11 6 9 1 3 8)
    ("Ni of '73" 12 0 4 6 10 7 3 11 1 8 2 5 9)
    ("Too Tuesday" 12 0 2 8 4 5 10 1 6 3 7 9 11)
    ("Usual Suspect" 12 0 3 2 6 4 5 10 9 11 7 1 8)
    ("Octopussy" 12 0 3 4 6 11 7 9 1 8 2 5 10)
    ("Approved" 12 0 3 7 6 4 10 8 9 2 11 5 1)
    ("Billy's Childe" 12 0 7 3 2 5 10 6 9 1 8 11 4)
    ("Jejune" 12 0 3 10 7 8 1 4 2 6 11 9 5)
    ("Gathering Ladma" 12 0 4 7 8 1 11 9 3 10 5 6 2)
    ("CovFEfe" 12 0 5 4 10 1 9 7 3 8 6 11 2)
    ("Big Fockin' Deal" 12 0 5 8 10 4 1 11 3 7 9 2 6)
    ("Donnie Wallboard" 12 0 5 11 10 8 4 6 3 7 1 2 9)
    ("BC Perm" 12 0 7 2 1 4 9 5 8 6 10 3 11)
    ("Mu-tation" 12 0 7 4 2 11 1 6 10 9 5 3 8)
    ("o26/o27" 12 0 7 5 3 9 1 6 10 11 4 2 8)
    ("Cigar Bed" 12 0 7 9 11 4 2 5 10 8 6 1 3)
    ("Renuzit" 12 0 8 2 3 5 10 7 11 6 1 4 9)
    ("FlyTown" 12 0 8 5 3 6 1 7 11 10 2 4 9)
    ("Say I'm Sick" 12 0 9 1 6 11 10 5 3 2 8 4 7)
    ("Big Cad" 12 0 9 2 6 1 11 7 3 4 10 5 8)
    ("Compromising Adult" 12 0 9 4 3 6 11 10 8 2 7 1 5)
    ("First Example" 12 0 10 2 3 6 7 4 1 9 11 5 8)
    ("Loose Girlfriend" 12 0 10 2 7 11 9 4 3 1 8 5 6)
    ("Nigel's Amp" 12 0 10 4 8 7 3 1 6 11 5 9 2)
    ("Malevich the Jewel Thief" 12 0 4 2 7 1 5 9 11 8 6 3 10)
    ("Q-tips" 12 0 3 8 4 7 9 1 6 5 10 2 11)
    ("Four-Nest" 12 0 4 10 6 1 2 7 8 11 3 9 5)
    ("Old Fiends" 12 0 4 5 8 3 9 10 1 11 7 6 2)
    ("La La Land" 12 0 2 9 4 1 11 5 7 10 3 8 6)
    ("Roger Gnocco LeDuc" 12 0 3 4 7 2 9 8 11 10 5 6 1)
    ("Kix R 4 Trids" 12 0 3 1 6 5 4 11 9 2 8 10 7)
    ("Reality Check" 12 0 3 11 6 10 2 4 9 8 1 7 5)
    ("Mr. Hengist" 12 0 3 11 6 8 2 1 9 7 10 5 4)
    ))

; return a list whose first element is the scale's modulus
; and whose remaining elements are its notes
(define (intervals->notes is)
  (let recur ((is is)
              (ns '(0)))
    (if (null? is)
        (cons (car ns)             ; modulus
              (reverse (cdr ns)))  ; notes
        (recur (cdr is)
          (cons (+ (car ns) (car is))
                ns)))))

; lst is not empty
; return list of results of calling f on pairs of elements of lst:
;    first and second, second and third, ..., last and first
; result has same length as lst (so, when lst has one element, x,
;    result is a list with the single element (f x x))
(define (map2 f lst)
  (let ((a (car lst)))
    (let recur ((lst lst))
      (if (null? (cdr lst))
          (list (f (car lst) a))
          (cons (f (car lst) (cadr lst))
                (recur (cdr lst)))))))

; like map2, except don't call f on last and first
; result is therefore shorter than lst by one
(define (map2a f lst)
  (if (null? (cdr lst))
      '()
      (cons (f (car lst) (cadr lst))
            (map2a f (cdr lst)))))

(define (notes->intervals ns)
  (map2 interval ns))

(define (divide-by-gcd lst)
  (let ((k (apply gcd lst)))
    (map (lambda (j) (/ j k))
         lst)))

; first element of scale is the modulus, rest are the notes
; same for return value
(define (normalize scale)
  (divide-by-gcd (cons (car scale) (least-rotation (car scale) (cdr scale)))))

; maps modulus-prefixed scale to name
(define known-scales (make-hash))

; first element of scale is its modulus, rest are its notes
(define (add-scale name scale)
  (let ((normalized-scale (normalize scale)))
    (hash-update! known-scales normalized-scale
                  (lambda (x) (or x name))
                  #f)))

; first element of scale is its modulus, rest are its notes
(define (add-scale-and-inverse name scale)
  (let ((m (car scale))
        (notes (cdr scale)))
    (add-scale name scale)
    (add-scale (string-append name "*") (cons m (invert-scale m notes)))))

; first element of s is scale's name, rest are its intervals
(define (add-scale-from-intervals s)
  (add-scale-and-inverse (car s) (intervals->notes (cdr s))))

; first element of s is scale's name, next is its modulus, rest are its notes
(define (add-scale-from-notes s)
  (add-scale-and-inverse (car s) (cdr s)))

(for-each add-scale-from-intervals scale-list-1)
(for-each add-scale-from-notes     scale-list-2)

; first element of scale is the modulus, rest are the notes
; return value is just notes
(define (convert-to-mod-1 scale)
  (map (lambda (n) (/ n (car scale)))
       (cdr scale)))

(define (interval-1 a b)
  (mod (- b a) 1))

; transpose note n by k, where modulus is 1
(define (transpose-note-1 n k)
  (mod (+ n k) 1))

; transpose scale s by k, where modulus is 1
(define (transpose-scale-1 s k)
  (map (lambda (n) (transpose-note-1 n k))
       s))

; s is mod 1
(define (rotate-scale-1 s)
  (let ((t (append (cdr s) (list (car s)))))
    (transpose-scale-1 t (- (car t)))))

; scale is mod 1
(define (all-rotations-1 scale)
  (let recur ((n (- (length scale) 1))
              (rs (list (rotate-scale-1 scale))))
    (if (zero? n)
        rs
        (recur (- n 1) (cons (rotate-scale-1 (car rs)) rs)))))

; s1 and s2 are mod 1 and have the same length
; return the largest difference between any two corresponding
;   notes of scales s1 and s2 (i.e., the first notes of the two
;   scales, or their second notes, or third, etc.), if the scales
;   are transposed so as to minimize that largest difference
(define (scale-difference s1 s2)
  (let* ((intervals (map interval-1 s1 s2))
         (interval-diffs (filter positive? (map2 interval-1 (sort intervals >)))))
    (if (null? interval-diffs)
        0
        (/ (apply min interval-diffs) 2))))

; s1 and s2 are mod 1 and have the same length
; return least difference between any rotation of s1 and any rotation of s2
(define (least-scale-difference s1 s2)
  (apply min (map (lambda (s) (scale-difference s1 s))
                  (all-rotations-1 s2))))

(define (min-scorers-w-score f lst)
  (let* ((scored-lst (map (lambda (x) (cons (f x) x))
                          lst))
         (min-score (foldl (lambda (x a) (min a (car x)))
                      (caar scored-lst) (cdr scored-lst))))
    (filter (lambda (x) (equal? (car x) min-score))
            scored-lst)))

; return a list of those items x of lst for which (f x) is least
(define (min-scorers f lst)
  (map cdr (min-scorers-w-score f lst)))

; return a possibly-empty list of the nearest scales to scale
; each element of the return value has the form: (difference scale . scale-name)
(define (nearest-known-scales scale)
  (let* ((len (length scale))
         (scales (filter (lambda (s-n) (= len (length (cdar s-n))))
                         (hash->list known-scales))))
    (if (null? scales)
        '()
        (let ((s (convert-to-mod-1 (cons modulus scale))))
          (min-scorers-w-score (lambda (s-n)
                                 (least-scale-difference s (convert-to-mod-1 (car s-n))))
                               scales)))))

(define (scale-name s)
  (let ((ss (nearest-known-scales s))
        (d (/ scale-tolerance 1200)))
    (if (null? ss)
        #f
        (let ((diff (caar ss))
              (name (cddar ss)))
          (cond
            ((> diff d) #f)
            ((zero? diff) name)
            (else (string-append name " [" (number->string (round (* diff 1200))) "]")))))))

; list of transpositions of scale where the first note,
; then the second, then the third, etc. becomes n
(define (all-transpositions-to m scale n)
  (map (lambda (k) (transpose-scale m scale (- n k)))
       scale))

(define (sort-numbers lst)
  (sort lst <))

(define (all-transpositions scale)
  (build-list modulus (lambda (i) (sort-numbers (transpose-scale modulus scale i)))))

(define (all-transformations scale)
  (append (all-transpositions scale)
          (all-transpositions (invert-scale modulus scale))))

; x and y are lists of numbers, each in increasing order
; is x a subset of y?
(define (subset? x y)
  (cond
    ((null? x) #t)
    ((null? y) #f)
    ((< (car x) (car y)) #f)
    ((< (car y) (car x)) (subset? x (cdr y)))
    (else (subset? (cdr x) (cdr y)))))

; x and y are lists of numbers, each in increasing order and containing no duplicates
; result satisfies the same conditions
(define (intersection x y)
  (cond
    ((or (null? x) (null? y)) '())
    ((< (car x) (car y)) (intersection (cdr x) y))
    ((< (car y) (car x)) (intersection x (cdr y)))
    (else (cons (car x) (intersection (cdr x) (cdr y))))))

; x and y are lists of numbers, each in increasing order and containing no duplicates
; result satisfies the same conditions
(define (set-difference x y)
  (cond
    ((null? x) '())
    ((null? y) x)
    ((< (car x) (car y)) (cons (car x) (set-difference (cdr x) y)))
    ((< (car y) (car x)) (set-difference x (cdr y)))
    (else (set-difference (cdr x) (cdr y)))))

; x and y are lists of numbers, each in increasing order and containing no duplicates
; result satisfies the same conditions
(define (symmetric-difference x y)
  (cond
    ((null? x) y)
    ((null? y) x)
    ((< (car x) (car y)) (cons (car x) (symmetric-difference (cdr x) y)))
    ((< (car y) (car x)) (cons (car y) (symmetric-difference x (cdr y))))
    (else (symmetric-difference (cdr x) (cdr y)))))

; x, y and common are lists of numbers, each in increasing order and containing no duplicates
(define (complement? x y common n)
  (<= (length (set-difference (intersection x y) common))
      n))

; first element of each scale is its modulus, rest are its notes.
; return the two scales after converting them to have the same modulus.
(define (convert-to-same-modulus scale-1 scale-2)
  (let ((m1 (car scale-1))
        (m2 (car scale-2)))
    (let ((m3 (lcm m1 m2)))
      (let ((k1 (/ m3 m1))
            (k2 (/ m3 m2)))
        (values (map (lambda (n) (* n k1))
                     scale-1)
                (map (lambda (n) (* n k2))
                     scale-2))))))

; subset is in increasing order
; return a list of 3-element lists,
;   each sublist consisting of (1) the subset,
;   (2) the name of a superset, and (3) a list of modes
;   of that superset.  Each elements of (3) might be #f
;   instead of a mode.  A mode is a list of numbers.
(define (known-supersets subset)
  (let ((subset1 (divide-by-gcd subset)))
    (hash-map known-scales
              (lambda (scale name)
                (let-values (((subset2 scale2) (convert-to-same-modulus subset1 scale)))
                  (let ((notes (cdr subset2)))
                    (list subset2 name
                          (map (lambda (s)
                                 (and (subset? notes (sort s <))
                                      s))
                               (all-transpositions-to (car scale2) (cdr scale2) (car notes))))))))))

; first element of scale is the modulus, rest are the notes
(define (print-known-supersets scale)
  (let* ((ss (known-supersets scale))
         (ss2 (filter (lambda (x) (ormap values (third x)))
                      ss))
         (ss3 (map (lambda (x) (list (first x) (second x) (filter values (third x))))
                   ss2)))
    (if (null? ss3)
        (display "given scale is not a subset of any known scale\n\n")
        (for-each (lambda (x)
                    (let ((subset (first x))
                          (name (second x))
                          (modes (third x)))
                      (display "given scale, ")
                      (display (cdr subset))
                      (display " mod ")
                      (display (car subset))
                      (display ", is a subset of these modes of ")
                      (display name)
                      (display ":\n")
                      (for-each (lambda (mode)
                                  (display "   ")
                                  (display mode)
                                  (newline))
                                modes)
                      (newline)))
                  ss3))))

(define (preprocess-cell c)
  (let* ((range (- (car c) 1))
         (normal (cdr c))
         (inverted (invert-scale modulus normal))
         (len (- (length normal) 1)))
    (list range len normal inverted)))

; extract the parts of a preprocessed cell
(define cell-range    first)
(define cell-len      second)
(define cell-normal   third)
(define cell-inverted fourth)

(define (vector-increment! v i)
  (vector-set! v i (+ 1 (vector-ref v i))))

; measures the extent to which letters are repeated
(define (repetitiveness x)  ; x: list of name codes
  (let ((v (make-vector 7 0)))
    (for-each (lambda (c) (vector-increment! v (car c)))
      x)
    (apply + (map (lambda (x) (* x x))
                  (vector->list v)))))

; number of flats or number of sharps, whichever is smaller
(define (inconsistency x)  ; x: list of name codes
  (let ((v (make-vector 3 0)))
    (for-each (lambda (c) (vector-increment! v (+ 1 (cadr c))))
      x)
    (min (vector-ref v 0)
         (vector-ref v 2))))

(define (best-spellings scale)
  (let* ((all-spellings (apply cartesian-product
                          (map (lambda (n) (vector-ref name-codes n))
                               scale)))
         (best (min-scorers inconsistency
                 (min-scorers repetitiveness all-spellings))))
    (map (lambda (scale) (map code->name scale))
         best)))

(define (display-spellings s)
  (let ((spellings (best-spellings s)))
    (for-each (lambda (x) (display x) (newline))
      (if multiple-spellings
          spellings
          (list (car spellings))))))

; return a list of lists, such that appending
; them all together yields lst, and such that,
; if p and q are any two elements of the same
; list, (f p) equals (f q)
; 
; e.g.
; (split (lambda (n) (modulo n 10))
;        '(1 11 21 22 12 0 1 2 5 25 15 35))
; yields ((1 11 21) (22 12) (0) (1) (2) (5 25 15 35))
(define (split f lst)
  (if (null? lst)
      '()
      (let recur ((lst (cdr lst))
                  (a '())              ; list of lists
                  (b (list (car lst))) ; list
                  (x (f (car lst))))
        (if (null? lst)
           (reverse (cons (reverse b) a))
           (let ((y (f (car lst))))
             (if (equal? x y)
                 (recur (cdr lst)           a          (cons (car lst) b) y)
                 (recur (cdr lst) (cons (reverse b) a)  (list (car lst))  y)))))))

; return a list of lists, each of which is of length n
; and the elements of which are taken, in order, from lst.
; the last list ends in enough elements equal to filler
; to bring its length up to n.
(define (split-n n lst filler)
  (let recur ((lst lst)
              (a '()) ; list of lists
              (b '()) ; list
              (k 0))  ; length of b
    (cond
      ((= k n)
       (recur lst (cons (reverse b) a) '() 0))
      ((and (null? lst) (zero? k))
       (reverse a))
      ((null? lst)
       (recur lst a (cons filler b) (+ 1 k)))
      (else
       (recur (cdr lst) a (cons (car lst) b) (+ 1 k))))))

(define (display-scale-numbers s)
  (display s))

(define (display-scale-letters s)
  (display (car (best-spellings (case modulus
                                  ((12) (map (lambda (n) (* n 2)) s))
                                  ((24) s))))))

(define (display-scale-intervals s)
  (let ((x (notes->intervals s)))
    (display (append x x))))

(define (display-scale-keyboard s)
  (let ((n-keys (length keyboard-notes)))
    (let recur ((s s)
                (offset 0))
      (when (pair? s)
        (let* ((note (car s))
               (key (+ (vector-ref keyboard note)
                       offset
                       (if (>= note first-note) 0 n-keys))))
          (if (< key 12)
              (begin (display key) (display " " ) (recur (cdr s) offset))
              (begin               (display "| ") (recur s (- offset 12)))))))))

(define (display-scale s quit)
  (when please-stop
    (newline)
    (displayln "printing interrupted")
    (quit))
  (let ((name (scale-name s)))
    (when name (displayln name)))
  (display "notes: ")
  (display-scale-numbers s)
  (newline)
  (display "intervals: ")
  (display-scale-intervals s)
  (newline)
  (case modulus
    ((12) (display-spellings (map (lambda (n) (* n 2)) s)))
    ((24) (display-spellings s)))
  (when (> modulus 12)
    (display-scale-keyboard s)
    (newline))
  (display "number of wolves: ")
  (display (count-all-wolves s))
  (newline))

(define (display-scales ss)
  (call/cc (lambda (c)
             (for-each (lambda (s)
                         (display-scale s c)
                         (newline))
                       ss))))

(define (equalize-heights row)
  (let ((height (apply max (map length row))))
    (map (lambda (group)
           (append group (build-list (- height (length group))
                                     (lambda (n) ""))))
         row)))

; scales: list of scales
(define (display-scales-columns scales)
  (let* ((stringify (lambda (scale)
                      (with-output-to-string
                          (lambda ()
                            (let ((f (case output-format
                                       (("numbers")   display-scale-numbers)
                                       (("letters")   (if (member modulus '(12 24))
                                                          display-scale-letters
                                                          display-scale-numbers))
                                       (("intervals") display-scale-intervals)
                                       (("keyboard")  display-scale-keyboard))))
                              (f scale))))))

         ; list of groups, each of which is a list of scales
         (rotation-groups (split least-rotation-m scales))

         ; same, except with each scale converted to a string
         ; also, add name if it has one
         (groups (map (lambda (group)
                        (let ((scale-strings (map stringify group))
                              (name (scale-name (car group))))
                          (if name (cons name scale-strings) scale-strings)))
                      rotation-groups))

         ; list of rows, each of which is a list of groups.
         ; the number of groups in each row is column-count.
         ; the groups of a row will be displayed left to right.
         ; rows will be displayed top to bottom.
         (rows (split-n column-count groups '("")))

         ; list of column widths.
         ; each is the length of the longest string in that column.
         (column-widths (if (null? rows)
                            '()
                            (apply map (lambda column (apply max (map string-length (flatten column))))
                                   rows))))
    (define (display-line strs)
      (for-each (lambda (str width)
                  (display str)
                  (display (padding str width)))
                strs
                (map (lambda (n) (+ n 2)) column-widths)))

    (define (display-row r)
      (apply for-each (lambda line
                        (display-line line)
                        (newline))
             (equalize-heights r)))

    (for-each (lambda (r)
                (display-row r)
                (newline))
              rows)))

(define (print-scales scales)
  (let ((sorted-scales ((apply compose1 (map scale-sorter sort-order)) scales)))
    (if multi-column
        (display-scales-columns sorted-scales)
        (display-scales sorted-scales))))

(define (display-note n)
  (display n)
  (case modulus
    ((12) (display " ") (display (vector-ref note-names (* n 2))))
    ((24) (display " ") (display (vector-ref note-names n)))))

(define (display-any x)
  (cond
    ((number? x)                     (display-note x))
    ((and (pair? x) (pair? (car x))) (display-scales x))
    ((pair? x)                       (display-scale x))))

(define (display-now x)
  (display x)
  (flush-output))

(define found!
  (let ((then (current-seconds)))
    (lambda (s)
      (set! found-scales (cons s found-scales))
      (let ((now (current-seconds)))
        (when (> now then)
          (set! then now)
          (display-now #\.))))))

; notes is a list of allowable notes, in increasing order
; notes-len is the length of notes
; scale is the scale so far, in decreasing order
; scale-len is the length of scale
; n-wolf is the number of wolf intervals in scale
; n-balance is the number of notes in scale that are in balance-notes
; n-bad-cell is the number of occurrences in scale of bad cells
; n-good-cell is the number of occurrences in scale of good cells
; n-bad-interval is the number of occurrences in scale of bad intervals
; n-good-interval is the number of occurrences in scale of good intervals

; call found! for every scale that follows the rules and
;   which can be made by adding to 'scale' any number (> 0)
;   of notes from 'notes'
(define (find-scales notes notes-len scale scale-len n-wolf n-balance n-bad-cell n-good-cell n-bad-interval n-good-interval)
  (when (and (not please-stop)
             (positive? notes-len)
             (< scale-len length-max)
             (>= (+ scale-len notes-len) length-min))
    (let ((n (car notes))
          (notes (cdr notes))
          (notes-len (- notes-len 1)))
      (when (not (member n required-notes))
        (find-scales notes notes-len scale scale-len n-wolf n-balance n-bad-cell n-good-cell n-bad-interval n-good-interval))
      (when (and (allowed-intervals-ok? n scale)
                 (distances-ok? n scale scale-len))
        (let ((n-wolf (+ n-wolf (count-wolves n scale)))
              (n-bad-cell (+ n-bad-cell (count-cells bad-cells n scale scale-len)))
              (n-bad-interval (+ n-bad-interval (count-intervals bad-intervals n scale))))
          (when (and (<= n-wolf wolf-max)
                     (<= n-bad-cell bad-cell-max)
                     (<= n-bad-interval bad-interval-max))
            (let ((n-balance (+ n-balance (if (member n balance-notes) 1 0)))
                  (n-good-cell (+ n-good-cell (count-cells good-cells n scale scale-len)))
                  (n-good-interval (+ n-good-interval (count-intervals good-intervals n scale)))
                  (scale (cons n scale))
                  (scale-len (+ 1 scale-len)))
              (find-scales notes notes-len scale scale-len n-wolf n-balance n-bad-cell n-good-cell n-bad-interval n-good-interval)
              (when (and (>= scale-len length-min)
                         (>= n-wolf wolf-min)
                         (balance-ok? scale-len n-balance)
                         (contains-required-notes? scale)
                         (final-distances-ok? scale)
                         (final-allowed-intervals-ok? scale)
                         (<= (+ n-bad-cell (final-count-cells bad-cells scale scale-len))
                             bad-cell-max)
                         (>= (+ n-good-cell (final-count-cells good-cells scale scale-len))
                             good-cell-min)
                         (<= (+ n-bad-interval (final-count-intervals bad-intervals scale))
                             bad-interval-max)
                         (>= (+ n-good-interval (final-count-intervals good-intervals scale))
                             good-interval-min))
                (found! (reverse scale))))))))))

(define (count-intervals intervals n scale)
  (if (member (interval (car scale) n) intervals)
      1
      0))

(define (final-count-intervals intervals scale)
  (count-intervals intervals first-note scale))

(define (contains-required-notes? scale)
  (subset? required-notes (sort scale <)))

(define (distances-ok? n scale len)
  (and (>= (interval (car scale) n) distance-2-min)
       (or (<= len 1)
           (and (>= (interval (cadr scale) n) distance-3-min)
                (>= (interval n (list-ref scale (- len 2))) distance-3-min)))))

(define (final-distances-ok? scale)
  (and (>= (interval (car scale) first-note) distance-2-min)
       (>= (interval (cadr scale) first-note) distance-3-min)))

(define (allowed-intervals-ok? n scale)
  (or (null? allowed-intervals)
      (member (interval (car scale) n)
        allowed-intervals)))

(define (final-allowed-intervals-ok? scale)
  (or (null? allowed-intervals)
      (and (member (interval (car scale) first-note)
             allowed-intervals)
           (if require-all-allowed-intervals
               (let ((intervals (notes->intervals (reverse scale))))
                 (andmap (lambda (i) (member i intervals))
                   allowed-intervals))
               #t))))

(define (count-cells-1 c note scale len)
  (if (< len (cell-len c))
      0
      (let ((notes (sort-numbers (cons note (take scale (min len (cell-range c))))))
            (cell-transpositions (map sort-numbers
                                      (append (all-transpositions-to modulus (cell-normal   c) note)
                                              (all-transpositions-to modulus (cell-inverted c) note)))))
        (count (lambda (ct) (subset? ct notes))
               cell-transpositions))))

(define (count-cells cells note scale len)
  (apply + (map (lambda (c) (count-cells-1 c note scale len))
                cells)))

(define (final-count-cells-1 c ss len)
  (let ((r (min (cell-range c) (- len 1))))
    (let recur ((s (list-tail ss (- len r)))
                (i r))
      (if (<= i 0)
          0
          (+ (count-cells-1 c (car s) (cdr s) (- len 1))
             (recur (cdr s) (- i 1)))))))

(define (final-count-cells cells scale len)
  (let ((ss (append scale scale)))
    (apply + (map (lambda (c) (final-count-cells-1 c ss len))
                  cells))))

(define (count-wolves n scale)
  (foldl (lambda (note sum)
               (+ sum
                  (if (member (interval note n) wolves) 1 0)
                  (if (member (interval n note) wolves) 1 0)))
    0 scale))

(define (balance-ok? scale-len n-balance)
  (<= balance-in-min n-balance (- scale-len balance-out-min)))

(define (count-all-wolves scale)
  (if (null? scale)
      0
      (+ (count-wolves (car scale) (cdr scale))
         (count-all-wolves (cdr scale)))))

(define (count-balance-out scale)
  (apply + (map (lambda (note) (if (member note balance-notes) 0 1))
                scale)))

(define (least-distance-3 s)
  (let ((t (append (cddr s) (list (car s) (cadr s)))))
    (apply min (map interval s t))))

; r is a pair of numbers, and represents
; the half-open interval between them
(define (in-range x r)
  (and (<= (car r) x) (< x (cdr r))))

; does a precede b in the scale?
; it's more complicated than simply (< a b)
; because the scale starts at first-note and
; goes up to modulus, then wraps around to 0
; and continues up to first-note.
(define (note-comparer)
  (let ((p (cons first-note modulus))
        (q (cons 0 first-note)))
    (lambda (a b)
      (cond
        ((and (in-range a p) (in-range b q)) #t)
        ((and (in-range b p) (in-range a q)) #f)
        (else (< a b))))))
  
; list of scales, each of which is 'scale' plus one allowed note
(define (with-extra-note scale)
  (map (lambda (n) (sort (cons n scale) (note-comparer)))
       allowed-notes))

(define (scale-complete? scale ss)
  (not (ormap (lambda (s)
                (set-member? ss s))
         (with-extra-note scale))))

(define (remove-incompletes scales)
  (let ((ss (list->set scales)))
    (filter (lambda (s)
              (scale-complete? s ss))
      scales)))

(define (make-keyboard)
  (let ((v (make-vector modulus 'bug)))
    (let recur ((notes keyboard-notes)
                (key 0))
      (when (pair? notes)
        (vector-set! v (car notes) key)
        (recur (cdr notes) (+ 1 key))))
    v))

(define (initialize-keyboard no-keyboard)
  (when no-keyboard
    (set! first-note 0))
  (set! keyboard-notes (if (or no-keyboard (null? keyboard-notes-raw))
                           (build-list modulus values)
                           keyboard-notes-raw))
  (set! keyboard (make-keyboard)))

(define (generate)
  (copy-settings-from-gui-to-vars)
  (initialize-keyboard #f)
  (set! first-note (modulo first-note modulus))
  (set! required-notes (sort required-notes <))
  (display-settings 1)
  (display-now "finding scales...")
  (set! allowed-notes (filter (lambda (n) (and (member n keyboard-notes)
                                               (not (member n forbidden-notes))))
                              (build-list (- modulus 1)
                                          (lambda (n) (modulo (+ first-note 1 n) modulus)))))
  (set! good-cells (map preprocess-cell good-cells-raw))
  (set! bad-cells  (map preprocess-cell  bad-cells-raw))
  (set! found-scales '())
  (find-scales allowed-notes (length allowed-notes) (list first-note) 1
               0 (if (member first-note balance-notes) 1 0) 0 0 0 0)
  (if please-stop
      (displayln "interrupted")
      (begin
        (displayln "done")
        (when require-completeness
          (display-now "removing incomplete scales...")
          (set! found-scales (remove-incompletes found-scales))
          (displayln "done"))))
  (newline)
  (let ((n-scale (length found-scales)))
    (display "number of scales found: ")
    (displayln n-scale)
    (newline)
    (set! please-stop #f)
    (print-scales (if (<= n-scale scales-max)
                      found-scales
                      (random-sample found-scales scales-max #:replacement? #f)))))

; scales is a list of pairs, each of which is (modulus-prefixed-list-of-notes . name)
(define (list-scales scales)
  (let* ((ss (sort scales (comparer <) #:key car))
         (notes-list (map (lambda (scale)
                            (with-output-to-string
                                (lambda () (display (car scale)))))
                          ss))
         (name-list (map cdr ss))
         (len (+ 1 (apply max (map string-length notes-list)))))
    (for-each (lambda (notes name)
                (display notes)
                (display (padding notes len))
                (displayln name))
              notes-list
              name-list)
    (newline)))

(define (print-identification m s)
  (let ((t (if reorder-notes (sort-numbers s) s)))
    (if display-supersets
        (print-known-supersets (cons m t))
        (print-scales (all-rotations m t)))))

; scale is a modulus-prefixed list of notes
(define (identify-scale scale)
  (let ((m (car scale))
        (s (cdr scale)))
    (set! modulus m)  ; yuck
    (initialize-keyboard #t)
    (display-settings 2)
    (print-identification m s)))

(define (convert-to-list str)
  (nest-appropriately str 'list))

(define (identify)
  (copy-settings-from-gui-to-vars)
  (case scale-interpretation
    (("notes")     (identify-scale (cons modulus (convert-to-list scale-contents2))))
    (("intervals") (identify-scale (intervals->notes (convert-to-list scale-contents2))))
    (("name")      (let* ((name (string-foldcase scale-contents2))
                          (scales (filter (lambda (s) (string-contains? (string-foldcase (cdr s)) name))
                                          (hash->list known-scales))))
                     (cond
                       ((null? scales) (display "no scale contains '")
                                       (display name)
                                       (displayln "' in its name")
                                       (newline))
                       ((null? (cdr scales)) (identify-scale (caar scales)))
                       (else (let ((exact-matches (filter (lambda (s) (string-ci=? (cdr s) name))
                                                          scales)))
                               (if (null? exact-matches)
                                   (list-scales scales)
                                   (identify-scale (caar exact-matches))))))))))

(define (list-known-scales)
  (list-scales (hash->list known-scales)))

(define (display-complements-from f scales)
  (print-scales
   (remove-duplicates
    (filter (lambda (s)
              (complement? s scale-contents3 common-notes max-additional-common-notes))
            (apply append (map f scales))))))

(define (complement)
  (copy-settings-from-gui-to-vars)
  (initialize-keyboard #t)
  (set! common-notes (sort common-notes <))
  (set! scale-contents3 (sort scale-contents3 <))
  (display-settings 3)
  (case complement-source
    (("the scale above") (display-complements-from all-transformations (list scale-contents3)))
    (("all named scales") (display-complements-from all-transpositions
                           (map cdr (filter (lambda (s) (= modulus (car s)))
                                            (hash-keys known-scales)))))))

; optional name (a string), then modulus, then notes
(define mapping-table-list
  '(
    ("row 9" 12  0  3 11  2 10  8  5  1  4  9  6  7)
    ("row 8" 12  0  3  6  2  9  4  5 11 10  8  1  7)
    ("row 7" 12  0  2  8 11  7  3  4 10  9  6  1  5)
    ("row 6" 12  0  1  8 10  7  5  2  9 11  6  3  4)
    ("row 5" 12  0 10  6  9  5  2 11  8  7  4  1  3)
    ("row 4" 12  0  8  5  7  4  1 10  6  9  3 11  2)
    ("row 3" 12  0  9  2  6  4 10 11  5  7  3  8  1)
    ("row 2" 12  0  6  3  5  2 11  8  4  7  1  9 10)
    ("row 1" 12  0  4  1  3  8 11  5  2  9  7 10  6)
    
    ("mof8"  12  0  4 11  6  8  2  3  5  7 10  1  9)
    ("mof7"  12  0  4 11  5  8  1  3 10  7  9  6  2)
    ("mof6A" 12  0  4 10  5  8  1  2 11  6  9  7  3)
    ("mof6B" 12  0  4  9  6  8  2  1 11  5 10  7  3)
    ("mof5"  12  0  4  7  5  8  1 11  6  3  9  2 10)
    ("mof4A" 12  0  4  7  2  8 10 11  5  3  6  1  9)
    ("mof4B" 12  0  4  7  2  8 10 11  1  3  6  9  5)
    ("mof3"  12  0  4  6  3  8 11 10  5  2  7  1  9)
    ("mof2A" 12  0  4  1 10  8  6  5 11  9  2  7  3)
    ("mof2B" 12  0  4  1 10  8  6  5  3  9  2 11  7)
    
    (171
     0   148 125 102 79  56  33  10  158 135 112 89
     66  43  20  168 145 122 99  76  53  30  7   155
     132 109 86  63  40  17  165 142 119 96  73  50
     27  4   152 129 106 83  60  37  14  162 139 116 
     93  70  47  24  1   149 126 103 80  57  34  11  
     159 136 113 90  67  44  21  169 146 123 100 77)
    
    (171
     0   147 123 99  75  51  27  3   150 126 102 78  
     54  30  6   153 129 105 81  57  33  9   156 132 
     108 84  60  36  12  159 135 111 87  63  39  15  
     162 138 114 90  66  42  18  165 141 117 93  69  
     45  21  168 144 120 96  72  48  24  0   147 123 
     99  75  51  27  3   150 126 102 78  54  30  6)
    
    (171
     0   146 121 96  71  46  21  167 142 117 92  67
     42  17  163 138 113 88  63  38  13  159 134 109 
     84  59  34  9   155 130 105 80  55  30  5   151 
     126 101 76  51  26  1   147 122 97  72  47  22  
     168 143 118 93  68  43  18  164 139 114 89  64  
     39  14  160 135 110 85  60  35  10  156 131 106)
    
    (171
     0   144 117 90  63  36  9   153 126 99  72  45  
     18  162 135 108 81  54  27  0   144 117 90  63  
     36  9   153 126 99  72  45  18  162 135 108 81  
     54  27  0   144 117 90  63  36  9   153 126 99  
     72  45  18  162 135 108 81  54  27  0   144 117 
     90  63  36  9   153 126 99  72  45  18  162 135)
    
    (171
     0   142 113 84  55  26  168 139 110 81  52  23  
     165 136 107 78  49  20  162 133 104 75  46  17  
     159 130 101 72  43  14  156 127 98  69  40  11  
     153 124 95  66  37  8   150 121 92  63  34  5   
     147 118 89  60  31  2   144 115 86  57  28  170 
     141 112 83  54  25  167 138 109 80  51  22  164)
    
    (171
     0   141 111 81  51  21  162 132 102 72  42  12  
     153 123 93  63  33  3   144 114 84  54  24  165 
     135 105 75  45  15  156 126 96  66  36  6   147 
     117 87  57  27  168 138 108 78  48  18  159 129 
     99  69  39  9   150 120 90  60  30  0   141 111 
     81  51  21  162 132 102 72  42  12  153 123 93)
    
    (171
     0   136 101 66  31  167 132 97  62  27  163 128 
     93  58  23  159 124 89  54  19  155 120 85  50  
     15  151 116 81  46  11  147 112 77  42  7   143 
     108 73  38  3   139 104 69  34  170 135 100 65  
     30  166 131 96  61  26  162 127 92  57  22  158 
     123 88  53  18  154 119 84  49  14  150 115 80)
    
    (171
     0   131 91  51  11  142 102 62  22  153 113 73  
     33  164 124 84  44  4   135 95  55  15  146 106 
     66  26  157 117 77  37  168 128 88  48  8   139 
     99  59  19  150 110 70  30  161 121 81  41  1   
     132 92  52  12  143 103 63  23  154 114 74  34  
     165 125 85  45  5   136 96  56  16  147 107 67)
    
    (171
     0   121 71  21  142 92  42  163 113 63  13  134 
     84  34  155 105 55  5   126 76  26  147 97  47  
     168 118 68  18  139 89  39  160 110 60  10  131 
     81  31  152 102 52  2   123 73  23  144 94  44  
     165 115 65  15  136 86  36  157 107 57  7   128 
     78  28  149 99  49  170 120 70  20  141 91  41)
    
    (171
     0   120 69  18  138 87  36  156 105 54  3   123 
     72  21  141 90  39  159 108 57  6   126 75  24  
     144 93  42  162 111 60  9   129 78  27  147 96  
     45  165 114 63  12  132 81  30  150 99  48  168 
     117 66  15  135 84  33  153 102 51  0   120 69  
     18  138 87  36  156 105 54  3   123 72  21  141)
    
    (171
     0   102 33  135 66  168 99  30  132 63  165 96  
     27  129 60  162 93  24  126 57  159 90  21  123 
     54  156 87  18  120 51  153 84  15  117 48  150 
     81  12  114 45  147 78  9   111 42  144 75  6   
     108 39  141 72  3   105 36  138 69  0   102 33  
     135 66  168 99  30  132 63  165 96  27  129 60)
    
    (171
     0   101 31  132 62  163 93  23  124 54  155 85     
     15  116 46  147 77  7   108 38  139 70  0   101 
     31  132 62  163 93  23  124 54  155 85  15  116  
     46  147 77  7   108 38  139 70  0   101 31  132 
     62  163 93  23  124 54  155 85  15  116 46  147                   
     77  7   108 38  139 70  0   101 31  132 62  163)
    
    (171
     0   100 30  130 60  160 90  19  120 49  150 79     
     9   109 39  139 70  0   100 30  130 60  160 90  
     19  120 49  150 79  9   109 39  139 70  0   100 
     30  130 60  160 90  19  120 49  150 79  9   109 
     39  139 70  0   100 30  130 60  160 90  19  120                   
     49  150 79  9   109 39  139 70  0   100 30  130)
    
    (171
     0   101 29  130 60  159 89  19  118 48  149 77     
     7   108 36  137 67  166 96  26  125 55  156 84
     14  115 43  144 74  2   103 33  132 62  163 91  
     21  122 50  151 81  9   110 40  139 70  0   101 
     29  130 60  159 89  19  118 48  149 77  7   108                       
     36  137 67  166 96  26  125 55  156 84  14  115)
    
    (171
     0   100 29  129 58  158 87  16  116 45  145 74      
     3   103 32  132 61  161 90  19  119 48  148 77  
     6   106 35  135 64  164 93  22  122 51  151 80  
     9   109 38  138 67  167 96  25  125 54  154 83  
     12  112 41  141 70  0   100 29  129 58  158 87   
     6   116 45  145 74  3   103 32  132 61  161 90)
    
    (171
     0   100 28  128 57  157 86  15  114 43  143 71      
     0   100 28  128 57  157 86  15  114 43  143 71   
     0   100 28  128 57  157 86  15  114 43  143 71 
     0   100 28  128 57  157 86  15  114 43  143 71 
     0   100 28  128 57  157 86  15  114 43  143 71
     0   100 28  128 57  157 86  15  114 43  143 71)
    
    (171
     0   99  27  126 54  153 81  9   108 36  135 63      
     162 90  18  117 45  144 72  0   99  27  126 54  
     153 81  9   108 36  135 63  162 90  18  117 45  
     144 72  0   99  27  126 54  153 81  9   108 36  
     135 63  162 90  18  117 45  144 72  0   99  27  
     126 54  153 81  9   108 36  135 63  162 90  18)
    
    (171
     0   97  23  120 46  143 69  166 92  18  115 41       
     138 64  161 87  13  110 36  133 59  156 82  8   
     105 31  128 54  151 77  3   100 26  123 49  146 
     72  169 95  21  118 44  141 67  164 90  16  113 
     39  136 62  159 85  11  108 34  131 57  154 80  
     6   103 29  126 52  149 75  0   97  23  120 46)
    
    (171
     0   90  9   99  18  108 27  117 36  126 45  135 
     54  144 63  153 72  162 81  0   90  9   99  18  
     108 27  117 36  126 45  135 54  144 63  153 72  
     162 81  0   90  9   99  18  108 27  117 36  126 
     45  135 54  144 63  153 72  162 81  0   90  9   
     99  18  108 27  117 36  126 45  135 54  144 63)
    
    (171
     0   72  144 45  117 18  90  162 63  135 36  108 
     9   81  153 54  126 27  99  0   72  144 45  117 
     18  90  162 63  135 36  108 9   81  153 54  126 
     27  99  0   72  144 45  117 18  90  162 63  135 
     36  108 9   81  153 54  126 27  99  0   72  144 
     45  117 18  90  162 63  135 36  108 9   81  153)
    
    (171
     0   66  132 27  93  159 54  120 15  81  147 42  
     108 3   69  135 30  96  162 57  123 18  84  150 
     45  111 6   72  138 33  99  165 60  126 21  87  
     153 48  114 9   75  141 36  102 168 63  129 24  
     90  156 51  117 12  78  144 39  105 0   66  132 
     27  93  159 54  120 15  81  147 42  108 3   69)
    
    (171
     0   51  102 153 33  84  135 15  66  117 168 48  
     99  150 30  81  132 12  63  114 165 45  96  147 
     27  78  129 9   60  111 162 42  93  144 24  75  
     126 6   57  108 159 39  90  141 21  72  123 3   
     54  105 156 36  87  138 18  69  120 0   51  102 
     153 33  84  135 15  66  117 168 48  99  150 30)
    
    (171
     0   50  100 150 29  79  129 8   58  108 158 37  
     87  137 16  66  116 166 45  95  145 24  74  124 
     3   53  103 153 32  82  132 11  61  111 161 40  
     90  140 19  69  119 169 48  98  148 27  77  127 
     6   56  106 156 35  85  135 14  64  114 164 43  
     93  143 22  72  122 1   51  101 151 30  80  130)
    
    (171
     0   40  80  120 160 29  69  109 149 18  58  98  
     138 7   47  87  127 167 36  76  116 156 25  65  
     105 145 14  54  94  134 3   43  83  123 163 32  
     72  112 152 21  61  101 141 10  50  90  130 170 
     39  79  119 159 28  68  108 148 17  57  97  137 
     6   46  86  126 166 35  75  115 155 24  64  104)
    
    (171
     0   35  70  105 140 4   39  74  109 144 8   43  
     78  113 148 12  47  82  117 152 16  51  86  121 
     156 20  55  90  125 160 24  59  94  129 164 28  
     63  98  133 168 32  67  102 137 1   36  71  106 
     141 5   40  75  110 145 9   44  79  114 149 13  
     48  83  118 153 17  52  87  122 157 21  56  91)
    
    (171
     0   25  50  75  100 125 150 4   29  54  79  104 
     129 154 8   33  58  83  108 133 158 12  37  62  
     87  112 137 162 16  41  66  91  116 141 166 20  
     45  70  95  120 145 170 24  49  74  99  124 149 
     3   28  53  78  103 128 153 7   32  57  82  107 
     132 157 11  36  61  86  111 136 161 15  40  65)
    
    (171
     0   24  48  72  96  120 144 168 21  45  69  93  
     117 141 165 18  42  66  90  114 138 162 15  39  
     63  87  111 135 159 12  36  60  84  108 132 156 
     9   33  57  81  105 129 153 6   30  54  78  102 
     126 150 3   27  51  75  99  123 147 0   24  48  
     72  96  120 144 168 21  45  69  93  117 141 165)
    
    (171
     0   23  46  69  92  115 138 161 13  36  59  82  
     105 128 151 3   26  49  72  95  118 141 164 16  
     39  62  85  108 131 154 6   29  52  75  98  121 
     144 167 19  42  65  88  111 134 157 9   32  55  
     78  101 124 147 170 22  45  68  91  114 137 160 
     12  35  58  81  104 127 150 2   25  48  71  94)
    ))

(define (common-prefix-len xs ys)
  (if (and (pair? xs)
           (pair? ys)
           (equal? (car xs) (car ys)))
      (+ 1 (common-prefix-len (cdr xs) (cdr ys)))
      0))

(define (make-name t len)
  (with-output-to-string
      (lambda ()
        (display "[")
        (if (string? (car t))
            (display (car t))
            (for-each display (add-between (take t len) " ")))
        (display "]"))))


(define (interleave xs ys)
  (cond
    ((null? xs) ys)
    ((null? ys) xs)
    (else (cons (car xs)
                (cons (car ys)
                      (interleave (cdr xs) (cdr ys)))))))

(define make-named-table cons)
(define table-name car)
(define table-vector cdr)

; vector of named-tables
; the table-vector of each contains mod-1 notes
(define mapping-tables
  (apply vector
         (let* ((nameless (filter (lambda (x) (not (string? (car x)))) mapping-table-list))
                (name-len (if (< (length nameless) 2)
                              3
                              (+ 1 (apply max (map2 common-prefix-len (sort nameless (comparer <)))))))
                (names (map (lambda (t) (make-name t name-len))
                            mapping-table-list))
                (named-tables (map (lambda (name table)
                                     (make-named-table name (apply vector (convert-to-mod-1 (if (string? (car table))
                                                                                                (cdr table)
                                                                                                table)))))
                                   names mapping-table-list)))
           (for-each (lambda (name)
                       (send (hash-ref gui-fields 'from-table) append name)
                       (send (hash-ref gui-fields 'to-table)   append name))
                     names)
           named-tables)))

(define (cycle-table n)
  (make-named-table n (apply vector (convert-to-mod-1 (cons modulus (build-list modulus (lambda (k) (mod (* k n) modulus))))))))

(define (distance a b)
  (min (interval-1 a b)
       (interval-1 b a)))

; index in vector v of note nearest to n
;    among the first len elements of v
(define (pos-in-vector n v len)
  (let recur ((i 0)
              (p #f)
              (min-d 1))
    (if (>= i len)
        p
        (let ((d (distance n (vector-ref v i))))
          (if (< d min-d)
              (recur (+ 1 i) i d)
              (recur (+ 1 i) p min-d))))))

(define (map-between-vectors note v1 v2)
  (round (* modulus (vector-ref v2 (pos-in-vector (/ note modulus) v1 (min (vector-length v1) (vector-length v2)))))))

(define (map-between-tables notes t1 t2)
  (cons (table-name t1)
        (cons (table-name t2)
              (map (lambda (n)
                     (map-between-vectors n (table-vector t1) (table-vector t2)))
                   notes))))

(define (arithmetic-series lo (hi lo) (step 1))
  (if (> lo hi)
      '()
      (cons lo (arithmetic-series (+ lo step) hi step))))

(define (compute-tables cycle table)
  (if (null? table)
      (map cycle-table (apply arithmetic-series cycle))
      (map (lambda (n) (vector-ref mapping-tables n)) table)))

(define (all-mappings notes)
  (map (lambda (args)
         (apply map-between-tables notes args))
       (cartesian-product (compute-tables from-cycle from-table)
                          (compute-tables   to-cycle   to-table))))

(define (display-motif m)
  (display (car m))
  (display "->")
  (display (cadr m))
  (display ": ")
  (display (cddr m))
  (newline))

(define (boulez-multiply xs ys swap-args)
  (let ((xs (if swap-args ys xs))
        (ys (if swap-args xs ys)))
    (map (lambda (y+x)
           (apply transpose-note modulus y+x))
         (cartesian-product ys xs))))

(define (mapbc-then-multiply multiplier swap-args)
  (map (lambda (mapped-motif)
         (cons (car mapped-motif)
               (cons (cadr mapped-motif)
                     (boulez-multiply (cddr mapped-motif) multiplier swap-args))))
       (all-mappings motif)))

(define (multiply-then-mapbc multiplier swap-args)
  (all-mappings (boulez-multiply motif multiplier swap-args)))

(define (mapbc-and-multiply multiplier swap-args)
  ((if (equal? mm-order "map, then multiply")
       mapbc-then-multiply
       multiply-then-mapbc)
   multiplier swap-args))

(define (mmm)
  (copy-settings-from-gui-to-vars)
  (initialize-keyboard #t)
  (display-settings 4)
  (let* ((multiplier (if multiplier-special
                         (build-list (third multiplier)
                                     (lambda (n)
                                       (+ (first multiplier) (* n (second multiplier)))))
                         multiplier))
         (results 'whatever)
         (p (lambda (b)
              (set! results (mapbc-and-multiply multiplier b))
              (for-each display-motif results))))
    (when (member multiplicand-order '("motif times multiplier" "both"))
      (p #f))
    (when (equal? multiplicand-order "both")
      (newline))
    (when (member multiplicand-order '("multiplier times motif" "both"))
      (p #t))
    (when identify-results
      (newline)
      (newline)
      (for-each (lambda (result)
                  (display-motif result)
                  (newline)
                  (print-identification modulus (cddr result))
                  (newline))
                results))))

(define (positions->spacing positions)
  ((if wrap-spacing map2 map2a)
   (lambda (a b) (modulo (- b a) spacing-row-length))
   positions))

; row is a list of distinct notes
; return a function which, given any element of row,
;   returns the position where it occurs in row
(define (position-func row)
  (let ((v (make-vector modulus)))
    (let recur ((row row)
                (n 0))
      (when (pair? row)
        (vector-set! v (car row) n)
        (recur (cdr row) (+ 1 n))))
    (lambda (x) (vector-ref v x))))

; spacing of xs in ys
(define (spacing xs ys)
  (positions->spacing (map (position-func ys) xs)))

; row is a list of notes, not necessarily distinct
; return a function which, given any element of row,
;   returns a list of the positions where it occurs in row
(define (position-list-func row)
  (let ((v (make-vector modulus '())))
    (let recur ((row row)
                (n 0))
      (when (pair? row)
        (vector-set! v (car row) (cons n (vector-ref v (car row))))
        (recur (cdr row) (+ 1 n))))
    (lambda (x) (vector-ref v x))))

; list of spacings of xs in ys
; each spacing is a list of numbers
(define (spacings xs ys)
  (map positions->spacing
       (apply cartesian-product
              (map (position-list-func ys) xs))))

(define (spacing-ok? sp)
  (and (<= spacing-error-min
           (count (lambda (x) (not (<= spacing-min x spacing-max)))
                  sp)
           spacing-error-max)
       (<= 1-space-min
           (count (lambda (x) (= x 1))
                  sp)
           1-space-max)))

(define (some-spacing-ok? xs ys)
  (if (= modulus row-length)
      (spacing-ok? (spacing xs ys))  ; this is just a speed optimization
      (ormap spacing-ok? (spacings xs ys))))  ; this would work correctly in all cases

(define (transpositions row)
  (build-list modulus (lambda (i) (transpose-scale modulus row i))))

; same as (append (reverse a) b), but faster
(define (append-r a b)
  (if (null? a)
      b
      (append-r (cdr a) (cons (car a) b))))

; same as (append-r (map f lst) lst), but faster
(define (append-r-map f lst)
  (let recur ((lst lst)
              (result lst))
    (if (null? lst)
        result
        (recur (cdr lst) (cons (f (car lst)) result)))))

(define (standard-transformations row)
  (append-r-map reverse
                (append-r-map invert-scale-m
                              (transpositions row))))

(define (multiply-note n x)
  (modulo (* n x) modulus))

(define (multiply-row r x)
  (map (lambda (n) (multiply-note n x))
       r))

(define (motif-ok? row)
  (let ((motif (take row motif-length))
        (ok? (lambda (xformed-motif) (some-spacing-ok? xformed-motif row))))
    (>= (+ (if standard-transforms (count ok? (standard-transformations               motif   )) 0)
           (if       5m-transforms (count ok? (standard-transformations (multiply-row motif 5))) 0))
        motif-min)))

; return a list of lists, each of which is the
;   same as lst except that one of its elements
;   (a different one for each sublist) has been
;   moved to the front, with the other elements
;   appearing in the same order as in lst
(define (move-each-to-front lst)
  (let recur ((a '())
              (b lst)
              (r '()))
    (if (null? b)
        r
        (recur
          (cons (car b) a)
          (cdr b)
          (cons (cons (car b) (append-r a (cdr b)))
                r)))))

; call f (for side-effects only) on certain permutations,
;    each of length n, of elements taken from lst
; every permutation starts with (car lst)
; if n is greater than the length of lst, in each permutation
;    all elements of lst are used before any is repeated
; the permutations are constructed one element at a time,
;    and ok? can return #f to indicate that we should bail
;    out early, if it determines that no permutations that
;    start a certain way should be passed to f
; ok? uses data to help make its decision, and it returns
;    new data which will be passed into subsequent calls to it
(define (call-with-permutations lst n f ok? final-ok? data)
  (let recur ((perm (list (car lst))) ; initial part of permutation constructed so far, in reverse
              (n (- n 1))             ; number of elements that still need to be added to perm
              (xs (cdr lst))          ; list of possibilities for the next element
              (data data))            ; summary data computed by ok? based on perm
    (if (zero? n)
        (let ((fwd-perm (reverse perm)))
          (when (apply final-ok? fwd-perm perm data)
            (f fwd-perm)))
        (for-each (lambda (y)
                    (let ((new-data (apply ok? (car y) perm data)))
                      (when new-data
                        (recur (cons (car y) perm) (- n 1) (cdr y) new-data))))
                  (move-each-to-front (if (null? xs) lst xs))))))

(define (partial-row-ok? note row row-len n-bad-cell n-good-cell n-bad-interval n-good-interval last-interval n-interval)
  (let ((i (interval (car row) note)))
    (let ((n-interval (if (= last-interval i) (+ 1 n-interval) 1))
          (last-interval i)
          (n-bad-interval (+ n-bad-interval (count-intervals mof-bad-intervals note row)))
          (n-good-interval (+ n-good-interval (count-intervals mof-good-intervals note row)))
          (n-bad-cell (+ n-bad-cell (count-cells mof-bad-cells note row row-len)))
          (n-good-cell (+ n-good-cell (count-cells mof-good-cells note row row-len)))
          (row-len (+ 1 row-len)))
      (and (not please-stop)
           (<= n-interval interval-repetition-max)
           (<= n-bad-interval mof-bad-interval-max)
           (<= n-bad-cell mof-bad-cell-max)
           (list row-len n-bad-cell n-good-cell n-bad-interval n-good-interval last-interval n-interval)))))

; number of initial elements of list xs that are equal to x
(define (run-length x xs)
  (let recur ((xs xs)
              (n 0))
    (if (or (null? xs)
            (not (equal? x (car xs))))
        n
        (recur (cdr xs) (+ 1 n)))))

(define (final-row-ok? fwd-row row row-len n-bad-cell n-good-cell n-bad-interval n-good-interval last-interval n-interval)
  (and (>= (+ n-good-cell (if wrap-row (final-count-cells mof-good-cells row row-len) 0))
           mof-good-cell-min)
       (>= (+ n-good-interval (if wrap-row (final-count-intervals mof-good-intervals row) 0))
           mof-good-interval-min)
       (let ((intervals ((if wrap-row map2 map2a) interval fwd-row)))
         (and (>= (length (remove-duplicates intervals))
                  distinct-interval-min)
              (or (not wrap-row)
                  (and (<= (+ n-bad-cell (final-count-cells mof-bad-cells row row-len))
                           mof-bad-cell-max)
                       (<= (+ n-bad-interval (final-count-intervals mof-bad-intervals row))
                           mof-bad-interval-max)
                       (<= (let* ((i (interval (car row) (car fwd-row)))
                                  (rl (+ 1 (run-length i intervals))))
                             (min row-len
                                  (if (= i last-interval)
                                      (+ n-interval rl)
                                      rl)))
                           interval-repetition-max)))))))

(define initial-data '(1 0 0 0 0 -1 0))

; call f on row if row passes the tests specified
;   by functions ok? and final-ok?, which work the
;   same as those passed to call-with-permutations
(define (call-with-row row f ok? final-ok? data)
  (let recur ((rr (list (car row)))
              (r (cdr row))              
              (data data))
    (if (null? r)
        (when (apply final-ok? row rr data)
          (f row))
        (let ((new-data (apply ok? (car r) rr data)))
          (when new-data
            (recur (cons (car r) rr) (cdr r) new-data))))))

; x and y are lists of equal length
; return the number of positions at which x and y differ
(define (hamming-distance x y)
  (let recur ((x x)
              (y y)
              (n 0))
    (cond ((null? x)  n)
          ((equal? (car x) (car y))  (recur (cdr x) (cdr y) n))
          (else                      (recur (cdr x) (cdr y) (+ 1 n))))))

(define (near? d x y)
  (<= (hamming-distance x y) d))

(define (near-any? d x ys)
  (ormap (lambda (y) (near? d x y))
         ys))

(define (self-eq? same x y)
  (define (na? a b)
    (near-any? self-eq-tolerance a b))
  (or (na? x (if same (cdr (all-rotations-m y)) (all-rotations-m y)))
      (na? x (all-rotations-m (reverse y)))
      (na? x (all-rotations-m (invert-scale-m y)))
      (na? x (all-rotations-m (reverse (invert-scale-m y))))))

(define (self-equivalent? row)
  (or (and self-eq-standard (self-eq? #t row row))
      (and self-eq-5m       (self-eq? #f row (multiply-row row 5)))))

(define (process-row! row)
  (when (and (motif-ok? row)
             (not (self-equivalent? row)))
    (found! row)))

(define (rotation-transformations row)
  (let ((inverted-row (invert-scale-m row)))
    (append (all-rotations-m row)
            (all-rotations-m (reverse row))
            (all-rotations-m inverted-row)
            (all-rotations-m (reverse inverted-row)))))

(define (remove-near-duplicates rows)
  (let recur ((processed '())
              (unprocessed (map rotation-transformations rows)))
    (if (or please-stop (null? unprocessed))
        (map car (append unprocessed processed))
        (let ((row (caar unprocessed)))
          (if (ormap (lambda (ys) (near-any? duplicate-tolerance row ys))
                     processed)
              (recur                         processed  (cdr unprocessed))
              (recur (cons (car unprocessed) processed) (cdr unprocessed)))))))

(define mof-bad-cells '())
(define mof-good-cells '())

(define settings-in-use '())
(define loaded-results '())
(define loaded-results-path "")

(define (mof)
  (copy-settings-from-gui-to-vars)
  (set! settings-in-use (get-data-from-gui))
  (initialize-keyboard #t)
  (display-settings 5)
  (display-now "finding rows...")
  (set! mof-bad-cells  (map preprocess-cell mof-bad-cells-raw))
  (set! mof-good-cells (map preprocess-cell mof-good-cells-raw))
  (set! found-scales '())
  (if (equal? results-file "")
      (begin
        (set! loaded-results '())
        (set! loaded-results-path "")
        (call-with-permutations (build-list modulus values) row-length
                                process-row! partial-row-ok? final-row-ok? initial-data))
      (let ((path (normalize-results-path results-file)))
        (when (not (equal? path loaded-results-path))
          (read-results results-file #f))
        (call/cc
         (lambda (quit)
           (for-each (lambda (result)
                       (if please-stop
                           (quit)
                           (call-with-row result process-row! partial-row-ok? final-row-ok? initial-data)))
                     loaded-results)))
        (set! found-scales (reverse found-scales))))
  (displayln (if please-stop "interrupted" "done"))
  (newline)
  (let ((n-row (length found-scales)))
    (display "number of rows found: ")
    (displayln n-row)
    (newline)
    (when filter-duplicates
      (display-now "removing near-duplicates...")
      (set! please-stop #f)
      (set! found-scales (remove-near-duplicates found-scales))
      (displayln (if please-stop "interrupted" "done"))
      (newline)
      (set! n-row (length found-scales))
      (display "number of rows remaining: ")
      (displayln n-row)
      (newline))      
    (set! please-stop #f)
    (print-scales (if (<= n-row rows-max)
                      found-scales
                      (random-sample found-scales rows-max #:replacement? #f)))))

(define mallalieu '(0 1 4 2 9 5 11 3 8 10 7 6))

(define (repeat n f)
  (when (> n 0)
    (f)
    (repeat (- n 1) f)))

(define test-x 0)

(define (test)
  (set! test-x 0)
  (call-with-permutations
   (lambda (p) (when (motif-ok? p) (set! test-x (+ 1 test-x))))
   (lambda args '())
   (lambda args '())
   12
   '(0 1 2 3 4 5 6 7 8 9 10 11)
   '()))

(send the-frame show #t)
calebprime is online now   Quote this post in a PM   Nominate this post for this month's language award Copy a direct link to this post Reply With Quote Back to Top
Old 21st February 2018, 09:23 AM   #179
calebprime
moleman
 
calebprime's Avatar
 
Join Date: Jul 2006
Posts: 11,822
Code:
number of rows found: 49

removing near-duplicates...done

number of rows remaining: 49

mof6B*                       mallalieu                    Double Aug                   
(0 1 3 9 4 7 11 2 10 5 8 6)  (0 1 4 2 9 5 11 3 8 10 7 6)  (0 1 5 9 2 8 7 11 3 10 4 6)  

AIS#12                       E for Effort                 Melvin-Lieben                
(0 1 7 2 4 8 6 3 11 5 10 9)  (0 1 7 2 10 8 4 3 6 11 5 9)  (0 1 9 2 4 10 8 3 6 5 7 11)  

5p equals                    Five Large                   Caresst'TreeTendentiously    
(0 1 9 6 11 4 8 2 10 5 7 3)  (0 2 3 9 10 6 7 1 5 8 4 11)  (0 2 5 3 10 6 1 4 9 11 8 7)  

Degenerate                   (0 2 7 4 1 8 5 6 11 3 10 9)  Too Tuesday                  
(0 2 5 4 10 7 11 6 9 1 3 8)                               (0 2 8 4 5 10 1 6 3 7 9 11)  

La La Land                   (0 2 9 5 6 11 10 7 4 8 3 1)  Kix R 4 Trids                
(0 2 9 4 1 11 5 7 10 3 8 6)                               (0 3 1 6 5 4 11 9 2 8 10 7)  

(0 3 1 6 10 4 8 9 5 2 11 7)  Usual Suspect                Octopussy                    
                             (0 3 2 6 4 5 10 9 11 7 1 8)  (0 3 4 6 11 7 9 1 8 2 5 10)  

Roger Gnocco LeDuc           Approved                     Q-tips                       
(0 3 4 7 2 9 8 11 10 5 6 1)  (0 3 7 6 4 10 8 9 2 11 5 1)  (0 3 8 4 7 9 1 6 5 10 2 11)  

row 1*                       Jejune                       Mr. Hengist                  
(0 3 8 10 7 11 5 1 4 2 9 6)  (0 3 10 7 8 1 4 2 6 11 9 5)  (0 3 11 6 8 2 1 9 7 10 5 4)  

Reality Check                Malevich the Jewel Thief     (0 4 2 7 6 5 1 10 3 9 11 8)  
(0 3 11 6 10 2 4 9 8 1 7 5)  (0 4 2 7 1 5 9 11 8 6 3 10)                               

(0 4 2 7 8 6 3 10 5 11 1 9)  Old Fiends                   mof3                         
                             (0 4 5 8 3 9 10 1 11 7 6 2)  (0 4 6 3 8 11 10 5 2 7 1 9)  

Ni of '73                    Gathering Ladma              Four-Nest                    
(0 4 6 10 7 3 11 1 8 2 5 9)  (0 4 7 8 1 11 9 3 10 5 6 2)  (0 4 10 6 1 2 7 8 11 3 9 5)  

CovFEfe                      Big Fockin' Deal             Donnie Wallboard             
(0 5 4 10 1 9 7 3 8 6 11 2)  (0 5 8 10 4 1 11 3 7 9 2 6)  (0 5 11 10 8 4 6 3 7 1 2 9)  

BC Perm                      Billy's Childe               Mu-tation                    
(0 7 2 1 4 9 5 8 6 10 3 11)  (0 7 3 2 5 10 6 9 1 8 11 4)  (0 7 4 2 11 1 6 10 9 5 3 8)  

o26/o27                      Cigar Bed                    Renuzit                      
(0 7 5 3 9 1 6 10 11 4 2 8)  (0 7 9 11 4 2 5 10 8 6 1 3)  (0 8 2 3 5 10 7 11 6 1 4 9)  

FlyTown                      Obvious Childe               Say I'm Sick                 
(0 8 5 3 6 1 7 11 10 2 4 9)  (0 8 7 4 9 5 3 10 11 1 2 6)  (0 9 1 6 11 10 5 3 2 8 4 7)  

Big Cad                      First Example                Loose Girlfriend             
(0 9 2 6 1 11 7 3 4 10 5 8)  (0 10 2 3 6 7 4 1 9 11 5 8)  (0 10 2 7 11 9 4 3 1 8 5 6)  

Nigel's Amp                                                                            
(0 10 4 8 7 3 1 6 11 5 9 2)
and please welcome our new member, Mr. Hengist

Code:
C2,D#2,F#2,A2,B2,D3,E3,F3,G3,G#3,A#3,C#4

0 3 6 9 11 2 4 5 7 8 10 1

0 3 11 6 8 2 1 9 7 10 5 4  distinct


Mr. Hengist

0,  3,  11, 6,  8,  2,  1,  9,  7,  10, 5,  4
3,  6,  2,  9,  10, 4,  0,  11, 8,  1,  7,  5
6,  9,  4,  11, 1,  5,  3,  2,  10, 0,  8,  7
9,  11, 5,  2,  0,  7,  6,  4,  1,  3,  10, 8
11, 2,  7,  4,  3,  8,  9,  5,  0,  6,  1,  10
2,  4,  8,  5,  6,  10, 11, 7,  3,  9,  0,  1
4,  5,  10, 7,  9,  1,  2,  8,  6,  11, 3,  0
5,  7,  1,  8,  11, 0,  4,  10, 9,  2,  6,  3
7,  8,  0,  10, 2,  3,  5,  1,  11, 4,  9,  6
8,  10, 3,  1,  4,  6,  7,  0,  2,  5,  11, 9
10, 1,  6,  0,  5,  9,  8,  3,  4,  7,  2,  11
1,  0,  9,  3,  7,  11, 10, 6,  5,  8,  4,  2


C,  Eb, B,  F#, G#, D,  C#, A,  G,  Bb, F,  E
A,  C,  G#, Eb, F,  B,  Bb, F#, E,  G,  D,  C#
C#, E,  C,  G,  A,  Eb, D,  Bb, G#, B,  F#, F
F#, A,  F,  C,  D,  G#, G,  Eb, C#, E,  B,  Bb
E,  G,  Eb, Bb, C,  F#, F,  C#, B,  D,  A,  G#
Bb, C#, A,  E,  F#, C,  B,  G,  F,  G#, Eb, D
B,  D,  Bb, F,  G,  C#, C,  G#, F#, A,  E,  Eb
Eb, F#, D,  A,  B,  F,  E,  C,  Bb, C#, G#, G
F,  G#, E,  B,  C#, G,  F#, D,  C,  Eb, Bb, A
D,  F,  C#, G#, Bb, E,  Eb, B,  A,  C,  G,  F#
G,  Bb, F#, C#, Eb, A,  G#, E,  D,  F,  C,  B
G#, B,  G,  D,  E,  Bb, A,  F,  Eb, F#, C#, C

Last edited by calebprime; 21st February 2018 at 09:35 AM.
calebprime is online now   Quote this post in a PM   Nominate this post for this month's language award Copy a direct link to this post Reply With Quote Back to Top
Old 21st February 2018, 12:39 PM   #180
calebprime
moleman
 
calebprime's Avatar
 
Join Date: Jul 2006
Posts: 11,822
Code:
===============================================================================
C2,D#2,F#2,G#2,A#2,B2,C#3,D3,E3,F3,G3,A3

0 3 6 8 10 11 1 2 4 5 7 9

0 3 10 6 5 11 9 8 4 7 2 1 distinct




row: C,Eb,Bb,F#,F,B,A,Ab,E,G,D,Db
col: .
dhv: 


Blue Heartburn

C,  Eb, Bb, F#, F,  B,  A,  Ab, E,  G,  D,  Db
Eb, F#, B,  Ab, G,  Db, C,  Bb, F,  A,  E,  D
F#, Ab, Db, Bb, A,  D,  Eb, B,  G,  C,  F,  E
Ab, Bb, D,  B,  C,  E,  F#, Db, A,  Eb, G,  F
Bb, B,  E,  Db, Eb, F,  Ab, D,  C,  F#, A,  G
B,  Db, F,  D,  F#, G,  Bb, E,  Eb, Ab, C,  A
Db, D,  G,  E,  Ab, A,  B,  F,  F#, Bb, Eb, C
D,  E,  A,  F,  Bb, C,  Db, G,  Ab, B,  F#, Eb
E,  F,  C,  G,  B,  Eb, D,  A,  Bb, Db, Ab, F#
F,  G,  Eb, A,  Db, F#, E,  C,  B,  D,  Bb, Ab
G,  A,  F#, C,  D,  Ab, F,  Eb, Db, E,  B,  Bb
A,  C,  Ab, Eb, E,  Bb, G,  F#, D,  F,  Db, B

===============================================================================



===============================================================================

C2,D#2,F2,G2,A2,A#2,B2,C#3,D3,E3,F#3,G#3


0 3 5 7 9 10 11 1 2 4 6 8

0 3 9 5 4 10 8 7 2 6 1 11

0,  3,  9,  5,  4,  10, 8,  7,  2,  6,  1,  11
3,  5,  10, 7,  6,  11, 0,  9,  4,  8,  2,  1
5,  7,  11, 9,  8,  1,  3,  10, 6,  0,  4,  2
7,  9,  1,  10, 0,  2,  5,  11, 8,  3,  6,  4
9,  10, 2,  11, 3,  4,  7,  1,  0,  5,  8,  6
10, 11, 4,  1,  5,  6,  9,  2,  3,  7,  0,  8
11, 1,  6,  2,  7,  8,  10, 4,  5,  9,  3,  0
1,  2,  8,  4,  9,  0,  11, 6,  7,  10, 5,  3
2,  4,  0,  6,  10, 3,  1,  8,  9,  11, 7,  5
4,  6,  3,  8,  11, 5,  2,  0,  10, 1,  9,  7
6,  8,  5,  0,  1,  7,  4,  3,  11, 2,  10, 9
8,  0,  7,  3,  2,  9,  6,  5,  1,  4,  11, 10

The Hedgehog

C,  Eb, A,  F,  E,  Bb, Ab, G,  D,  F#, C#, B
Eb, F,  Bb, G,  F#, B,  C,  A,  E,  Ab, D,  C#
F,  G,  B,  A,  Ab, C#, Eb, Bb, F#, C,  E,  D
G,  A,  C#, Bb, C,  D,  F,  B,  Ab, Eb, F#, E
A,  Bb, D,  B,  Eb, E,  G,  C#, C,  F,  Ab, F#
Bb, B,  E,  C#, F,  F#, A,  D,  Eb, G,  C,  Ab
B,  C#, F#, D,  G,  Ab, Bb, E,  F,  A,  Eb, C
C#, D,  Ab, E,  A,  C,  B,  F#, G,  Bb, F,  Eb
D,  E,  C,  F#, Bb, Eb, C#, Ab, A,  B,  G,  F
E,  F#, Eb, Ab, B,  F,  D,  C,  Bb, C#, A,  G
F#, Ab, F,  C,  C#, G,  E,  Eb, B,  D,  Bb, A
Ab, C,  G,  Eb, D,  A,  F#, F,  C#, E,  B,  Bb
calebprime is online now   Quote this post in a PM   Nominate this post for this month's language award Copy a direct link to this post Reply With Quote Back to Top
Old 22nd February 2018, 04:42 AM   #181
calebprime
moleman
 
calebprime's Avatar
 
Join Date: Jul 2006
Posts: 11,822
Might as well keep myself honest. Of the current collection of 53 series, only 35 currently might meet the dual-property definition. The computer is implacable but fair on this matter. These all test for the second property, and most of them have the first.

The collection is not intended to be pure, nor the basis for any statistical or combinatorial conclusions: It's just intended to be a collection of remarkable series with some self-similarity. Over time, more and more strictly dual-property series will be found.

Code:
number of rows found: 35

removing near-duplicates...done

number of rows remaining: 35

mof6B*                       mallalieu                    Double Aug                   
(0 1 3 9 4 7 11 2 10 5 8 6)  (0 1 4 2 9 5 11 3 8 10 7 6)  (0 1 5 9 2 8 7 11 3 10 4 6)  

AIS#12                       E for Effort                 Melvin-Lieben                
(0 1 7 2 4 8 6 3 11 5 10 9)  (0 1 7 2 10 8 4 3 6 11 5 9)  (0 1 9 2 4 10 8 3 6 5 7 11)  

5p equals                    Five Large                   Degenerate                   
(0 1 9 6 11 4 8 2 10 5 7 3)  (0 2 3 9 10 6 7 1 5 8 4 11)  (0 2 5 4 10 7 11 6 9 1 3 8)  

Too Tuesday                  La La Land                   (0 3 1 6 10 4 8 9 5 2 11 7)  
(0 2 8 4 5 10 1 6 3 7 9 11)  (0 2 9 4 1 11 5 7 10 3 8 6)                               

Octopussy                    Roger Gnocco LeDuc           Q-tips                       
(0 3 4 6 11 7 9 1 8 2 5 10)  (0 3 4 7 2 9 8 11 10 5 6 1)  (0 3 8 4 7 9 1 6 5 10 2 11)  

row 1*                       (0 3 9 5 4 10 8 7 2 6 1 11)  Jejune                       
(0 3 8 10 7 11 5 1 4 2 9 6)                               (0 3 10 7 8 1 4 2 6 11 9 5)  

Mr. Hengist                  Malevich the Jewel Thief     Old Fiends                   
(0 3 11 6 8 2 1 9 7 10 5 4)  (0 4 2 7 1 5 9 11 8 6 3 10)  (0 4 5 8 3 9 10 1 11 7 6 2)  

mof3                         Gathering Ladma              Four-Nest                    
(0 4 6 3 8 11 10 5 2 7 1 9)  (0 4 7 8 1 11 9 3 10 5 6 2)  (0 4 10 6 1 2 7 8 11 3 9 5)  

CovFEfe                      Big Fockin' Deal             Donnie Wallboard             
(0 5 4 10 1 9 7 3 8 6 11 2)  (0 5 8 10 4 1 11 3 7 9 2 6)  (0 5 11 10 8 4 6 3 7 1 2 9)  

Billy's Childe               o26/o27                      Renuzit                      
(0 7 3 2 5 10 6 9 1 8 11 4)  (0 7 5 3 9 1 6 10 11 4 2 8)  (0 8 2 3 5 10 7 11 6 1 4 9)  

FlyTown                      Obvious Childe               Big Cad                      
(0 8 5 3 6 1 7 11 10 2 4 9)  (0 8 7 4 9 5 3 10 11 1 2 6)  (0 9 2 6 1 11 7 3 4 10 5 8)  

Loose Girlfriend             Nigel's Amp                                               
(0 10 2 7 11 9 4 3 1 8 5 6)  (0 10 4 8 7 3 1 6 11 5 9 2)
calebprime is online now   Quote this post in a PM   Nominate this post for this month's language award Copy a direct link to this post Reply With Quote Back to Top
Old 22nd February 2018, 07:38 AM   #182
calebprime
moleman
 
calebprime's Avatar
 
Join Date: Jul 2006
Posts: 11,822
There was a series, so full of clear natural intelligence, serene beauty of mind, yet dawdling, feckless; so full of lithe charm and jowly, lookin' rugged, doin' diddly, that I had to call it Dani.

A real overlooked underachiever of a row, I must say. So full of potential.

Dani is a unique and precious snowflake:


Code:
number of rows found: 54

removing near-duplicates...done

number of rows remaining: 54

mof6B*                       mallalieu                    Double Aug                   
(0 1 3 9 4 7 11 2 10 5 8 6)  (0 1 4 2 9 5 11 3 8 10 7 6)  (0 1 5 9 2 8 7 11 3 10 4 6)  

AIS#12                       E for Effort                 Melvin-Lieben                
(0 1 7 2 4 8 6 3 11 5 10 9)  (0 1 7 2 10 8 4 3 6 11 5 9)  (0 1 9 2 4 10 8 3 6 5 7 11)  

5p equals                    Five Large                   Caresst'TreeTendentiously    
(0 1 9 6 11 4 8 2 10 5 7 3)  (0 2 3 9 10 6 7 1 5 8 4 11)  (0 2 5 3 10 6 1 4 9 11 8 7)  

Degenerate                   (0 2 7 4 1 8 5 6 11 3 10 9)  (0 2 7 4 3 8 9 5 1 6 11 10)  
(0 2 5 4 10 7 11 6 9 1 3 8)                                                            

Too Tuesday                  La La Land                   (0 2 9 4 7 11 10 6 5 8 2 1)  
(0 2 8 4 5 10 1 6 3 7 9 11)  (0 2 9 4 1 11 5 7 10 3 8 6)                               

(0 2 9 5 6 11 10 7 4 8 3 1)  Kix R 4 Trids                (0 3 1 6 10 4 8 9 5 2 11 7)  
                             (0 3 1 6 5 4 11 9 2 8 10 7)                               

Usual Suspect                Octopussy                    Roger Gnocco LeDuc           
(0 3 2 6 4 5 10 9 11 7 1 8)  (0 3 4 6 11 7 9 1 8 2 5 10)  (0 3 4 7 2 9 8 11 10 5 6 1)  

Approved                     Q-tips                       row 1*                       
(0 3 7 6 4 10 8 9 2 11 5 1)  (0 3 8 4 7 9 1 6 5 10 2 11)  (0 3 8 10 7 11 5 1 4 2 9 6)  

(0 3 9 5 4 10 8 7 2 6 1 11)  (0 3 9 5 7 10 11 6 4 8 2 1)  (0 3 10 6 5 11 9 8 4 7 2 1)  

Jejune                       Mr. Hengist                  Reality Check                
(0 3 10 7 8 1 4 2 6 11 9 5)  (0 3 11 6 8 2 1 9 7 10 5 4)  (0 3 11 6 10 2 4 9 8 1 7 5)  

Malevich the Jewel Thief     (0 4 2 7 6 5 1 10 3 9 11 8)  (0 4 2 7 8 6 3 10 5 11 1 9)  
(0 4 2 7 1 5 9 11 8 6 3 10)                                                            

Old Fiends                   mof3                         Ni of '73                    
(0 4 5 8 3 9 10 1 11 7 6 2)  (0 4 6 3 8 11 10 5 2 7 1 9)  (0 4 6 10 7 3 11 1 8 2 5 9)  

Gathering Ladma              Four-Nest                    CovFEfe                      
(0 4 7 8 1 11 9 3 10 5 6 2)  (0 4 10 6 1 2 7 8 11 3 9 5)  (0 5 4 10 1 9 7 3 8 6 11 2)  

Big Fockin' Deal             Donnie Wallboard             BC Perm                      
(0 5 8 10 4 1 11 3 7 9 2 6)  (0 5 11 10 8 4 6 3 7 1 2 9)  (0 7 2 1 4 9 5 8 6 10 3 11)  

Billy's Childe               Mu-tation                    o26/o27                      
(0 7 3 2 5 10 6 9 1 8 11 4)  (0 7 4 2 11 1 6 10 9 5 3 8)  (0 7 5 3 9 1 6 10 11 4 2 8)  

Cigar Bed                    Renuzit                      FlyTown                      
(0 7 9 11 4 2 5 10 8 6 1 3)  (0 8 2 3 5 10 7 11 6 1 4 9)  (0 8 5 3 6 1 7 11 10 2 4 9)  

Obvious Childe               Say I'm Sick                 Big Cad                      
(0 8 7 4 9 5 3 10 11 1 2 6)  (0 9 1 6 11 10 5 3 2 8 4 7)  (0 9 2 6 1 11 7 3 4 10 5 8)  

First Example                Loose Girlfriend             Nigel's Amp                  
(0 10 2 3 6 7 4 1 9 11 5 8)  (0 10 2 7 11 9 4 3 1 8 5 6)  (0 10 4 8 7 3 1 6 11 5 9 2)




He or She is a good dog! This dog will hunt, excellent will hunting.

But does it actually go anywhere, accomplish anything?


Code:
C2,D2,E2,F2,G2,G#2,A#2,B2,C#3,D#3,F#3,A3

0 2 4 5 7 8 10 11 1 3 6 9

0 2 7 4 3 8 9 5 1 6 11 10


Dani

0,  2,  7,  4,  3,  8,  9,  5,  1,  6,  11, 10
2,  4,  8,  5,  6,  10, 0,  7,  3,  9,  1,  11
4,  5,  10, 7,  9,  11, 2,  8,  6,  0,  3,  1
5,  7,  11, 8,  0,  1,  4,  10, 9,  2,  6,  3
7,  8,  1,  10, 2,  3,  5,  11, 0,  4,  9,  6
8,  10, 3,  11, 4,  6,  7,  1,  2,  5,  0,  9
10, 11, 6,  1,  5,  9,  8,  3,  4,  7,  2,  0
11, 1,  9,  3,  7,  0,  10, 6,  5,  8,  4,  2
1,  3,  0,  6,  8,  2,  11, 9,  7,  10, 5,  4
3,  6,  2,  9,  10, 4,  1,  0,  8,  11, 7,  5
6,  9,  4,  0,  11, 5,  3,  2,  10, 1,  8,  7
9,  0,  5,  2,  1,  7,  6,  4,  11, 3,  10, 8




C,  D,  G,  E,  Eb, Ab, A,  F,  Db, Gb, B,  Bb
Bb, C,  F,  D,  Db, Gb, G,  Eb, B,  E,  A,  Ab
F,  G,  C,  A,  Ab, Db, D,  Bb, Gb, B,  E,  Eb
Ab, Bb, Eb, C,  B,  E,  F,  Db, A,  D,  G,  Gb
A,  B,  E,  Db, C,  F,  Gb, D,  Bb, Eb, Ab, G
E,  Gb, B,  Ab, G,  C,  Db, A,  F,  Bb, Eb, D
Eb, F,  Bb, G,  Gb, B,  C,  Ab, E,  A,  D,  Db
G,  A,  D,  B,  Bb, Eb, E,  C,  Ab, Db, Gb, F
B,  Db, Gb, Eb, D,  G,  Ab, E,  C,  F,  Bb, A
Gb, Ab, Db, Bb, A,  D,  Eb, B,  G,  C,  F,  E
Db, Eb, Ab, F,  E,  A,  Bb, Gb, D,  G,  C,  B
D,  E,  A,  Gb, F,  Bb, B,  G,  Eb, Ab, Db, C

Last edited by calebprime; 22nd February 2018 at 07:45 AM.
calebprime is online now   Quote this post in a PM   Nominate this post for this month's language award Copy a direct link to this post Reply With Quote Back to Top
Old 23rd February 2018, 05:23 AM   #183
calebprime
moleman
 
calebprime's Avatar
 
Join Date: Jul 2006
Posts: 11,822
Today's successful series, Flat Six to Five, tests both as distinct, and as a mof of the second type. (It's obviously self-similar in the first way as well.)

It has a group of 32 related series sharing the same embedding pattern at the minor third (3.)

There's also a pretty tight embedding at R/6 -- which I've learned to anticipate is that huge group of some thousands of series.


Code:
C2,C#2,E2,F#2,A2,B2,D3,D#3,F3,G3,G#3,A#3

0 1 4 6 9 11 2 3 5 7 8 10

0 1 9 4 7 11 10 6 5 8 3 2    Distinct and tests for mof

Flat Six to Five

C,  C#, A,  E,  G,  B,  Bb, F#, F,  Ab, Eb, D
C#, E,  B,  F#, Ab, D,  C,  A,  G,  Bb, F,  Eb
E,  F#, D,  A,  Bb, Eb, C#, B,  Ab, C,  G,  F
F#, A,  Eb, B,  C,  F,  E,  D,  Bb, C#, Ab, G
A,  B,  F,  D,  C#, G,  F#, Eb, C,  E,  Bb, Ab
B,  D,  G,  Eb, E,  Ab, A,  F,  C#, F#, C,  Bb
D,  Eb, Ab, F,  F#, Bb, B,  G,  E,  A,  C#, C
Eb, F,  Bb, G,  A,  C,  D,  Ab, F#, B,  E,  C#
F,  G,  C,  Ab, B,  C#, Eb, Bb, A,  D,  F#, E
G,  Ab, C#, Bb, D,  E,  F,  C,  B,  Eb, A,  F#
Ab, Bb, E,  C,  Eb, F#, G,  C#, D,  F,  B,  A
Bb, C,  F#, C#, F,  A,  Ab, E,  Eb, G,  D,  B


p/0/0:...............C  C# A  E  G  B  Bb F# F  Ab Eb D  




   ..................2..3..4..5..6..7..8..9..10.11.0..1......
p/3/2:...............C  G  Bb D  C# A  Ab B  F# F  Eb E  
.....................c...........c#.a.................e...
........................g.................b...............
...........................bb................f#.f.........
.......................................ab..........eb.....
..............................d..............................


2,6,7,1,3,9,4,10,11,8,0,5,



P) permutation: 2,6,7,1,3,9,4,10,11,8,0,5
C) center interval of self-similarity: 3
I) invert test (use sums instead of differences): off
O) minimum number of occurrences of center: 10
D) maximum deviation from center: 3
S) maximum sum of all deviations: 12
F) fixed-position notes: 0:0
E) excluded cells within range: 
R) excluded intervals within range: 
A) filter original solution: on
B) filter permuted solution: off
X) permutation depth: 2
N) number of solutions to print: 1000
W) wrap: on

1) perform new full search
2) search within results of last full search
9) quit

enter choice: 1
working...
0 1 3 10 7 2 4 6 8 5 9 11 - 12 0 0
0 1 3 10 7 5 4 6 11 8 9 2 - 12 0 0
0 1 3 10 7 8 4 6 2 11 9 5 - 12 0 0
0 1 3 10 7 11 4 6 5 2 9 8 - 12 0 0
0 2 3 11 8 1 5 6 7 4 9 10 - 12 0 0
0 2 3 11 8 4 5 6 10 7 9 1 - 12 0 0
0 2 3 11 8 7 5 6 1 10 9 4 - 12 0 0
0 2 3 11 8 10 5 6 4 1 9 7 - 12 0 0
0 4 3 1 10 2 7 6 8 5 9 11 - 12 0 0
0 4 3 1 10 5 7 6 11 8 9 2 - 12 0 0
0 4 3 1 10 8 7 6 2 11 9 5 - 12 0 0
0 4 3 1 10 11 7 6 5 2 9 8 - 12 0 0
0 5 3 2 11 1 8 6 7 4 9 10 - 12 0 0
0 5 3 2 11 4 8 6 10 7 9 1 - 12 0 0
0 5 3 2 11 7 8 6 1 10 9 4 - 12 0 0
0 5 3 2 11 10 8 6 4 1 9 7 - 12 0 0
0 7 3 4 1 2 10 6 8 5 9 11 - 12 0 0
0 7 3 4 1 5 10 6 11 8 9 2 - 12 0 0
0 7 3 4 1 8 10 6 2 11 9 5 - 12 0 0
0 7 3 4 1 11 10 6 5 2 9 8 - 12 0 0
0 8 3 5 2 1 11 6 7 4 9 10 - 12 0 0
0 8 3 5 2 4 11 6 10 7 9 1 - 12 0 0
0 8 3 5 2 7 11 6 1 10 9 4 - 12 0 0
0 8 3 5 2 10 11 6 4 1 9 7 - 12 0 0
0 10 3 7 4 2 1 6 8 5 9 11 - 12 0 0
0 10 3 7 4 5 1 6 11 8 9 2 - 12 0 0
0 10 3 7 4 8 1 6 2 11 9 5 - 12 0 0
0 10 3 7 4 11 1 6 5 2 9 8 - 12 0 0
0 11 3 8 5 1 2 6 7 4 9 10 - 12 0 0
0 11 3 8 5 4 2 6 10 7 9 1 - 12 0 0
0 11 3 8 5 7 2 6 1 10 9 4 - 12 0 0
0 11 3 8 5 10 2 6 4 1 9 7 - 12 0 0


p/0/0:...............C  C# A  E  G  B  Bb F# F  Ab Eb D 


p/5/4:...............C  E  Eb B  Bb C# Ab G  F  F# D  A  



                     7  6  5  4  3  2  1  0  11 10 9  8 
r/6/4:...............C  E  F  C# Bb Eb G  F# Ab A  D  B  
.....................c........c#................a..........
........................e..............g..............b....
.................................bb.......f#...............
...........................f.................ab............
....................................eb.............d.......

7,4,10,6,1,8,3,0,5,11,2,9






r/2/5:...............C  C# A  F# B  Eb D  E  F  Bb G  Ab 

5x/r/4/8:............C  C# A  E  D  G  Ab F  Bb F# B  Eb 

5x/r/7/10:...........C  G  F  Bb B  Ab C# A  D  F# Eb E  

5x/r/0/11:...........C  Bb Eb E  C# F# D  G  B  Ab A  F  





cycle of six series when re-ordered
0 1 4 6 9 11 2 3 5 7 8 10
0 1 9 4 7 11 10 6 5 8 3 2    Distinct and tests for mof

0 1 7 9 8 11 2 4 5 3 6 10

0 1 8 7 3 11 10 9 5 6 4 2

0 1 3 8 6 11 2 7 5 4 9 10

0 1 6 3 4 11 10 8 5 9 7 2
calebprime is online now   Quote this post in a PM   Nominate this post for this month's language award Copy a direct link to this post Reply With Quote Back to Top
Old 23rd February 2018, 09:30 AM   #184
calebprime
moleman
 
calebprime's Avatar
 
Join Date: Jul 2006
Posts: 11,822
Originally Posted by calebprime View Post
Today's successful series, Flat Six to Five, tests both as distinct, and as a mof of the second type. (It's obviously self-similar in the first way as well.)

It has a group of 32 related series sharing the same embedding pattern at the minor third (3.)

There's also a pretty tight embedding at R/6 -- which I've learned to anticipate is that huge group of some thousands of series.


Code:
C2,C#2,E2,F#2,A2,B2,D3,D#3,F3,G3,G#3,A#3

0 1 4 6 9 11 2 3 5 7 8 10

0 1 9 4 7 11 10 6 5 8 3 2    Distinct and tests for mof

Flat Six to Five

C,  C#, A,  E,  G,  B,  Bb, F#, F,  Ab, Eb, D
C#, E,  B,  F#, Ab, D,  C,  A,  G,  Bb, F,  Eb
E,  F#, D,  A,  Bb, Eb, C#, B,  Ab, C,  G,  F
F#, A,  Eb, B,  C,  F,  E,  D,  Bb, C#, Ab, G
A,  B,  F,  D,  C#, G,  F#, Eb, C,  E,  Bb, Ab
B,  D,  G,  Eb, E,  Ab, A,  F,  C#, F#, C,  Bb
D,  Eb, Ab, F,  F#, Bb, B,  G,  E,  A,  C#, C
Eb, F,  Bb, G,  A,  C,  D,  Ab, F#, B,  E,  C#
F,  G,  C,  Ab, B,  C#, Eb, Bb, A,  D,  F#, E
G,  Ab, C#, Bb, D,  E,  F,  C,  B,  Eb, A,  F#
Ab, Bb, E,  C,  Eb, F#, G,  C#, D,  F,  B,  A
Bb, C,  F#, C#, F,  A,  Ab, E,  Eb, G,  D,  B


p/0/0:...............C  C# A  E  G  B  Bb F# F  Ab Eb D  




   ..................2..3..4..5..6..7..8..9..10.11.0..1......
p/3/2:...............C  G  Bb D  C# A  Ab B  F# F  Eb E  
.....................c...........c#.a.................e...
........................g.................b...............
...........................bb................f#.f.........
.......................................ab..........eb.....
..............................d..............................


2,6,7,1,3,9,4,10,11,8,0,5,



P) permutation: 2,6,7,1,3,9,4,10,11,8,0,5
C) center interval of self-similarity: 3
I) invert test (use sums instead of differences): off
O) minimum number of occurrences of center: 10
D) maximum deviation from center: 3
S) maximum sum of all deviations: 12
F) fixed-position notes: 0:0
E) excluded cells within range: 
R) excluded intervals within range: 
A) filter original solution: on
B) filter permuted solution: off
X) permutation depth: 2
N) number of solutions to print: 1000
W) wrap: on

1) perform new full search
2) search within results of last full search
9) quit

enter choice: 1
working...
0 1 3 10 7 2 4 6 8 5 9 11 - 12 0 0
0 1 3 10 7 5 4 6 11 8 9 2 - 12 0 0
0 1 3 10 7 8 4 6 2 11 9 5 - 12 0 0
0 1 3 10 7 11 4 6 5 2 9 8 - 12 0 0
0 2 3 11 8 1 5 6 7 4 9 10 - 12 0 0
0 2 3 11 8 4 5 6 10 7 9 1 - 12 0 0
0 2 3 11 8 7 5 6 1 10 9 4 - 12 0 0
0 2 3 11 8 10 5 6 4 1 9 7 - 12 0 0
0 4 3 1 10 2 7 6 8 5 9 11 - 12 0 0
0 4 3 1 10 5 7 6 11 8 9 2 - 12 0 0
0 4 3 1 10 8 7 6 2 11 9 5 - 12 0 0
0 4 3 1 10 11 7 6 5 2 9 8 - 12 0 0
0 5 3 2 11 1 8 6 7 4 9 10 - 12 0 0
0 5 3 2 11 4 8 6 10 7 9 1 - 12 0 0
0 5 3 2 11 7 8 6 1 10 9 4 - 12 0 0
0 5 3 2 11 10 8 6 4 1 9 7 - 12 0 0
0 7 3 4 1 2 10 6 8 5 9 11 - 12 0 0
0 7 3 4 1 5 10 6 11 8 9 2 - 12 0 0
0 7 3 4 1 8 10 6 2 11 9 5 - 12 0 0
0 7 3 4 1 11 10 6 5 2 9 8 - 12 0 0
0 8 3 5 2 1 11 6 7 4 9 10 - 12 0 0
0 8 3 5 2 4 11 6 10 7 9 1 - 12 0 0
0 8 3 5 2 7 11 6 1 10 9 4 - 12 0 0
0 8 3 5 2 10 11 6 4 1 9 7 - 12 0 0
0 10 3 7 4 2 1 6 8 5 9 11 - 12 0 0
0 10 3 7 4 5 1 6 11 8 9 2 - 12 0 0
0 10 3 7 4 8 1 6 2 11 9 5 - 12 0 0
0 10 3 7 4 11 1 6 5 2 9 8 - 12 0 0
0 11 3 8 5 1 2 6 7 4 9 10 - 12 0 0
0 11 3 8 5 4 2 6 10 7 9 1 - 12 0 0
0 11 3 8 5 7 2 6 1 10 9 4 - 12 0 0
0 11 3 8 5 10 2 6 4 1 9 7 - 12 0 0


p/0/0:...............C  C# A  E  G  B  Bb F# F  Ab Eb D 


p/5/4:...............C  E  Eb B  Bb C# Ab G  F  F# D  A  



                     7  6  5  4  3  2  1  0  11 10 9  8 
r/6/4:...............C  E  F  C# Bb Eb G  F# Ab A  D  B  
.....................c........c#................a..........
........................e..............g..............b....
.................................bb.......f#...............
...........................f.................ab............
....................................eb.............d.......

7,4,10,6,1,8,3,0,5,11,2,9






r/2/5:...............C  C# A  F# B  Eb D  E  F  Bb G  Ab 

5x/r/4/8:............C  C# A  E  D  G  Ab F  Bb F# B  Eb 

5x/r/7/10:...........C  G  F  Bb B  Ab C# A  D  F# Eb E  

5x/r/0/11:...........C  Bb Eb E  C# F# D  G  B  Ab A  F  





cycle of six series when re-ordered
0 1 4 6 9 11 2 3 5 7 8 10
0 1 9 4 7 11 10 6 5 8 3 2    Distinct and tests for mof

0 1 7 9 8 11 2 4 5 3 6 10

0 1 8 7 3 11 10 9 5 6 4 2

0 1 3 8 6 11 2 7 5 4 9 10

0 1 6 3 4 11 10 8 5 9 7 2
I seem to have been wrong about this -- the computer seems to be rejecting this as too close to something else.

I'll find one that's...indisputable.
calebprime is online now   Quote this post in a PM   Nominate this post for this month's language award Copy a direct link to this post Reply With Quote Back to Top
Old 23rd February 2018, 09:35 AM   #185
calebprime
moleman
 
calebprime's Avatar
 
Join Date: Jul 2006
Posts: 11,822
The elite of the best-of-the-NWO squad-ultra series, currently 32:

Code:
                                     modulus: 12
         wolf intervals (between any two notes): ()
                     display multiple spellings: #f
    acceptable error when naming scales (cents): 0
                                     sort order: (packing)
             abbreviated multiple-column output: #t
                                  output format: numbers
                       number of output columns: 3
                                     row length: 12
                                      bad cells: ((4 0 3 6 9) (3 0 1 2))
                    maximum number of bad cells: 0
                                     good cells: ()
                   minimum number of good cells: 0
      bad intervals (between consecutive notes): ()
                maximum number of bad intervals: 0
     good intervals (between consecutive notes): ()
               minimum number of good intervals: 0
          minimum number of different intervals: 4
   maximum number of same consecutive intervals: 2
             self-equivalence filter - standard: #t
                   self-equivalence filter - 5m: #t
              self-equivalence filter tolerance: 2
                         remove near-duplicates: #t
                       near-duplicate tolerance: 4
         wrap when counting cells and intervals: #f
      virtual row length, for computing spacing: 12
                                   motif length: 12
     look for standard transformations of motif: #t
           look for 5m transformations of motif: #f
                                minimum spacing: 2
                                maximum spacing: 7
minimum number of violations of min/max spacing: 0
maximum number of violations of min/max spacing: 1
                     minimum number of 1-spaces: 0
                     maximum number of 1-spaces: 3
  minimum number of occurrences of motif in row: 1
                    wrap when computing spacing: #t
              maximum number of rows to display: 2000
               file of results to search within: Desktop/MOFs and Searches/canon

finding rows....done

number of rows found: 32

removing near-duplicates...done

number of rows remaining: 32

mof6B*                       AIS#12                       E for Effort                 
(0 1 3 9 4 7 11 2 10 5 8 6)  (0 1 7 2 4 8 6 3 11 5 10 9)  (0 1 7 2 10 8 4 3 6 11 5 9)  

5p equals                    Five Large                   Degenerate                   
(0 1 9 6 11 4 8 2 10 5 7 3)  (0 2 3 9 10 6 7 1 5 8 4 11)  (0 2 5 4 10 7 11 6 9 1 3 8)  

Dani                         Too Tuesday                  (0 2 11 5 7 1 10 8 6 9 4 3)  
(0 2 7 4 3 8 9 5 1 6 11 10)  (0 2 8 4 5 10 1 6 3 7 9 11)                               

(0 3 1 6 10 4 8 9 5 2 11 7)  Octopussy                    Roger Gnocco LeDuc           
                             (0 3 4 6 11 7 9 1 8 2 5 10)  (0 3 4 7 2 9 8 11 10 5 6 1)  

Q-tips                       The Hedgehog                 Jejune                       
(0 3 8 4 7 9 1 6 5 10 2 11)  (0 3 9 5 4 10 8 7 2 6 1 11)  (0 3 10 7 8 1 4 2 6 11 9 5)  

Mr. Hengist                  Malevich the Jewel Thief     Old Fiends                   
(0 3 11 6 8 2 1 9 7 10 5 4)  (0 4 2 7 1 5 9 11 8 6 3 10)  (0 4 5 8 3 9 10 1 11 7 6 2)  

mof3                         Gathering Ladma              Four-Nest                    
(0 4 6 3 8 11 10 5 2 7 1 9)  (0 4 7 8 1 11 9 3 10 5 6 2)  (0 4 10 6 1 2 7 8 11 3 9 5)  

CovFEfe                      Big Fockin' Deal             Donnie Wallboard             
(0 5 4 10 1 9 7 3 8 6 11 2)  (0 5 8 10 4 1 11 3 7 9 2 6)  (0 5 11 10 8 4 6 3 7 1 2 9)  

Billy's Childe               o26/o27                      Renuzit                      
(0 7 3 2 5 10 6 9 1 8 11 4)  (0 7 5 3 9 1 6 10 11 4 2 8)  (0 8 2 3 5 10 7 11 6 1 4 9)  

FlyTown                      Obvious Childe               Big Cad                      
(0 8 5 3 6 1 7 11 10 2 4 9)  (0 8 7 4 9 5 3 10 11 1 2 6)  (0 9 2 6 1 11 7 3 4 10 5 8)  

Loose Girlfriend             Nigel's Amp                                               
(0 10 2 7 11 9 4 3 1 8 5 6)  (0 10 4 8 7 3 1 6 11 5 9 2)
calebprime is online now   Quote this post in a PM   Nominate this post for this month's language award Copy a direct link to this post Reply With Quote Back to Top
Old 23rd February 2018, 10:04 AM   #186
calebprime
moleman
 
calebprime's Avatar
 
Join Date: Jul 2006
Posts: 11,822
I call it: Varwoche

Code:
0 1 6 3 2 8 7 4 11 5 10 9



0,  1,  6,  3,  2,  8,  7,  4,  11, 5,  10, 9
1,  3,  8,  4,  5,  9,  0,  6,  2,  7,  11, 10
3,  4,  9,  6,  7,  10, 1,  8,  5,  0,  2,  11
4,  6,  10, 8,  0,  11, 3,  9,  7,  1,  5,  2
6,  8,  11, 9,  1,  2,  4,  10, 0,  3,  7,  5
8,  9,  2,  10, 3,  5,  6,  11, 1,  4,  0,  7
9,  10, 5,  11, 4,  7,  8,  2,  3,  6,  1,  0
10, 11, 7,  2,  6,  0,  9,  5,  4,  8,  3,  1
11, 2,  0,  5,  8,  1,  10, 7,  6,  9,  4,  3
2,  5,  1,  7,  9,  3,  11, 0,  8,  10, 6,  4
5,  7,  3,  0,  10, 4,  2,  1,  9,  11, 8,  6
7,  0,  4,  1,  11, 6,  5,  3,  10, 2,  9,  8


Varwoche

C,  Db, Gb, Eb, D,  Ab, G,  E,  B,  F,  Bb, A
Db, Eb, Ab, E,  F,  A,  C,  Gb, D,  G,  B,  Bb
Eb, E,  A,  Gb, G,  Bb, Db, Ab, F,  C,  D,  B
E,  Gb, Bb, Ab, C,  B,  Eb, A,  G,  Db, F,  D
Gb, Ab, B,  A,  Db, D,  E,  Bb, C,  Eb, G,  F
Ab, A,  D,  Bb, Eb, F,  Gb, B,  Db, E,  C,  G
A,  Bb, F,  B,  E,  G,  Ab, D,  Eb, Gb, Db, C
Bb, B,  G,  D,  Gb, C,  A,  F,  E,  Ab, Eb, Db
B,  D,  C,  F,  Ab, Db, Bb, G,  Gb, A,  E,  Eb
D,  F,  Db, G,  A,  Eb, B,  C,  Ab, Bb, Gb, E
F,  G,  Eb, C,  Bb, E,  D,  Db, A,  B,  Ab, Gb
G,  C,  E,  Db, B,  Gb, F,  Eb, Bb, D,  A,  Ab
Varwoche is too cool for school:

Code:
number of rows found: 56

removing near-duplicates...done

number of rows remaining: 56

mof6B*                       mallalieu                    Double Aug                   
(0 1 3 9 4 7 11 2 10 5 8 6)  (0 1 4 2 9 5 11 3 8 10 7 6)  (0 1 5 9 2 8 7 11 3 10 4 6)  

Varwoche                     AIS#12                       E for Effort                 
(0 1 6 3 2 8 7 4 11 5 10 9)  (0 1 7 2 4 8 6 3 11 5 10 9)  (0 1 7 2 10 8 4 3 6 11 5 9)  

Melvin-Lieben                5p equals                    Five Large                   
(0 1 9 2 4 10 8 3 6 5 7 11)  (0 1 9 6 11 4 8 2 10 5 7 3)  (0 2 3 9 10 6 7 1 5 8 4 11)  

Caresst'TreeTendentiously    Degenerate                   (0 2 7 4 1 8 5 6 11 3 10 9)  
(0 2 5 3 10 6 1 4 9 11 8 7)  (0 2 5 4 10 7 11 6 9 1 3 8)                               

Dani                         Too Tuesday                  La La Land                   
(0 2 7 4 3 8 9 5 1 6 11 10)  (0 2 8 4 5 10 1 6 3 7 9 11)  (0 2 9 4 1 11 5 7 10 3 8 6)  

(0 2 9 4 7 11 10 6 5 8 2 1)  (0 2 9 5 6 11 10 7 4 8 3 1)  (0 2 11 5 7 1 10 8 6 9 4 3)  

Kix R 4 Trids                (0 3 1 6 10 4 8 9 5 2 11 7)  Usual Suspect                
(0 3 1 6 5 4 11 9 2 8 10 7)                               (0 3 2 6 4 5 10 9 11 7 1 8)  

Octopussy                    Roger Gnocco LeDuc           Approved                     
(0 3 4 6 11 7 9 1 8 2 5 10)  (0 3 4 7 2 9 8 11 10 5 6 1)  (0 3 7 6 4 10 8 9 2 11 5 1)  

Q-tips                       row 1*                       The Hedgehog                 
(0 3 8 4 7 9 1 6 5 10 2 11)  (0 3 8 10 7 11 5 1 4 2 9 6)  (0 3 9 5 4 10 8 7 2 6 1 11)  

(0 3 9 5 7 10 11 6 4 8 2 1)  Blue Heartburn               Jejune                       
                             (0 3 10 6 5 11 9 8 4 7 2 1)  (0 3 10 7 8 1 4 2 6 11 9 5)  

Mr. Hengist                  Reality Check                Malevich the Jewel Thief     
(0 3 11 6 8 2 1 9 7 10 5 4)  (0 3 11 6 10 2 4 9 8 1 7 5)  (0 4 2 7 1 5 9 11 8 6 3 10)  

(0 4 2 7 6 5 1 10 3 9 11 8)  (0 4 2 7 8 6 3 10 5 11 1 9)  Old Fiends                   
                                                          (0 4 5 8 3 9 10 1 11 7 6 2)  

mof3                         Ni of '73                    Gathering Ladma              
(0 4 6 3 8 11 10 5 2 7 1 9)  (0 4 6 10 7 3 11 1 8 2 5 9)  (0 4 7 8 1 11 9 3 10 5 6 2)  

Four-Nest                    CovFEfe                      Big Fockin' Deal             
(0 4 10 6 1 2 7 8 11 3 9 5)  (0 5 4 10 1 9 7 3 8 6 11 2)  (0 5 8 10 4 1 11 3 7 9 2 6)  

Donnie Wallboard             BC Perm                      Billy's Childe               
(0 5 11 10 8 4 6 3 7 1 2 9)  (0 7 2 1 4 9 5 8 6 10 3 11)  (0 7 3 2 5 10 6 9 1 8 11 4)  

Mu-tation                    o26/o27                      Cigar Bed                    
(0 7 4 2 11 1 6 10 9 5 3 8)  (0 7 5 3 9 1 6 10 11 4 2 8)  (0 7 9 11 4 2 5 10 8 6 1 3)  

Renuzit                      FlyTown                      Obvious Childe               
(0 8 2 3 5 10 7 11 6 1 4 9)  (0 8 5 3 6 1 7 11 10 2 4 9)  (0 8 7 4 9 5 3 10 11 1 2 6)  

Say I'm Sick                 Big Cad                      First Example                
(0 9 1 6 11 10 5 3 2 8 4 7)  (0 9 2 6 1 11 7 3 4 10 5 8)  (0 10 2 3 6 7 4 1 9 11 5 8)  

Loose Girlfriend             Nigel's Amp                                               
(0 10 2 7 11 9 4 3 1 8 5 6)  (0 10 4 8 7 3 1 6 11 5 9 2)
calebprime is online now   Quote this post in a PM   Nominate this post for this month's language award Copy a direct link to this post Reply With Quote Back to Top
Old 23rd February 2018, 10:11 AM   #187
calebprime
moleman
 
calebprime's Avatar
 
Join Date: Jul 2006
Posts: 11,822
Varwoche* and Dani are great, but they don't qualify for the sooper-ninja-ganja-assassin's club. I think it's sort of like Bohemian Grove.


Code:
removing near-duplicates...done

number of rows remaining: 16

mof6B*                       AIS#12                       5p equals                    
(0 1 3 9 4 7 11 2 10 5 8 6)  (0 1 7 2 4 8 6 3 11 5 10 9)  (0 1 9 6 11 4 8 2 10 5 7 3)  

Five Large                   (0 3 1 6 10 4 8 9 5 2 11 7)  Octopussy                    
(0 2 3 9 10 6 7 1 5 8 4 11)                               (0 3 4 6 11 7 9 1 8 2 5 10)  

Roger Gnocco LeDuc           Malevich the Jewel Thief     Old Fiends                   
(0 3 4 7 2 9 8 11 10 5 6 1)  (0 4 2 7 1 5 9 11 8 6 3 10)  (0 4 5 8 3 9 10 1 11 7 6 2)  

mof3                         Gathering Ladma              Four-Nest                    
(0 4 6 3 8 11 10 5 2 7 1 9)  (0 4 7 8 1 11 9 3 10 5 6 2)  (0 4 10 6 1 2 7 8 11 3 9 5)  

CovFEfe                      Donnie Wallboard             Obvious Childe               
(0 5 4 10 1 9 7 3 8 6 11 2)  (0 5 11 10 8 4 6 3 7 1 2 9)  (0 8 7 4 9 5 3 10 11 1 2 6)  

Loose Girlfriend                                                                       
(0 10 2 7 11 9 4 3 1 8 5 6)

* any connection to current ISF posters is strictly coincidental
calebprime is online now   Quote this post in a PM   Nominate this post for this month's language award Copy a direct link to this post Reply With Quote Back to Top
Old Yesterday, 08:59 AM   #188
calebprime
moleman
 
calebprime's Avatar
 
Join Date: Jul 2006
Posts: 11,822
ok, new series -- The French Connection, in this definition the collection is 43 series currently. Every series has at least 2 "shows".

Code:
C2,D#2,F#2,G2,A#2,C#3,E3,F3,G#3,A3,B3,D4

0 3 6 7 10 1 4 5 8 9 11 2
0 3 10 6 9 1 2 7 8 11 5 4  distinct!

The French Connection 

0,  3,  10, 6,  9,  1,  2,  7,  8,  11, 5,  4
3,  6,  1,  7,  11, 4,  0,  10, 9,  2,  8,  5
6,  7,  4,  10, 2,  5,  3,  1,  11, 0,  9,  8
7,  10, 5,  1,  0,  8,  6,  4,  2,  3,  11, 9
10, 1,  8,  4,  3,  9,  7,  5,  0,  6,  2,  11
1,  4,  9,  5,  6,  11, 10, 8,  3,  7,  0,  2
4,  5,  11, 8,  7,  2,  1,  9,  6,  10, 3,  0
5,  8,  2,  9,  10, 0,  4,  11, 7,  1,  6,  3
8,  9,  0,  11, 1,  3,  5,  2,  10, 4,  7,  6
9,  11, 3,  2,  4,  6,  8,  0,  1,  5,  10, 7
11, 2,  6,  0,  5,  7,  9,  3,  4,  8,  1,  10
2,  0,  7,  3,  8,  10, 11, 6,  5,  9,  4,  1


C,  Eb, Bb, F#, A,  Db, D,  G,  Ab, B,  F,  E
Db, E,  B,  G,  Bb, D,  Eb, Ab, A,  C,  F#, F
D,  F,  C,  Ab, B,  Eb, E,  A,  Bb, Db, G,  F#
Eb, F#, Db, A,  C,  E,  F,  Bb, B,  D,  Ab, G
E,  G,  D,  Bb, Db, F,  F#, B,  C,  Eb, A,  Ab
F,  Ab, Eb, B,  D,  F#, G,  C,  Db, E,  Bb, A
F#, A,  E,  C,  Eb, G,  Ab, Db, D,  F,  B,  Bb
G,  Bb, F,  Db, E,  Ab, A,  D,  Eb, F#, C,  B
Ab, B,  F#, D,  F,  A,  Bb, Eb, E,  G,  Db, C
A,  C,  G,  Eb, F#, Bb, B,  E,  F,  Ab, D,  Db
Bb, Db, Ab, E,  G,  B,  C,  F,  F#, A,  Eb, D
B,  D,  A,  F,  Ab, C,  Db, F#, G,  Bb, E,  Eb



C,  Eb, Bb, F#, A,  Db, D,  G,  Ab, B,  F,  E
Eb, F#, Db, G,  B,  E,  C,  Bb, A,  D,  Ab, F
F#, G,  E,  Bb, D,  F,  Eb, Db, B,  C,  A,  Ab
G,  Bb, F,  Db, C,  Ab, F#, E,  D,  Eb, B,  A
Bb, Db, Ab, E,  Eb, A,  G,  F,  C,  F#, D,  B
Db, E,  A,  F,  F#, B,  Bb, Ab, Eb, G,  C,  D
E,  F,  B,  Ab, G,  D,  Db, A,  F#, Bb, Eb, C
F,  Ab, D,  A,  Bb, C,  E,  B,  G,  Db, F#, Eb
Ab, A,  C,  B,  Db, Eb, F,  D,  Bb, E,  G,  F#
A,  B,  Eb, D,  E,  F#, Ab, C,  Db, F,  Bb, G
B,  D,  F#, C,  F,  G,  A,  Eb, E,  Ab, Db, Bb
D,  C,  G,  Eb, Ab, Bb, B,  F#, F,  A,  E,  Db
Code:
                                       modulus: 12
         wolf intervals (between any two notes): ()
                     display multiple spellings: #f
    acceptable error when naming scales (cents): 0
                                     sort order: (packing)
             abbreviated multiple-column output: #t
                                  output format: numbers
                       number of output columns: 3
                                     row length: 12
                                      bad cells: ((4 0 3 6 9) (3 0 1 2))
                    maximum number of bad cells: 0
                                     good cells: ()
                   minimum number of good cells: 0
      bad intervals (between consecutive notes): ()
                maximum number of bad intervals: 0
     good intervals (between consecutive notes): ()
               minimum number of good intervals: 0
          minimum number of different intervals: 3
   maximum number of same consecutive intervals: 2
             self-equivalence filter - standard: #f
                   self-equivalence filter - 5m: #f
              self-equivalence filter tolerance: 2
                         remove near-duplicates: #t
                       near-duplicate tolerance: 4
         wrap when counting cells and intervals: #f
      virtual row length, for computing spacing: 12
                                   motif length: 12
     look for standard transformations of motif: #t
           look for 5m transformations of motif: #f
                                minimum spacing: 2
                                maximum spacing: 8
minimum number of violations of min/max spacing: 0
maximum number of violations of min/max spacing: 1
                     minimum number of 1-spaces: 0
                     maximum number of 1-spaces: 4
  minimum number of occurrences of motif in row: 2
                    wrap when computing spacing: #t
              maximum number of rows to display: 2000
             

finding rows....done

number of rows found: 43

removing near-duplicates...done

number of rows remaining: 43

mof6B*                       mallalieu                    Double Aug                   
(0 1 3 9 4 7 11 2 10 5 8 6)  (0 1 4 2 9 5 11 3 8 10 7 6)  (0 1 5 9 2 8 7 11 3 10 4 6)  

Varwoche                     AIS#12                       E for Effort                 
(0 1 6 3 2 8 7 4 11 5 10 9)  (0 1 7 2 4 8 6 3 11 5 10 9)  (0 1 7 2 10 8 4 3 6 11 5 9)  

5p equals                    Five Large                   Caresst'TreeTendentiously    
(0 1 9 6 11 4 8 2 10 5 7 3)  (0 2 3 9 10 6 7 1 5 8 4 11)  (0 2 5 3 10 6 1 4 9 11 8 7)  

Degenerate                   (0 2 7 4 1 8 5 6 11 3 10 9)  Dani                         
(0 2 5 4 10 7 11 6 9 1 3 8)                               (0 2 7 4 3 8 9 5 1 6 11 10)  

Too Tuesday                  La La Land                   (0 2 9 4 7 11 10 6 5 8 2 1)  
(0 2 8 4 5 10 1 6 3 7 9 11)  (0 2 9 4 1 11 5 7 10 3 8 6)                               

(0 2 9 5 6 11 10 7 4 8 3 1)  (0 2 11 5 7 1 10 8 6 9 4 3)  (0 3 1 6 10 4 8 9 5 2 11 7)  

Octopussy                    Roger Gnocco LeDuc           row 1*                       
(0 3 4 6 11 7 9 1 8 2 5 10)  (0 3 4 7 2 9 8 11 10 5 6 1)  (0 3 8 10 7 11 5 1 4 2 9 6)  

(0 3 9 5 7 10 11 6 4 8 2 1)  Blue Heartburn               The French Connection        
                             (0 3 10 6 5 11 9 8 4 7 2 1)  (0 3 10 6 9 1 2 7 8 11 5 4)  

Jejune                       Mr. Hengist                  Reality Check                
(0 3 10 7 8 1 4 2 6 11 9 5)  (0 3 11 6 8 2 1 9 7 10 5 4)  (0 3 11 6 10 2 4 9 8 1 7 5)  

Malevich the Jewel Thief     Old Fiends                   mof3                         
(0 4 2 7 1 5 9 11 8 6 3 10)  (0 4 5 8 3 9 10 1 11 7 6 2)  (0 4 6 3 8 11 10 5 2 7 1 9)  

Gathering Ladma              Four-Nest                    CovFEfe                      
(0 4 7 8 1 11 9 3 10 5 6 2)  (0 4 10 6 1 2 7 8 11 3 9 5)  (0 5 4 10 1 9 7 3 8 6 11 2)  

Big Fockin' Deal             Donnie Wallboard             o26/o27                      
(0 5 8 10 4 1 11 3 7 9 2 6)  (0 5 11 10 8 4 6 3 7 1 2 9)  (0 7 5 3 9 1 6 10 11 4 2 8)  

Cigar Bed                    Renuzit                      FlyTown                      
(0 7 9 11 4 2 5 10 8 6 1 3)  (0 8 2 3 5 10 7 11 6 1 4 9)  (0 8 5 3 6 1 7 11 10 2 4 9)  

Obvious Childe               Big Cad                      Loose Girlfriend             
(0 8 7 4 9 5 3 10 11 1 2 6)  (0 9 2 6 1 11 7 3 4 10 5 8)  (0 10 2 7 11 9 4 3 1 8 5 6)  

Nigel's Amp                                                                            
(0 10 4 8 7 3 1 6 11 5 9 2)

Last edited by calebprime; Yesterday at 09:10 AM.
calebprime is online now   Quote this post in a PM   Nominate this post for this month's language award Copy a direct link to this post Reply With Quote Back to Top
Old Yesterday, 09:17 AM   #189
varwoche
Penultimate Amazing
 
varwoche's Avatar
 
Join Date: Feb 2004
Location: Puget Sound
Posts: 10,817
Damn, I'm going to have to buy a keyboard just to appreciate my own coolness.
__________________
To survive election season on a skeptics forum, one must understand Hymie-the-Robot.
varwoche is offline   Quote this post in a PM   Nominate this post for this month's language award Copy a direct link to this post Reply With Quote Back to Top
Old Yesterday, 09:24 AM   #190
Ron_Tomkins
Satan's Helper
 
Ron_Tomkins's Avatar
 
Join Date: Oct 2007
Posts: 41,810
So what about rhythm? This whole thing seems to only focus on melodic intervals. Is there an equivalent of this tone-row puzzle thingie for constructing different rhythms?
__________________
"I am a collection of water, calcium and organic molecules called Carl Sagan"

Carl Sagan
Ron_Tomkins is offline   Quote this post in a PM   Nominate this post for this month's language award Copy a direct link to this post Reply With Quote Back to Top
Old Yesterday, 09:44 AM   #191
calebprime
moleman
 
calebprime's Avatar
 
Join Date: Jul 2006
Posts: 11,822
Originally Posted by Ron_Tomkins View Post
So what about rhythm? This whole thing seems to only focus on melodic intervals. Is there an equivalent of this tone-row puzzle thingie for constructing different rhythms?
Yes, there's Babbitt and Boulez and Stockhausen, etc. for using the series as a source of rhythms. I refer you to history.


I personally don't serialize rhythm in the same way I serialize pitch.

I've expended a number of posts on the polyrhythmic implications and potential of some of this thinking, and there's a recording.

To repeat, the every-other square construction can be used for polyrhythms of any complexity.

-------------------

a little more on this.

If there are composition schools, I'd be in the Berg/Dallapiccola/Piston/Stravinsky/Copland even/ school, and for rhythmic influence, early Carter and some Nancarrow and some Cowell and Ives -- polyrhythms but not serialized like the pitches are.

You might want free parameters -- rhythm and register -- to be able to shape a row to your liking. I do.

The whole point of my serial techniques is to give myself a lot of control, a lot of freedom because I aim to be able to generate all possibilities within what I want to hear. Freedom through computer assistance and generational fecundity. It's cyborg composition, not possible without computer.

Last edited by calebprime; Yesterday at 10:13 AM. Reason: Dallapiccola
calebprime is online now   Quote this post in a PM   Nominate this post for this month's language award Copy a direct link to this post Reply With Quote Back to Top
Old Yesterday, 10:44 AM   #192
calebprime
moleman
 
calebprime's Avatar
 
Join Date: Jul 2006
Posts: 11,822
If we were to enlarge the discussion beyond tedious tone-rows and precious snowflakes, it might be this way: other kinds of techniques for self-similar composition.

The Infinity series type thing from Per Norgard would be an extension. I've been meaning to get around to trying to see if I can make my kind of more-chromatic music with his techniques, I'm sure I can. But getting a handle on it -- that might take a little while.

http://reactivemusic.net/?p=9246

I can't get this discussion to a Myriad-level superhypotheticalcaledociousism -- he'd like to talk about cellular automats and Wolfram.

I'm saying that there's an old and respectable compositional tradition for themes -- and you can think of rows as themes. Composers need concrete objects to be able to think about, perhaps. I do, at least. I can't think about abstract processes. I can think about notes, etc.

Last edited by calebprime; Yesterday at 10:46 AM.
calebprime is online now   Quote this post in a PM   Nominate this post for this month's language award Copy a direct link to this post Reply With Quote Back to Top
Old Yesterday, 11:59 AM   #193
calebprime
moleman
 
calebprime's Avatar
 
Join Date: Jul 2006
Posts: 11,822
I call this: Killing Ronn Slowly
0 3 10 6 7 1 11 9 5 8 4 2
calebprime is online now   Quote this post in a PM   Nominate this post for this month's language award Copy a direct link to this post Reply With Quote Back to Top
Old Today, 04:47 AM   #194
calebprime
moleman
 
calebprime's Avatar
 
Join Date: Jul 2006
Posts: 11,822
current roster with new additions and some basic filtering is 51 series:


Code:
                                        modulus: 12
         wolf intervals (between any two notes): ()
                     display multiple spellings: #f
    acceptable error when naming scales (cents): 0
                                     sort order: (packing)
             abbreviated multiple-column output: #t
                                  output format: numbers
                       number of output columns: 3
                                     row length: 12
                                      bad cells: ((4 0 3 6 9) (3 0 1 2))
                    maximum number of bad cells: 0
                                     good cells: ()
                   minimum number of good cells: 0
      bad intervals (between consecutive notes): ()
                maximum number of bad intervals: 0
     good intervals (between consecutive notes): ()
               minimum number of good intervals: 0
          minimum number of different intervals: 3
   maximum number of same consecutive intervals: 2
             self-equivalence filter - standard: #f
                   self-equivalence filter - 5m: #f
              self-equivalence filter tolerance: 0
                         remove near-duplicates: #t
                       near-duplicate tolerance: 4
         wrap when counting cells and intervals: #f
      virtual row length, for computing spacing: 12
                                   motif length: 12
     look for standard transformations of motif: #t
           look for 5m transformations of motif: #f
                                minimum spacing: 2
                                maximum spacing: 8
minimum number of violations of min/max spacing: 0
maximum number of violations of min/max spacing: 1
                     minimum number of 1-spaces: 0
                     maximum number of 1-spaces: 4
  minimum number of occurrences of motif in row: 1
                    wrap when computing spacing: #t
              maximum number of rows to display: 2000
            

finding rows....done

number of rows found: 51

removing near-duplicates...done

number of rows remaining: 51

mof6B*                       mallalieu                    Double Aug                   
(0 1 3 9 4 7 11 2 10 5 8 6)  (0 1 4 2 9 5 11 3 8 10 7 6)  (0 1 5 9 2 8 7 11 3 10 4 6)  

Varwoche                     AIS#12                       E for Effort                 
(0 1 6 3 2 8 7 4 11 5 10 9)  (0 1 7 2 4 8 6 3 11 5 10 9)  (0 1 7 2 10 8 4 3 6 11 5 9)  

5p equals                    Five Large                   Caresst'TreeTendentiously    
(0 1 9 6 11 4 8 2 10 5 7 3)  (0 2 3 9 10 6 7 1 5 8 4 11)  (0 2 5 3 10 6 1 4 9 11 8 7)  

Degenerate                   (0 2 7 4 1 8 5 6 11 3 10 9)  Dani                         
(0 2 5 4 10 7 11 6 9 1 3 8)                               (0 2 7 4 3 8 9 5 1 6 11 10)  

Too Tuesday                  La La Land                   (0 2 9 4 7 11 10 6 5 8 2 1)  
(0 2 8 4 5 10 1 6 3 7 9 11)  (0 2 9 4 1 11 5 7 10 3 8 6)                               

(0 2 9 5 6 11 10 7 4 8 3 1)  (0 2 11 5 7 1 10 8 6 9 4 3)  (0 3 1 6 10 4 8 9 5 2 11 7)  

Octopussy                    Roger Gnocco LeDuc           Q-tips                       
(0 3 4 6 11 7 9 1 8 2 5 10)  (0 3 4 7 2 9 8 11 10 5 6 1)  (0 3 8 4 7 9 1 6 5 10 2 11)  

row 1*                       The Hedgehog                 (0 3 9 5 7 10 11 6 4 8 2 1)  
(0 3 8 10 7 11 5 1 4 2 9 6)  (0 3 9 5 4 10 8 7 2 6 1 11)                               

Sticks and Stones            Blue Heartburn               Killing Ronn Slowly          
(0 3 9 5 8 10 2 7 6 11 4 1)  (0 3 10 6 5 11 9 8 4 7 2 1)  (0 3 10 6 7 1 11 9 5 8 4 2)  

The French Connection        Jejune                       Mr. Hengist                  
(0 3 10 6 9 1 2 7 8 11 5 4)  (0 3 10 7 8 1 4 2 6 11 9 5)  (0 3 11 6 8 2 1 9 7 10 5 4)  

Reality Check                Malevich the Jewel Thief     Old Fiends                   
(0 3 11 6 10 2 4 9 8 1 7 5)  (0 4 2 7 1 5 9 11 8 6 3 10)  (0 4 5 8 3 9 10 1 11 7 6 2)  

mof3                         Gathering Ladma              Four-Nest                    
(0 4 6 3 8 11 10 5 2 7 1 9)  (0 4 7 8 1 11 9 3 10 5 6 2)  (0 4 10 6 1 2 7 8 11 3 9 5)  

CovFEfe                      Big Fockin' Deal             Donnie Wallboard             
(0 5 4 10 1 9 7 3 8 6 11 2)  (0 5 8 10 4 1 11 3 7 9 2 6)  (0 5 11 10 8 4 6 3 7 1 2 9)  

BC Perm                      Billy's Childe               Mu-tation                    
(0 7 2 1 4 9 5 8 6 10 3 11)  (0 7 3 2 5 10 6 9 1 8 11 4)  (0 7 4 2 11 1 6 10 9 5 3 8)  

o26/o27                      Cigar Bed                    Renuzit                      
(0 7 5 3 9 1 6 10 11 4 2 8)  (0 7 9 11 4 2 5 10 8 6 1 3)  (0 8 2 3 5 10 7 11 6 1 4 9)  

FlyTown                      Obvious Childe               Say I'm Sick                 
(0 8 5 3 6 1 7 11 10 2 4 9)  (0 8 7 4 9 5 3 10 11 1 2 6)  (0 9 1 6 11 10 5 3 2 8 4 7)  

Big Cad                      Loose Girlfriend             Nigel's Amp                  
(0 9 2 6 1 11 7 3 4 10 5 8)  (0 10 2 7 11 9 4 3 1 8 5 6)  (0 10 4 8 7 3 1 6 11 5 9 2)
calebprime is online now   Quote this post in a PM   Nominate this post for this month's language award Copy a direct link to this post Reply With Quote Back to Top
Old Today, 08:13 AM   #195
calebprime
moleman
 
calebprime's Avatar
 
Join Date: Jul 2006
Posts: 11,822
The roster with new additions, in pitches starting on A:


Code:
number of rows found: 58

removing near-duplicates...done

number of rows remaining: 58

mof6B*                          mallalieu                       Double Aug                      
(A A# C F# C# E G# B G D F D#)  (A A# C# B F# D G# C F G E D#)  (A A# D F# B F E G# C G C# D#)  

Varwoche                        AIS#12                          E for Effort                    
(A A# D# C B F E C# G# D G F#)  (A A# E B C# F D# C G# D G F#)  (A A# E B G F C# C D# G# D F#)  

Melvin-Lieben                   5p equals                       Five Large                      
(A A# F# B C# G F C D# D E G#)  (A A# F# D# G# C# F B G D E C)  (A B C F# G D# E A# D F C# G#)  

Caresst'TreeTendentiously       Degenerate                      (A B E C# A# F D D# G# C G F#)  
(A B D C G D# A# C# F# G# F E)  (A B D C# G E G# D# F# A# C F)                                  

Dani                            Too Tuesday                     La La Land                      
(A B E C# C F F# D A# D# G# G)  (A B F C# D G A# D# C E F# G#)  (A B F# C# A# G# D E G C F D#)  

(A B F# C# E G# G D# D F B A#)  (A B F# D D# G# G E C# F C A#)  (A B G# D E A# G F D# F# C# C)  

Kix R 4 Trids                   (A C A# D# G C# F F# D B G# E)  Usual Suspect                   
(A C A# D# D C# G# F# B F G E)                                  (A C B D# C# D G F# G# E A# F)  

Octopussy                       Roger Gnocco LeDuc              Approved                        
(A C C# D# G# E F# A# F B D G)  (A C C# E B F# F G# G D D# A#)  (A C E D# C# G F F# B G# D A#)  

Q-tips                          Shame Shame Shame               row 1*                          
(A C F C# E F# A# D# D G B G#)  (A C F D# B F# D E A# C# G# G)  (A C F G E G# D A# C# B F# D#)  

The Hedgehog                    (A C F# D E G G# D# C# F B A#)  Sticks and Stones               
(A C F# D C# G F E B D# A# G#)                                  (A C F# D F G B E D# G# C# A#)  

Blue Heartburn                  Killing Ronn Slowly             The French Connection           
(A C G D# D G# F# F C# E B A#)  (A C G D# E A# G# F# D F C# B)  (A C G D# F# A# B E F G# D C#)  

Jejune                          Mr. Hengist                     Reality Check                   
(A C G E F A# C# B D# G# F# D)  (A C G# D# F B A# F# E G D C#)  (A C G# D# G B C# F# F A# E D)  

Malevich the Jewel Thief        (A C# B E D# D A# G C F# G# F)  (A C# B E F D# C G D G# A# F#)  
(A C# B E A# D F# G# F D# C G)                                                                  

Old Fiends                      mof3                            Gathering Ladma                 
(A C# D F C F# G A# G# E D# B)  (A C# D# C F G# G D B E A# F#)  (A C# E F A# G# F# C G D D# B)  

Four-Nest                       CovFEfe                         Big Fockin' Deal                
(A C# G D# A# B E F G# C F# D)  (A D C# G A# F# E C F D# G# B)  (A D F G C# A# G# C E F# B D#)  

Donnie Wallboard                BC Perm                         Billy's Childe                  
(A D G# G F C# D# C E A# B F#)  (A E B A# C# F# D F D# G C G#)  (A E C B D G D# F# A# F G# C#)  

Mu-tation                       o26/o27                         Cigar Bed                       
(A E C# B G# A# D# G F# D C F)  (A E D C F# A# D# G G# C# B F)  (A E F# G# C# B D G F D# A# C)  

Renuzit                         FlyTown                         Obvious Childe                  
(A F B C D G E G# D# A# C# F#)  (A F D C D# A# E G# G B C# F#)  (A F E C# F# D C G G# A# B D#)  

Say I'm Sick                    Big Cad                         Loose Girlfriend                
(A F# A# D# G# G D C B F C# E)  (A F# B D# A# G# E C C# G D F)  (A G B E G# F# C# C A# F D D#)  

Nigel's Amp                                                                                     
(A G C# F E C A# D# G# D F# B)
calebprime is online now   Quote this post in a PM   Nominate this post for this month's language award Copy a direct link to this post Reply With Quote Back to Top
Reply

International Skeptics Forum » General Topics » History, Literature, and the Arts

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -7. The time now is 12:48 PM.
Powered by vBulletin. Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
2014, TribeTech AB. All Rights Reserved.
This forum began as part of the James Randi Education Foundation (JREF). However, the forum now exists as
an independent entity with no affiliation with or endorsement by the JREF, including the section in reference to "JREF" topics.

Disclaimer: Messages posted in the Forum are solely the opinion of their authors.