# Arpeggiate by numbers

Automated composition, music theory and tools therefor.

Colin Morris' SongSim visualises lyrics, in fact, not notes, but wow don't they look nice?.

Where my audio software frameworks page does more DSP, this is mostly about MIDI; choosing notes. A specialisation of Generative art with machine learning,

Sometime you don't want to measure a chord, or see a chord, you just want to write a chord.

See also machine listening, musical corpora, musical metrics, synchronisation. The discrete symbolic cousin to analysis/resynthesis project.

Related projects: How I would do generative art with neural networks and learning gamelan.

## To understand

Dmitri Tymozcko claims, music data is most naturally regarded as existing on an orbifold (“quotient manifold”), which I'm sure you could do some clever regression upon but I can't yet see how. Orbifolds are, AFAICT, something like what you get when you have a bag of regressors instead of a tuple, and are reminiscent of the string bag models of the natural language information retrieval people, except there is not as much hustle for music as there is for NLP. Nonetheless manifold regression is a thing, and regression on manifolds also, so there is probably some stuff done there, as documented at arpeggiate by numbers.

Also it's not a single scalar (which note) we are predicting here, and not just a distribution of a single output; (probability of each notes). At the very least it's the co-occurence of several notes.

More generally, it's the joint distribution of the evolution of the harmonics and the noise and all that other stuff that our ear can resolve and which can be simultaneously extracted. And we know from psycho-accoustics that these will be coupled - dissonance of two pure tones depends on frequency and amplitude of each of those components, for example.

In any case, these wrinkles aside, if I could predict the conditional distribution of the sequence in a way that produced recognisably musical sound, then simulate from it, I would be happy for a variety of reasons.

So I guess this page is “nonparametric vector regression on an orbifold”. Hmm.

## Interesting examples

Deep Bach (paper HaPa16, code) seems to be doing a related thing. Similar sets of authors (HaSP16) have some other related work):

Modeling polyphonic music is a particularly challenging task because of the intricate interplay between melody and harmony. A good model should satisfy three requirements: statistical accuracy (capturing faithfully the statistics of correlations at various ranges, horizontally and vertically), flexibility (coping with arbitrary user constraints), and generalization capacity (inventing new material, while staying in the style of the training corpus). Models proposed so far fail on at least one of these requirements. We propose a statistical model of polyphonic music, based on the maximum entropy principle. This model is able to learn and reproduce pairwise statistics between neighboring note events in a given corpus. The model is also able to invent new chords and to harmonize unknown melodies. We evaluate the invention capacity of the model by assessing the amount of cited, re-discovered, and invented chords on a corpus of Bach chorales. We discuss how the model enables the user to specify and enforce user-defined constraints, which makes it useful for style-based, interactive music generation.

## Random ideas

• How to reconstruct a piece from its recurrence matrix, or at least constrain pieces by their recurrence matrix;

• Composition path dependence: If everything were ordered by equilibrium, then orchestras would tend toward a Pareto optimal distribution of french horn. How to capture time dependence? How to quantify “motifs”?

• Can I use a chain graph to do this?

• Evan Chow represents for team non-deep-learning with jazzml:

Computer jazz improvisation powered by machine learning, specifically trigram modeling, K-Means clustering, and chord inference with SVMs.

• There are a whole bunch of neural-network-based approaches - see generative art & neural networks

## Helpful software for the musically vexed

• Fabrizio Poce's J74 progressive and J74 bassline are some chord progression generators from his library of clever chord generators linked in to Ableton Live's scripting engine, so if you are using Ableton they might be handy. They are cheap (EUR12 + EUR15). I use them myself, but they DO make Ableton crash a wee bit, so not really suited for live performance, which is a pity because that would be a wonderful unique selling point. The realtime-oriented J74 HarmoTools from the same guy are less sophisticated but worth trying, especially since they are free, and he has lot of other clever hacks there too. Basically, just go to this guy's site and try his stuff out. You don't have to stop there.

• Odesi (USD49) has been doing lots of advertising and has poptastic interface to pop music. It's like Synfire-lite with a library of top 40 tricks and rhythms. The desktop version tries to install gigabytes of synths of meagre merit on your machine, which is a giant waste of space an time if you are using a computer with synths on, which you are because this is not the 90s.

• Helio is free and cross platform and totally worth a shot. There is a chord model in there and version control (!) but you might not notice the chord thing if you aren't careful, because the UI is idiosyncratic.

• Mixtikl / Noatikl are grandaddy apps for this, although the creators doubtless put much effort into the sleek user interfaces, their complete inability to explain their app or provide compelling demonstrations or use cases leave me cold. I get the feeling they had high-art aspirations but have ended up basically doing ambient noodles in order to sell product. Maybe I'm not being fair. Not rich enough to find out. (USD25/USD40)

• Rapid Compose (USD99/USD249) might make decent software, but can't really explain why their app is nice or provide a demo version.

• synfire explains how it uses music theory to do large-scale scoring etc. Get the string section to behave itself or you'll replace them with MIDIbots. (EUR996, so I won't be buying it, but great demo video.)

• harmony builder does classical music theory for you. USD39-USD219 depending on heinously complex pricing schemes. Will pass your conservatorium finals.

• You can't resist rolling your own? sharp11 is a node.js music theory library for javascript with demo application to create jazz improv.

• Supercollider of course does this and everything else, but designing user interfaces for it will take years off your life. OTOH, if you are happy with text, this might be a goer.

## Constraint Composition

All of that too mainstream? Try a weird alternative formalism! How about constraint composition? That is, declarative musical composition by defining constraints on the relations which the notes must satisfy. Sounds fun in the abstract but the practice doesn't grab me especially as a creative tool.

The reference here is strasheela built on an obscure, unpopular, and apparently discontinued Prolog-like language called “Oz” or “Mozart”, because using popular languages is not a grand a gesture as claiming none of them are quite Turing complete enough, in the right way, for your special thingy.

That language is a bit of a ghost town, which means headaches if you wish to use it in practice; If you wanted to actually do this, you'd probably use overtone + minikanren (prolog-for-lisp), as with the composing schemer, or to be even more mainstream, just use a conventional constraint solver in a popular language. I am fond of python and ncvx, but there are many choices.

Anyway, prolog fans can read on: see Anders and Miranda (AnMi10, AnMi11)