> ## Content Index
> Fetch the complete content index at: https://0x57.cc/llms.txt
> Use this file to discover other available public pages before exploring further.

# Behind Auto Curate
- URL: https://0x57.cc/behind-auto-curate/
- Published: 2026-11-01T06:12:05.000Z
- Updated: 2026-11-02T05:05:30.000Z
- Description: Inside Curator's low-profile features.
- Author: xy057
- Tags: 4th Wall

In Curator 0.7.0, auto-curate was introduced: a simple, lightweight system to find what should be curated.

## What is that?

Curator displays the most central part of the full score in a compact way. Sheet music is long, so it needs to display only part of it.

The highly abstracted algorithm is:

- If a player is playing, show them.
- If they rest for a single bar, keep them.
- If the staves don’t fit, hide the least important ones first.

An AI model might achieve this at a much higher quality, but it's too heavy for the program, and since users would tweak them anyway, the goal is to give a relatively comprehensive draft for them to work on instead of manually curating everything.

## Setup

Imagine the score is a giant spreadsheet ($S$), where the horizontal lane corresponds to one part ($P$), and the vertical lane corresponds to the measure ($M$).

![](https://0x57.cc/content/images/2026/10/image-1.png)

In this case, we assume that if a grid has value \`1\`, it will be shown; if it has value \`0\`, it will be hidden.

The spreadsheet could be expressed as 

$$S \\in \\{0,1\\}^{P\\times M}$$

such that $S$ never overflows, while trying to achieve

$$\\max\_S \\sum\_{p,m} w\_{p,m}\\,S\_{p,m}$$

where $w\_{p,m}$ is the "weight" (importance) of the displayed grid.

One of the main conflicts is that there's no formula for calculating overflows, which means that overflow checks could only be performed by engraving the entire score, which is a pretty performance-heavy action. So it is important to minimize overflow checks.

## First step: What's playing?

Assume

$$a\_{p,m} = \\begin{cases}1 & \\text{It's playing on measure } m \\text{ .}\\\\ 0 & \\text{It's resting}\\end{cases}$$

We'll get a sequence of all notes' appearances.

As said before, we need to fill the holes to prevent too much section jumping.

Take a single row for example: we could rewrite every 1 as an interval $\[s,e)$, where $s$ is the end of the rest, and $e$ the start of another rest.

If $e\_{k} + b \\geq s\_{k+1}$, where b is the "bridge threshold", "bridge" these intervals and merge them into a single one.

A simple example would be:

![](https://0x57.cc/content/images/2026/10/image-2.png)

Initially, we have 3 intervals: $\[1,3)$, $\[4,5)$, and $\[7,8)$. Assume we defined $b = 1$; then:

- Between $\[1,3)$ and $\[4,5)$: because $3 + 1 \\geq 4$, they will merge into $\[1,5)$
- Between $\[1,5)$ and $\[7,8)$: because $5 + 1 < 7$, they will not merge.

Here's what's left after the operation:

![](https://0x57.cc/content/images/2026/10/image-3.png)

👁️‍🗨️

On pieces like 4'33", the algorithm will produce the most accurate representation of the piece. Try it out!

## Second step: What's your rating?

🎵

The algorithms included in this section are implemented, but not finalized yet; they might drastically change in the near or distant future.

After all this cleaning, we now have a very basic sheet. The next step would be to rate them, so they don't overflow; a 16:9 screen really can't fit the 22 lines of instruments.

Every cell would be rated with a score between 0 and 1, written as $\\sigma\_{p,m}$.

### How loud are you?

As is common knowledge, a louder part usually draws more attention. That is the first metric: Dynamics ($\\delta$).

Here's the table being used by Curator.

| Markings  | ppp  | pp   | p    | mp   | mf   | f   | ff   | fff  |
| --------- | ---- | ---- | ---- | ---- | ---- | --- | ---- | ---- |
| $\\delta$ | 0.15 | 0.25 | 0.35 | 0.45 | 0.55 | 0.7 | 0.85 | 0.95 |

🎼

Additionally, sf, fp, fz, and sfp are assigned 0.7; sfz, sffz, rf, and pf are assigned 0.75, 0.85, 0.65, and 0.6 respectively. pppppp is assigned 0, and anything more than fff is assigned 1 in Curator.

Like how dynamics work in real music, a bar’s value is the loudest marking inside it. Bars without markings carry on the last marking written; before the first marking, it will default to mf.

⚠️

Hairpins are not supported yet.

### How active are you?

Now, this is a compromise. Since there's no way a simple formula could capture the activity of an interval, this section might be improved.  
Its activity is represented by $\\mu$.

The first step would be to flatten all the notes in the section. In this case, only the top note of a chord is kept; the process is named "skyline".

![](https://0x57.cc/content/images/2026/10/image-4.png)

Activity example

Then, it's converted to MIDI note numbers, and then saved as $x\_k$, where k is the order of the notes.

#### Motion

$|x\_{k+1}-x\_k|$ would give us the jumping distance between 2 notes; the absolute value is used here to unify ascending and descending. Then, we sum them, get the average distance, and use a "full mark line" constant to indicate whether it's "jumpy" enough.

Formatting all the information above, we would get:

$$\\text{motion} = \\min\\!\\left(1,\\ \\frac{1}{4}\\cdot\\frac{1}{n-1}\\sum\_{k=1}^{n-1}|x\_{k+1}-x\_k|\\right)$$

The outer $\\min()$ is to ensure that the total score wouldn't explode.

Still using the same example above, we could calculate the result by hand: $|69-67|=2$, $|72-69|=3$, $|67-72|=5$, average $\\frac{10}{3}\\approx3.33$, motion $=\\frac{3.33}{4}\\approx0.83$

#### Range

It's pretty straightforward, as it's just max - min with a "full mark line".

$$\\text{range} = \\min\\!\\left(1,\\ \\frac{\\max\_k x\_k - \\min\_k x\_k}{12}\\right)$$

💡

In this case, the "full mark line" is an octave.

Using the example above, we could get $\\text{range} =\\frac{72-67}{12}\\approx0.42$.

#### Density

How many notes are in the sequence; mostly the same as above. Let $L$ be the length in quarter notes, we would get:

$$\\text{density} = \\min\\!\\left(1,\\ \\frac{n}{4L}\\right)$$

💡

In this case, 4 notes per quarter (16th notes) is the "full mark line".

In the example, it would be $n=4$, $L=4$, density $=0.25$

#### Everything combined

Finally, we could get

$$\\mu = 0.4\\,\\text{motion} + 0.3\\,\\text{range} + 0.3\\,\\text{density}$$

For the example, $\\mu = 0.4\\times0.83 + 0.3\\times0.42 + 0.3\\times0.25 \\approx 0.33+0.125+0.075 = 0.53$.

⚠️

The algorithm really doesn't like cues; a measure full of cues will make the algorithm think it's a snare drum.

#### Limitations

You might have noticed that sometimes it does not produce ideal results. Here are some examples to see if there's anything wrong:

| Phrase                        | motion | range | density | 𝝻    |
| ----------------------------- | ------ | ----- | ------- | ----- |
| Sustained whole note          | 0      | 0     | 0.06    | 0.02  |
| Repeated quarter note C C C C | 0      | 0     | 0.25    | 0.075 |
| Lyrical half note E→G         | 0.75   | 0.25  | 0.125   | 0.41  |
| Scale C D E F G A B C         | 0.43   | 1     | 0.5     | 0.62  |
| Alternating notes C D C D…    | 0.5    | 0.17  | 1       | 0.55  |
| Alberti bass C G E G C G E G  | 1      | 0.58  | 0.5     | 0.73  |
| Arpeggio C E G C’ ×4          | 1      | 1     | 1       | 1     |

...well, it will certainly not have a "melodic" code name in the future.

Since it also discards any ties, the "motion" will be inaccurate in many places. That's a task for my future self, though.

### How exposed are you?

$T$ is the set of moments where $p$’s top line starts a note in bar $m$, and $o(t)$ is the number of other parts sounding at $t$.

$$\\xi = \\frac{1}{|T|}\\sum\_{t\\in T}\\frac{1}{1+o(t)}$$

As reflected by $\\frac{1}{1+o(t)}$, the fewer other parts are sounding, the higher the score it gets. If it has no onsets, then $\\xi=0.5$.

### Combine all of them

Finally, combining everything, we would get$$\\sigma\_{p,m} = 0.5\\,\\mu + 0.25\\,\\xi + 0.25\\,\\delta$$

🥁

For unpitched instruments such as the snare drum, we define $\\mu=0$ and $\\xi=0.25$.

## Third step: Are you doubling?

It's extremely common to have doubling in music, whether in the same or different octaves.

![](https://0x57.cc/content/images/2026/10/image-5.png)

Excerpt from **Bolero*, also the reason why snare drum has such low ****ζ**

Like how additive synthesis works, it doesn't create 2 separate lines, but a new mixed tone and timbre.

💡

This is also one of the reasons you don't want parallel things going on in your 4-part writing. It destroys the balance and the individuality between parts.  
Learn more at: [https://soundquest.jp/quest/chord/chord-mv7/interval-and-overtones/](https://soundquest.jp/quest/chord/chord-mv7/interval-and-overtones/?ref=0x57.cc)

In an ideal environment, all lines can be displayed, but if the vertical space is already pretty tight, dropping some doubling would be fine.

That's basically everything in the section, but only if algorithms could accept natural-language descriptions. Skip to the next section if you don't want to read math clutter.

### Sorting & Encoding

For every non-tied note in part $p$ in measure $m$, where $t$ is its position in quarter notes.

$$E\_{p,m} = \\{\\ (\\text{round}(960\\,t),\\ \\text{midi} \\bmod 12)\\ \\}$$

💡

****Why 960?**  
Because it's the common PPQ for MIDI. This is important since equality might break under floating point inaccuracy. 

$\\text{midi}\\bmod 12$ ensures that octaves are flattened: C4 (60) and C5 (72) have the same remainder when divided by 12\. Note that the duration of the note is not considered.

### Conditions for doubling

For 2 phrases $q$ and $p$ to be "doubling", here are some metrics.

#### Rule 1: $p$ must have at least 2 distinct onset moments

If $p$ only has 1 note, the percent of error would be too high, and it will essentially mark every chord cluster as a doubling.

#### Rule 2: $p$ is a subset of $q$

This is to make sure that one has all the features the other one has. Otherwise, it will never have the possibility of being a doubling.

#### Rule 3: $p$ has the same note starting points as $q$

This is to prevent arpeggios from being mismatched as a doubling, as they contain more notes.

After all those steps, we get a new set $D$, where $$D\_{p,m} = \\{\\ q \\ne p : q \\text{ at measure } m \\text{ doubles } p\\ \\}$$

⚠️

Beware of the direction: it stores the parts that double $p$, not the parts $p$ doubles.

### Limitations

This is not a very robust detection; it will fail in any of these cases:

- Doubling with decoration: since it violates Rule 3.
- Doubling across barlines: since ties are dropped for the succeeding measure.
- Same note, but different functions.

## Fourth step: Don't overflow!

We have collected enough information, from the score to the duplicated parts; it's now time to combine them.

An important concept is how the deletion works: a good deletion will make the remaining parts harder to delete. Unique parts should be kept unless they're not significant enough to maintain their position on the curated score.

📐

Quick reference of labels being referred to here:  
\- $\\sigma\_{p,m}$: Score  
\- $D\_{p,m}$: Doubling part

Let $C$ be all of the removed parts (excluding resting parts) and $Sp\_m$ be all of the parts left; $C$ and $Sp\_m$ will change as the process proceeds.

### Inheritance

When a part $x$ is deleted, any part $p$ that plays every note $x$ starts ($p \\in D\_{x,m}$) now carries $x$’s sound, so $p$ is worth at least as much as $x$.

To achieve this, we need to find a part $x$ in $C$, where $p$ is in the set $D$, find the highest-scoring $x$, then compare it with $p$. We're not using addition here since it's considered a single element, not a sum of all the doubling parts.

$$\\tilde w\_{p,m} = \\max\\Big(\\sigma\_{p,m},\\ \\max\_{x\\in C,\\ p\\in D\_{x,m}} \\sigma\_{x,m}\\Big)$$

If such $x$ does not exist, $\\tilde w\_{p,m}$ will be the same as $\\sigma\_{p,m}$.

⚠️

Again, this is why the direction of $D$ is significant here; double-check the directions if your replica does not work.

### Delegation

If the same part was played by multiple players (in this case, someone who doubles you is currently shown), you'll receive a duplication penalty factor, in this case, 4.

$$w\_{p,m} = \\begin{cases}\\tilde w\_{p,m}\\,/\\,4 & \\text{If } D\_{p,m}\\cap\\text{Sp}\_m\\ne\\varnothing\\\\\[4pt\] \\tilde w\_{p,m} & \\text{Else}\\end{cases}$$

$D\_{p,m}\\cap\\text{Sp}\_m$ ensures that the other part is on stage, and $\\ne\\varnothing$ ensures that the result isn't empty.

💡

For the duplication penalty factor, 4 is selected because it behaves relatively well in most scenarios.

The order is always Inherit first, then delegate. This is important because it makes sure that the removal of duplicated parts is not expensive.

For example, for the doubling part, there are Flute ($\\sigma = 0.3$), Oboe ($\\sigma = 0.7$, already cut from the score), and Violin, in which the Flute section is a subset of the Violin section, and Flute doubles Oboe.

By inheriting first and delegating second, $$\\tilde w\_{\\text{Flute}} = \\max(0.3,\\ 0.7) = 0.7,\\qquad w\_{\\text{Flute}} = 0.7/4 = 0.175$$

Since Violin is playing the flute part, flute receives a duplication penalty because Violin contains its part.

However, if we delegate first and inherit second, $$\\tilde w\_{\\text{Flute}} = \\max(0.3/4,\\ 0.7) = 0.7$$

The delegation step makes the flute's score much higher, tricking the engine into thinking that the flute part is crucial; the algorithm might target other important parts to remove.

In summary:

| Condition                                            | Inherit | Delegate | Final Weight                   |
| ---------------------------------------------------- | ------- | -------- | ------------------------------ |
| I am an individual part                              | False   | False    | $\\sigma$                      |
| Someone on stage doubles me                          | False   | True     | $\\sigma/4$                    |
| Everyone who doubles me is cut                       | False   | False    | $\\sigma$                      |
| I double a cut part                                  | True    | False    | $\\max(\\sigma, \\sigma\_x)$   |
| I double a cut part, and someone on stage doubles me | True    | True     | $\\max(\\sigma, \\sigma\_x)/4$ |

### Deletion

⚠️

All changes are only applied to selected lanes; unselected lanes will not join the deleting process and will remain on.  
However, unselected lanes will still join all calculations from previous steps.

Using the algorithm above, the program can then proceed to make deletions.

The overflowed part, sampled every 100ms, will be merged and cut down into region $\\Phi$, where $|\\Phi| \\leq 4$ measure.

The weight in a phrase is the average weight of all the displayed measures, and thus can be notated as$$\\bar w\_p = \\frac{\\displaystyle\\sum\_{m\\in\\Phi,\\ S\_{p,m}=1} w\_{p,m}}{\\big|\\{m\\in\\Phi : S\_{p,m}=1\\}\\big|}$$

Every time it overflows, the lowest-weight part is removed from the overflowing measure for each phrase, and then the overflow check is redone. If a region has only 0 or 1 part left, it will be exempted from the result of overflow check for obvious reasons. This repeats until the score fits, a round changes nothing, or 32 rounds have passed.

👁️‍🗨️

The algorithm might not behave as intended if even 1 staff overflows. But why would you do that?????

### Backfill

Backfill only runs if the deletion loop ended with a score that fits. If it gave up while still overflowing, this step is always ignored.

In the case that the deletion loop completes, it will often delete more than it needs. Here's an illustration of one reason:

![](https://0x57.cc/content/images/2026/11/image.png)

Different vertical spaces

The deletion stage is a greedy algorithm that is not context-aware and not revertible. In the image above, if the first measure is deleted, it frees vertical space in other bars.

💡

Another way is to limit the detection range by screen, but that will introduce more animations, which is not ideal since I have pretty bad motion sickness.

It's easy to assume a matrix $Z\\in\\{0,1\\}^{P\\times M}$ with all the deleted phrases marked, and the deletion record $$c\_k = (p\_k,\\ B\_k,\\ w\_k)$$, where $p\_k$ is the deleted part, $B\_k$ is the deleted region, and $w\_k$ the weight at the moment region $B\_k$ is removed.

💡

$w\_k$ will not be recalculated when backfilling.

Then, sort all the deletion records by $w\_k$ from high to low; the following procedure will have a budget to run $R$ overflow checks ($R=96$ in Curator) in total.

- Make sure that the measure is marked as deleted ($Z\_{p\_k,m}=1$ for $m\\in B\_k$)
- Put it back and rerun the overflow check: if it succeeds, keep it; if not, undo and proceed.
- If the phrase is longer than 1 measure, attempt to put back every measure and run the overflow check. Discard those failed measures.

💡

The backfill is the most performance-intensive part of the auto-curate.

### Anti-hole

You might recall that we tried to avoid holes in the score; it will also be checked here with inverted logic.

If a single measure is displayed where both sides of it are not displayed, and if either side was marked deleted, it will also be hidden.

---

Congratulations! You've finished the entire algorithm of Curator's self-curating algorithm.

If you want a demo of this algorithm, try it out in Curator!

Curator can do a lot more than just condensing!

[Get it now! ](https://curator.0x57.cc/?ref=0x57.cc) 

📙

If you need demo with the exact algorithm mentioned here, please download Curator 0.7.0\. Future version might modify how this algorithm works.

## Acknowledgement

- Most constants here are used by Curator, please refer to the program.
- Some constant values are tested with AI assistance, and the integration of the algorithm into the program is (mostly) done by AI.
- Special thanks to myself for designing the algorithm and writing this article at 1 am.
  - 2 am, if not counting time change ┐(￣ヘ￣)┌.