# Generator

The term **generator** has multiple senses.

## Generators in MOSes

*Main article: Periods and generators*

In MOS and rank-2 temperament contexts, the **generator** of a MOS or a rank-2 temperament is an interval that you stack up and reduce by the period of the MOS to construct the MOS pattern within each period. Along with the period, it is one of two defining intervals of the MOS. For example:

- In diatonic (LLLsLLs), the perfect fifth is a generator: stacking 6 fifths up from the tonic and reducing by the octave produces the pattern LLLsLLs, the Lydian mode. Note that the perfect fourth and the perfect twelfth are also generators.
- One example for a MOS with multiple periods per octave: for pajara[10] (ssLssssLss), the perfect fifth (~3/2) is a generator and the half-octave is the period.

## Generators in math and JI subgroups

A **generating set** of a group (such as a JI subgroup, a regular temperament based on a JI subgroup, or any MOS-based harmony) is a subset of the elements of the group which is not contained in any proper subgroup, which is to say, any subgroup which is not the whole group. If the set is a finite set, the group is called finitely generated. If it is also an abelian group, it is called a finitely generated abelian group. An element of a generating set is called a **generator**.

A **minimal generating set** is a generating set which has no "redundant" or "unnecessary" generators. For example, {2, 3, 5} and {2, 3, 5/3} are minimal generating sets for the JI subgroup 2.3.5. However, {2, 3, 5, 15} is not a minimal generating set: 15 = 3 · 5 so we can take out 15 from this generating set.

If the abelian group is written additively, then if [math]\lbrace g_1, g_2, \ldots g_k \rbrace[/math] is the generating set, every element [math]g[/math] of the group can be written

[math]g = n_1 g_1 + n_2 g_2 + \ldots + n_k g_k[/math]

where the [math]n_i[/math] are integers. If the group operation is written multiplicatively,

[math]g = {g_1}^{n_1} {g_2}^{n_2} \ldots {g_k}^{n_k}[/math]

### Relation to music

An important example is provided by regular temperaments, where if a particular tuning for the temperament is written additively, the generators can be taken as intervals expressed in terms of cents, and if multiplicatively, as intervals given as frequency ratios. Another example is provided by just intonation subgroups, where the generators are a finite set of positive rational numbers, called "formal primes", which are typically the literal prime numbers up to a given prime limit. These two example converge when we seek generators for the abstract temperament rather than any particular tuning of it.