Archive for November, 2011

Harmonic dissonance in 12-TET

I made this post in LaTeX, because it involves complicated math equations. Here it is.

Leave a comment

Harmonic Consonance/Dissonance: Just Intonation

In this post I describe a metric for measuring harmonic consonance in the music AI. (Actually, the measure is of dissonance. We think of maximum consonance as zero dissonance.)

The assumption is that what we perceive as consonance and dissonance has simple mathematical roots. This is easy to believe. If one looks at the waveforms of consonant versus dissonant sounds, they differ in a consistent way. Furthermore, we know that the dissonant intervals have more complex ratios than the consonant intervals. All of this suggests the possibility of mathematically quantifying consonance and dissonance. I shall give an equation which I think does this.

That said, I do not think that this measure perfectly equals what humans perceive as consonance/dissonance. I think it lines up quite well; but I imagine that there are little quirks of our psychology which cause our perceptions to be at variance from the mathematical idealization of consonance/dissonance. In particular, I think that our social conventions surrounding music affect our perceptions of consonance/dissonance.

For instance, the model I give makes the diminished fifth significantly less dissonant than I would have expected it to be relative to the other intervals. I think that this is because Western harmony is constructed such that it almost never uses the diminished fifth, and so our social conventions depart from the mathematical idealization in this case.

Dissonance always involves “beating:” the interaction of frequencies which results in an irregular pattern of vibration. We can quantify the amount of beating by measuring the amount of time it takes for the pattern of vibration to repeat itself. We can measure this by taking the least common multiple of the wavelengths of the notes involved.

So suppose that there are n notes playing at a given moment, which have wavelengths w1, w2, …, wn. Then the dissonance D is, as a first approximation:

D = LCM(w1, w2, …, wn).

In order for this formula to work, the wavelengths must be rational numbers. We use just intonation for this purpose. The wavelengths across the piano keyboard are:

C0 = 1
Db0 = 15/16
D0 = 8/9
Eb0 = 5/6
E0 = 4/5
F0 = 3/4
Gb0 = 5/7
G0 = 2/3
Ab0 = 5/8
A0 = 3/5
Bb0 = 4/7
B0 = 8/15
C1 = 1/2
Db1 = 15/32
D1 = 4/9
Eb1 = 5/12
E1 = 2/5
F1 = 3/8
Gb1 = 5/14
G1 = 1/3
Ab1 = 5/16
A1 = 3/10
Bb1 = 2/7
B1 = 4/15
C2 = 1/4
etc.

This formula has the advantage that it results in lower notes contributing more dissonance than higher notes. This aligns with practical experience; a major third between C0 and E0 is much more dissonant than a major third between C5 and E5.

The first problem with this formula is that it does not take account of the fact that different notes may have different volumes. This is simple enough to fix. Let v1, v2, …, vn be the volumes of the different notes. Then:

D = root(v1 * v2 * … * vn, n) * LCM(w1, w2, …, wn)

(To be clear, root(a, b) is the bth root of a.)

There is still a problem with this formula, which is that it assumes that the instrument is tuned in just intonation. In fact it is tuned in 12-TET. This means that intervals such as C5-G5 are more dissonant than this formula predicts, and intervals such as C#5-F#5 are less dissonant. The latter type of problem is more serious, since with this formula, the AI would think that it could not safely use the interval C#5-F#5, whereas in fact it can.

And that is about where I am at. I don’t yet know how to translate this formula to work with 12-TET. It can’t be the same formula, because the least common multiple operation only works on rational numbers, and the wavelengths in 12-TET are irrational numbers. So my next task is to adapt this formula to 12-TET.

Leave a comment

Concept Language

In this post I describe the concept language of the music AI. It is based on fuzzy first-order logic.

It has two data types: phrases, and floating point numbers.

Phrases are of two types: notes, and complex phrases. Complex phrases are phrases consisting of a set of sub-phrases.

Notes have three properties: pitch (0 to 87, for the 88 piano keys), velocity (0 to 127 — the MIDI velocity values), and duration (in ticks — some unit of time).

Complex phrases are sequences (the order is arbitrary) of phrases. Each phrase is coupled with an offset value, saying how many ticks away from the start the phrase is.

A truth value is a number between 0.0 (false) and 1.0 (true).

The following primitive constants are defined:
* Zero.
* The empty complex phrase (nil).

The following primitive functions are defined (and possibly others that prove useful):

* Successor, addition, subtraction, multiplication, division, round down.
* Note pitch, note velocity, note duration.
* Number of sub-phrases in a complex phrase.
* Duration in ticks of a complex phrase.
* Make note with a given pitch, velocity, and duration.
* Non-destructively add sub-phrase to complex phrase. (cons)

The following operations (from the definition of primitive recursive functions) can be used to make new functions:

* The projection functions.
* Composition.
* Primitive recursion.

The following primitive predicates are defined (and possibly others that prove useful):

* Is a number? Is an integer? Is a phrase? Is a note? Is a complex phrase?
* Less than, greater than, equals, less than or equal, greater than or equal.
* Number is in range of possible note pitches.
* Number is in range of possible note velocities.

The following operations can be used to make new predicates:

* Not P, P and Q, P or Q, P xor Q, P only if Q, P iff Q.
* Truth value of P is {equal to, less than, greater than, less or equal, greater or equal} N.
* Given a number 0.0 <= N <= 1.0, yield truth-value N.
* Universal and existential quantifiers over the members of a specified complex phrase. (The quantifier creates variables for both the sub-phrase and its offset.)
* Universal and existential quantifiers over a specified range of integers.

Predicates can take data parameters, and substitute them in the body of the predicate. Predicates can invoke other predicates. There cannot be circular dependencies in the invocation graph; direct or indirect recursion is not allowed.

This language is primitive recursive, rather than recursive. This means that it is impossible to write functions or predicates that take infinite time to compute.

Leave a comment

Music AI

I am thinking of writing an artificial intelligence to compose music. Here are some design ideas.

The idea is that he starts with nothing but an algorithm, generates music, and then learns from his own experiences to become better at generating music. He follows the same process that the history of music followed: semi-random experimentation guided by experience and evolving over time.

For simplicity, he will write piano pieces. There needs to be a representation for arbitrary-sized phrases of music, along the lines of MIDI.

There will be a “corpus” of already generated phrases which were judged to be good. The corpus is referenced during the process of composition, and changed by the process of composition.

There will be “concepts,” which describe properties of phrases. For instance, “major third” could be a concept; as could “accelerando.”

Concepts will be predicates in first-order fuzzy logic, which a given phrase can satisfy or not satisfy. There will be built-in primitive concepts (e.g., “C5,” “velocity 50”), and it will be possible for the AI to think of arbitrary concepts using a logical language.

There will be a “language,” which is the set of concepts that are applied in composition. The language evolves over time.

Phrases will be judged as good or bad according to a judgment metric. The metric which I am currently thinking of has four components: consonance, novelty, richness, and unity.

Consonance is a measure of the ground-level properties of music which make it pleasant or jarring as we perceive it. The most obvious component of this is harmonic (y-axis) consonance. I also want to define something like consonance for the rhythmic (x-axis) and melodic (x+y-axis) properties of music.

Novelty is a measure of how similar the phrase is to other phrases (of similar length) which exist in the corpus. Similarity is measured by conceptual closeness. Less similarity is better. The novelty of the sub-phrases is part of this measure.

Richness is a measure of how many concepts the phrase satisfies. More is better. The richness of the sub-phrases is part of this measure.

Unity is some measure of how well the sub-phrases fit together. I don’t know what that will look like.

So there is one fixed metric (consonance), and three metrics (novelty, richness, and unity) which are dependent upon the corpus and the language, and so evolve over time.

He generates phrases by some as yet unknown means, drawing on the language and the corpus, and incorporating randomness. He judges the generated phrases, and puts the good ones into the corpus.

The corpus shall have a limited size, and periodically the worst phrases will be culled from it.

New concepts will also periodically be generated, by some as yet unknown means. The simplest thing would be to make random variations on the concepts in the language and judge them — i.e., a genetic algorithm.

Concepts also have a judgment metric. The language, like the corpus, has a limited size, and periodically has the worst concepts culled from it. The judgment metric I am thinking of right now has three components: simplicity, usefulness, and distinctness.

Simplicity is a measure of how many moving parts the concept has. If a concept incorporates other concepts into its definition, the complexity of those concepts is not part of the concept’s complexity.

Usefulness is a measure of how many times the concept appears in the corpus, and how many times another concept uses it in its definition. More is better.

Distinctness is a measure of how different the concept is from every other concept in the language. It is measured by statistical anti-correlation with other concepts in the corpus.

When he runs, the process will look like this. Generate phrases; update the corpus. Generate concepts; update the language. Repeat forever.

Leave a comment

Materialism

My year-long struggle with materialism may finally be ended.

I shall summarize the problem. For a long time I objected to materialism without knowing why. Eventually I made a concerted attempt to articulate my problems with it.

It turns out that my strongest ethical intuition is that whatever happens is good and acceptable. There is no true wrongness in existence. Ethics consists of following the way of the universe, without fighting for or against anything. My inability to believe in badness constrains my worldview significantly.

Every sufficiently developed metaphysics implies an ethics, and every sufficiently developed ethics implies a metaphysics. For instance, Christianity has both a metaphyics (God exists, Jesus is his son sent to save humanity, we go to heaven or hell when we die) and an ethical theory (be a good Christian). The metaphysics and the ethics do not make sense without each other. If the metaphysics is false, then it makes no sense to follow the ethics. If the metaphysics is true, then the ethics are the only ethics that it makes sense to follow. We may make similar comments about every religion. Each religion gives us a metaphysics and an ethics which cannot be separated from each other.

Materialism is a metaphysics, so under our theory it must imply an ethics. What ethics does it imply? Precisely this: that nothing objectively matters, and we can choose to hold whatever value system we care to hold. Note carefully that under many metaphysics, this is not true.

For a long time I rejected materialism because I did not agree with the ethics that it implied. To me, materialism was a despairing worldview. The chief problem I had was that materialism does not place inherent value on humanity or enlightenment. The most serious problem was the idea that we die with our bodies. It seemed wrong to me that human existence should be limited and finite, and that it should be possible for this thing, the only thing of value, to be destroyed by unconscious, amoral, and random forces.

I felt that the world existed for the sake of humans, and humans existed for the sake of God. The goal of the natural world was to become human, and the goal of humans was to become God. This ethics necessarily implies a metaphysics. It requires us to postulate the existence of God, postulate reincarnation, and in doing so reject materialism.

An additional aspect of my problem was my inability to believe in true badness. I cannot believe in hopeless situations. It could conceivably be the case that humans are what matter, and that human existence is limited, finite, and subject to arbitrary annihilation. But under this worldview, evil exists. So I cannot hold this view.

At this point the only solution I saw was to reject materialism. But this was difficult for me to do, because I felt that I might be deceiving myself. There is no observable evidence to the effect that materialism is false. Materialism is, if not definitely true, certainly a possibility that is not ruled out by the evidence. The only thing that ruled it out was my ethics. Being a logical person, I was not comfortable with this.

A couple nights ago I came to a resolution of this problem, and possibly the end of my long struggle with materialism. I came to believe in the possibility — though not the certainty — that materialism is true. In order to do this I had to become emotionally OK with the possibility.

The dam broke when I realized that dying and permanently ceasing to be conscious could be like enlightenment. I thought, maybe humanity and consciousness is a cosmic accident that has no bearing on anything, and the universe as it is, dead and amoral and unconscious, is just fine without it. I was able to believe this, and be OK with it.

In part I was able to believe it because it lined up well with things I already felt. I already saw humanity as a piece of gum on a giant cosmic shoe. I already felt that the way of the universe was askew from human concerns, and that really our existence was subordinate to the existence of another force unimaginably vaster and grander than ourselves.

These were never propositions of despair for me, because I always saw the higher force as good. I always wanted to be on its side. Thus, my only ethics was to follow the way of the universe. Whatever the higher force wants, I want. If this isn’t true, then I just need to change what I want until it is in conformity with the way of the universe.

So I translated the foregoing ideas into the context of materialism. Under materialism, the universe doesn’t care about humanity. OK, then; if materialism is true, then I don’t care about humanity. If it’s possible for me to die, then I am OK with dying. If it’s possible for the whole human race to be gobbled up by nanobots in the next ten minutes, then I can accept that as a good outcome.

I’m OK with the idea that a human is not a more valuable form of existence than say, a star or a squirrel or a rock. I’m OK with the idea that consciousness is not more valuable than unconsciousness, that intelligence is not more valuable than unintelligence. If that’s true, then when we die we just change to a different form which is neither better nor worse.

My impulse to believe in universal goodness is, apparently, so strong that I am more ready to stop caring about humanity than I am to stop having faith in the way of the universe.

I am not at all depressed any more by the idea that materialism is true. Actually, it has broken down the walls between myself and nature. I used to be caught in the Enlightenment idea that humans are superior to nature and that it exists for us. Now I feel that we are one with nature and not superior to it. All physical things appear more wonderful to me now that I see them as being as valuable as I am.

Under materialism, nothing matters. But this does not have to be a proposition of despair. If nothing matters, then by virtue of this everything is beautiful and acceptable.

2 Comments

Bodily Impulses

Let us consider bodily impulses such as desire, fear, pleasure, and pain. Each of is learning some lessons surrounding these impulses. For instance, for a long time I have had habits of eating sweet foods and smoking tobacco. In the case of sweets, I wanted to stop myself from eating them for quite a while; but I found myself unable to prevent this. Eventually my failure to stop led me to question whether or not I should be trying to stop at all.

Other lessons I am learning have to do with sexuality and romance: my attractions to women, my anxiety when I feel I have a chance with a woman, my attachment when I am with a woman, the pain and despair I feel when I lose a woman, etc.

For a long time I felt that it was appropriate to deny all of my bodily impulses: all desires, anxieties, pleasures, and pains. I now believe that this is not helpful.

Every one of our bodily impulses has something helpful to offer us. If we did not become afraid when standing at the edge of a cliff, for instance, it would be more difficult for us to stay alive and continue to learn the lessons which we incarnated in order to learn. If we did not desire sex intensely, then a similar problem would occur.

More profoundly, pleasurable experiences such as sex, eating, and smoking help us by shedding light on the joyous, sensual, and loving aspects of the Creator, greatly accelerating our ability to learn about these things.

Sex and everything connected with it — relationships, marriage, children, etc. — offer us one of the greatest opportunities which we have to learn the lessons of love.

Pain and suffering can speak volumes of poetry on the love and light of the Creator to one who is able to listen. The hardest, darkest experience can be transformed into the light of the brightest day, if it is worked with in the proper way.

Pain and suffering are challenges; they are an opportunity to learn very quickly and intensively, and accelerate our growth into more joyous regions of being. Without suffering it would be much harder to learn.

So every bodily impulse has something helpful to offer us. But we also know that they create numerous problems. Pain hurts, while pleasure results in attachment that tends to lead to pain further down the line, and operates as a distraction from the Creator. The problems created by bodily impulses reach the peak of their complexity in romantic relationships, where we weave elaborate webs of emotions in which we can get very lost and hurt.

My previous solution to these problems was to deny my bodily impulses. It is easy to find recommendations to do this in the spiritual literature. But I now believe that this is not the appropriate solution.

As I see it now, denying one’s bodily impulses illustrates wisdom without love; while indulging to excess in one’s bodily impulses illustrates love without wisdom. The trick is to accept one’s bodily impulses, and allow oneself to feel these things, while remaining detached.

Denying one’s impulses prevents one from learning anything from them; while indulging in them fully, without any attempt at balance, also prevents one from learning anything from them. One can use one’s bodily impulses as a tool for learning by attempting to approach them balanced between love and wisdom, facing each situation — among the manifold learning opportunities created by a given impulse — with an eye towards taking this next step in the dance in the most graceful manner possible.

1 Comment

My Past Lives

Here is everything I have figured out about my existence prior to this incarnation.

I am under the impression that I am a Wanderer from Ra. This is mostly an inference.

I began to believe that I was a Wanderer because this seemed like the best explanation for why I am spiritually powerful, and why I feel so different from everybody else, and why I feel so dissociated from the opinions, norms, and values of this species.

The question arises of which density I am from. Fourth density is out of the question, because I am not sufficiently loving, and too wise, to be of that origin. That leaves fifth or sixth density. Both seem like distinct possibilities, but sixth density seems more likely, for two reasons. First, a great proportion of my lessons of this incarnation have had to do with balancing love and wisdom, which is the work of sixth density. Second, Ra states that the great majority of Wanderers on Earth right now are from sixth density.

So I think that I am a sixth density Wanderer. This is probably a very common identity among spiritual seekers right now.

I began to suspect that my origin was the social memory complex Ra because this seemed like the best explanation for why I felt such an intense metaphysical pull to Ra’s philosophy. I had some telepathic experiences which corroborated the hypothesis.

A Wanderer from Ra is probably also a fairly common thing to be. Since Ra belongs to this solar system, there are probably a significant number of Wanderers from Ra on Earth.

So originally I did my third density work on Venus, and I progressed through the fourth and fifth densities, and into the sixth.

I hypothesize that I am a specialist in wandering, having cultivated the skill of penetrating the third-density forgetting to a high degree. So I find it likely that I have wandered to planets other than Earth in the past.

I know that I have been on Earth for more than one incarnation. I do not know how many.

I remember some details about my last incarnation. I was an occultist living somewhere in Europe, or perhaps in America. I was very unhappy, and a bit of a misanthrope.

My lessons were defined by a duality between my tendency to get overly lost in my intellect, and my neuroses surrounding romance. In my intellectual inquiries I would detach myself from my emotions, and eventually they would painfully catch up with me.

I worked with John Dee’s system of occultism. I practiced perceiving and understanding archetypes — an ability which I easily remembered in this incarnation. I was often frustrated with my intellectual inquiries, because I felt that they were leading me nowhere.

I also played the piano — an activity which I picked up again for a few years in this incarnation. In both cases it served the same function: to balance my detachment from my emotions.

I died on a respirator, with pain in my right hand.

A great many patterns continued from that incarnation into this one. Most of the problems I have now are problems that I had in my last life. But, I’ve made a lot of progress on those problems, and I’ve found my way into a place more filled with hope.

Besides my memories of my last incarnation, I have a memory of being in an Indian body and meditating on a mountain. This is presumably from an incarnation before my last one.

Leave a comment